Skip to content

Add people to channels from mobile members sheet#1706

Open
vincenzopalazzo wants to merge 1 commit into
block:mainfrom
vincenzopalazzo:fix/mobile-add-channel-members
Open

Add people to channels from mobile members sheet#1706
vincenzopalazzo wants to merge 1 commit into
block:mainfrom
vincenzopalazzo:fix/mobile-add-channel-members

Conversation

@vincenzopalazzo

Copy link
Copy Markdown

Summary

  • After creating a channel on mobile, there was no way to invite people — MembersSheet only listed existing members/bots
  • Root cause: product gap vs desktop (PR fix(desktop): let channel members add members and bots without admin #815). Mobile had searchUsers and role/remove actions, but no add-member API/UI
  • Fix: add ChannelActions.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 frozen

Test plan

  • flutter test test/features/channels/members_sheet_test.dart (search + add, DM hides field)
  • flutter analyze clean on touched files
  • CI green
  • Manual: create a private channel on mobile → open Members → search a user → Add → they appear in the list
  • Manual: open a DM members sheet → no search field
  • Manual: non-member on private channel → search field disabled

@vincenzopalazzo vincenzopalazzo requested a review from a team as a code owner July 10, 2026 11:54
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>
@vincenzopalazzo vincenzopalazzo force-pushed the fix/mobile-add-channel-members branch from 64444ec to 775b603 Compare July 10, 2026 11:54

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +123 to +125
await ref
.read(channelActionsProvider)
.addMember(channelId: channel.id, pubkey: user.pubkey);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add agents with the bot role

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 👍 / 👎.

Comment on lines +132 to +136
} finally {
addingPubkeys.value = {
for (final candidate in addingPubkeys.value)
if (candidate != pubkey) candidate,
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant