Skip to content

Conversation

@jbsession
Copy link
Collaborator

This PR updates logic for checking if the user is a group admin and adds that logic to the context menu on conversation long-press.

@jbsession jbsession self-assigned this Jan 29, 2026
val groupV2Id = (address as? Address.Group)?.accountId ?: return
val isAdmin = groupManagerV2.isCurrentUserGroupAdmin(groupV2Id)

if (isAdmin == null) return
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it dangerous to mix up non-existing groups with admin logic?
It's not obvious that a null admin means no group.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, would an explicit check be better here?

     val groupInfo = configFactory.getGroup(groupV2Id)

      if (groupInfo == null) return

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that's true for the overall chance of isAdmin being nullable throughout? Is it misleading to add this nullable case to use as a way to say the group doesn't exist? It feels like a separate thing than the admin state

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm makes sense. I removed the check from the group manager, added checks for groupInfo instead and check the admin key from that.

Copy link
Collaborator

@ThomasSession ThomasSession left a comment

Choose a reason for hiding this comment

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

Nice

@jbsession jbsession merged commit 4390745 into session-foundation:dev Jan 29, 2026
4 checks passed
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.

2 participants