Add people to channels from mobile members sheet#1706
Conversation
After creating a channel, mobile had no way to invite members — MembersSheet only listed existing people/bots. Wire NIP-29 put-user (kind 9000) via ChannelActions.addMember and a debounced directory search field matching desktop PR block#815 policy (any active member can add non-elevated roles; DMs and archived channels stay frozen). Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
64444ec to
775b603
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64444ec0dd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await ref | ||
| .read(channelActionsProvider) | ||
| .addMember(channelId: channel.id, pubkey: user.pubkey); |
There was a problem hiding this comment.
When a search result is an agent (a kind:0 profile with a valid NIP-OA auth tag), this call always uses addMember's default member role. The relay then stores the channel member as a person, while bot/activity surfaces classify agents from role == 'bot' (desktop's members sidebar passes role: user.isAgent ? "bot" : "member"). Agents added from mobile will appear under People and miss bot/activity affordances; carry the agent marker from the search event and pass role: 'bot' for those results.
Useful? React with 👍 / 👎.
| } finally { | ||
| addingPubkeys.value = { | ||
| for (final candidate in addingPubkeys.value) | ||
| if (candidate != pubkey) candidate, | ||
| }; |
There was a problem hiding this comment.
Guard hook state updates after sheet disposal
If the add request is slow and the user dismisses the members sheet before it completes, the await resumes after this HookWidget has been disposed. The success path checks context.mounted, but the finally block still writes to the disposed addingPubkeys notifier (and the catch path writes addError), causing the usual set-after-dispose assertion/crash in that scenario. Return before touching hook state when !context.mounted, including in catch/finally.
Useful? React with 👍 / 👎.
Summary
MembersSheetonly listed existing members/botssearchUsersand role/remove actions, but no add-member API/UIChannelActions.addMember(NIP-29 put-user kind 9000) and a debounced "Add people and agents" search field in the members sheet. Policy matches desktop: any active channel member can add non-elevated roles; DMs and archived channels stay frozenTest plan
flutter test test/features/channels/members_sheet_test.dart(search + add, DM hides field)flutter analyzeclean on touched files