HomePhabricator
Diffusion Comm 6b8fce7f0f21

[keyserver/lib/web/native] Modify fetchRelatedMessages to fetch toggle_pin…

Description

[keyserver/lib/web/native] Modify fetchRelatedMessages to fetch toggle_pin messages

Summary:
Currently, if a message is pinned, a toggle_pin robotext message appears in chat. This is how we determine whether a message's status is 'pinned' or 'unpinned' in order to display the appropriate action for the user if they want to toggle that. The problem with this is that if a message is not fetched when the chat is loaded, then when the message results modal is opened, the pinned message doesn't
have the right information and will always be unpinned until the chat is scrolled up enough.

This diff modifies fetchRelatedMessages to include all messages of the TOGGLE_PIN type, so we know what messages should be pinned when creating the ChatMessageItems in chat-selectors. Since these are actual, visible messages I also had to filter them out of the view in message-results-modal and message-results-screen on web and native.

The last thing done is here a quick rename to update the callsites since we're now including pinned messages, so I've renamed isMessageSidebarSourceReactionOrEdit to isMessageSidebarSourceReactionEditOrPin. I can also do this rename in a separate diff if it's too complicated to review the changes.

Resolves ENG-4671

Test Plan:
Before - old pinned messages show the 'pin' action in the message results modal until rendered in chat

After - old pinned messages show the 'unpin' action in the message results modal even before the user scrolls to render them

Reviewers: inka, ginsu, atul

Reviewed By: inka

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D8982

Details

Provenance
rohanAuthored on Aug 28 2023, 9:44 AM
Reviewer
inka
Differential Revision
D8982: [keyserver/lib/web/native] Modify fetchRelatedMessages to fetch toggle_pin messages
Parents
rCOMMd794c76960af: [reports-service] Add service error types
Branches
Unknown
Tags
Unknown