Repository navigation
feat(chat): restrict and remove members in groups - #1163
Merged
Merged
Conversation
A chat saved before canSilence and canBan existed lost its whole viewer state on read (the synthesized decoder throws on a missing key), and a later fetch at the same version was dropped by the version gate, so the host never saw Silence or Ban. Decode missing permissions as false, and refresh permissions from GetChat when the group profile opens.
… transcript open A metadata or feed row replaced the whole viewer state, so an older row rolled back a mute and one that omitted the permissions reset canSilence and canBan. Keep the stored state when the incoming version is lower, and keep held permissions at an equal version. The transcript now re-reads permissions when it opens, sharing one fetch with the profile within 30 seconds.
… changes Share the Blocked Users / Trusted Websites empty state as EmptyStateMessage and use it on the Silenced and Removed lists. Show a toast after a silence or unsilence succeeds, never on failure.
A ban reaches the other members as an undisclosed membershipChanged update that moves the count and names no one, and the host receives no departure at all. GroupRosters ignored that update, so the list kept showing the removed member while the count dropped. Re-read the roster on membershipChanged and drop held members the full read omits (except ones the stream delivered mid-read), and drop the member immediately after a removal made on this device. Also use the moderation empty-state copy from the design.
The lift menu built its rows with contextMenu(for:).children.compactMap { $0 as? UIAction }.
The context menu nests the moderation rows in an inline UIMenu section after Report, so the
compactMap skipped them and the long-press menu showed only Copy, Reply, Forward and Report.
Add liftMenuActions(for:), which flattens nested menus, and use it in presentLift. The menu
view now puts a divider before the moderation group and none before Remove, and tints
destructive rows with textError instead of systemRed.
User-facing copy changes from Silence to Restrict; code and contract names stay. The message menu row reads "Restrict <First>" with no ellipsis, Remove keeps its ellipsis, and the profile menu, sheet, toasts, composer pill, moderation lists and empty states follow the new wording. MessageCapability.menuTitle is now internal so ModerationRowTitleTests can check it.
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.
Adds group moderation for hosts: Restrict stops a member from sending messages, and Remove bans them from the group. The spec and design frames are in
docs/specs/group-moderation/, and the cross-platform spec is code-payments/flipcash-client-orchestrator#68.The UI says Restrict. The code keeps the contract's Silence names, so the Swift matches the protos.
Host
Restricted or removed member
membershipChangedupdate that names no one, whichGroupRostersused to ignore.Other changes
UserProfileOrigin.groupMembercarries the group, so the member profile knows which group it is moderating.