chat: pin conversations to the top of the inbox - #29634
Open
chrisnojima wants to merge 7 commits into
Open
chrisnojima wants to merge 7 commits into
chrisnojima wants to merge 7 commits into
Conversation
Adds isPinned to UIInboxSmallTeamRow, a synced chatPinnedConvs gregor category that orders pinned small conversations first in the inbox layout, a gregor handler that rebuilds the layout when pins change on any device, and TS helpers to read/write the pinned list.
Read the pinned list fresh from the service, prune only IDs missing from the layout, and serialize writes. Base Move to top visibility on the layout instead of the debounced gregor push state.
Go reads pins from gregor state while building the layout, but that state only exists once the service connects, and items delivered in the connect-time sync never reach the in-band handler. Watch the gregor state pushed to the GUI and request a layout when the pin list in it changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lets users pin small conversations (1:1, group chats, and single-channel small teams) so they stay at the top of the chat inbox. Big-team channels can't be pinned.
chatPinnedConvs, holding a JSON array of conversation IDs with the top pin first. It follows the user across devices and survives logout. It's capped at 25 pins.buildLayoutputs pinned small conversations first, in list order, before the small-team bound truncation, so pins are never cut off. Rows carry a newisPinnedfield. Pinned IDs that aren't current small conversations are ignored.UpdateLayoutFromNewMessagenow compares against the first unpinned row, since a new message can't move a pinned row.Design choices
Testing
yarn lint:allclean (0 bailouts, 0 whole-props deps)yarn jest chat/inbox constants/initpasses, including new tests for parsing, reordering, pruning and the pin limit--new-from-rev masterare clean on the touched Go packages