Page MenuHomePhabricator

[lib] Check the store when searching for message edits
ClosedPublic

Authored by tomek on Aug 20 2024, 7:47 AM.
Tags
None
Referenced Files
F2763909: D13122.diff
Thu, Sep 19, 11:52 AM
Unknown Object (File)
Thu, Sep 12, 10:09 PM
Unknown Object (File)
Wed, Sep 11, 9:14 AM
Unknown Object (File)
Sun, Sep 8, 3:52 PM
Unknown Object (File)
Sun, Sep 8, 5:05 AM
Unknown Object (File)
Fri, Sep 6, 1:12 AM
Unknown Object (File)
Wed, Sep 4, 8:29 PM
Unknown Object (File)
Wed, Sep 4, 3:53 AM
Subscribers

Details

Summary

It can happen that when creating a thick sidebar, we don't yet have the source message persisted in the DB. In that case, we can try to find the message in Redux store.

https://linear.app/comm/issue/ENG-9034/creating-a-thick-sidebar-just-after-sending-a-message-doesnt-work

Depends on D13059

Test Plan

Checked if creating a sidebar immediately after sending a message works (before this diff the sidebar isn't created and an exception is thrown). Also checked if creating a message -> editing -> creating a sidebar works (with 10 edits).

const tid = uuid.v4();
await this.props.processDMOps({
  type: 'create_thread',
  threadID: tid,
  creatorID: viewerID,
  time: Date.now(),
  threadType: threadTypes.LOCAL,
  memberIDs: [],
  roleID: uuid.v4(),
  newMessageID: uuid.v4(),
});
const mid = uuid.v4();
await this.props.processDMOps({
  type: 'send_text_message',
  threadID: tid,
  creatorID: viewerID,
  time: Date.now(),
  messageID: mid,
  text: `${text}-parent`,
});
for (let i = 0; i < 10; i++) {
  await this.props.processDMOps({
    type: 'send_edit_message',
    threadID: tid,
    creatorID: viewerID,
    time: Date.now(),
    messageID: uuid.v4(),
    targetMessageID: mid,
    text: `${text}-${i}`,
  });
}
const sid = uuid.v4();
await this.props.processDMOps({
  type: 'create_sidebar',
  threadID: sid,
  creatorID: viewerID,
  time: Date.now(),
  parentThreadID: tid,
  memberIDs: [],
  sourceMessageID: mid,
  roleID: uuid.v4(),
  newSidebarSourceMessageID: uuid.v4(),
  newCreateSidebarMessageID: uuid.v4(),
});
await this.props.processDMOps({
  type: 'send_text_message',
  threadID: sid,
  creatorID: viewerID,
  time: Date.now(),
  messageID: uuid.v4(),
  text: `${text}-sidebar`,
});

Diff Detail

Repository
rCOMM Comm
Branch
dmops (branched from palys-swm/dmops)
Lint
No Lint Coverage
Unit
No Test Coverage