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
F3362020: D13122.diff
Sun, Nov 24, 8:56 PM
Unknown Object (File)
Sun, Nov 10, 9:17 AM
Unknown Object (File)
Sun, Nov 10, 7:31 AM
Unknown Object (File)
Sun, Nov 10, 6:26 AM
Unknown Object (File)
Sun, Nov 10, 1:03 AM
Unknown Object (File)
Fri, Nov 8, 10:37 PM
Unknown Object (File)
Fri, Nov 8, 1:44 PM
Unknown Object (File)
Sep 25 2024, 3:08 PM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable