Page MenuHomePhabricator

[lib] Remove parent admin from members list if they are not part of the thread
ClosedPublic

Authored by rohan on Jun 2 2023, 4:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 5, 9:03 AM
Unknown Object (File)
Fri, Apr 5, 8:59 AM
Unknown Object (File)
Mar 7 2024, 5:08 AM
Unknown Object (File)
Mar 7 2024, 3:11 AM
Unknown Object (File)
Mar 7 2024, 12:24 AM
Unknown Object (File)
Mar 6 2024, 10:56 PM
Unknown Object (File)
Mar 5 2024, 9:22 PM
Unknown Object (File)
Mar 5 2024, 9:22 PM
Subscribers

Details

Summary

As mentioned in DES-44, there are two changes we want to make to 'Parent admins'. The first (handled in other diffs already), involves
displaying just Admins. The second is handled here, involving no longer showing the parent admin as part of the members list if they are not actually in it.

Depends on D8068

Test Plan

Confirmed that chats that don't actually involve the local parent admin (user ID 256) will no longer show them in the members list. Chats that do, however, will still show them.

Chat where the parent admin is not a member of the chat
Before:

Screenshot 2023-06-02 at 7.36.54 AM.png (1×1 px, 85 KB)

After:

Screenshot 2023-06-02 at 7.36.34 AM.png (1×1 px, 77 KB)

Chat where the parent admin is a member of the chat
Before:

Screenshot 2023-06-02 at 7.43.24 AM.png (1×992 px, 89 KB)

After (no changes):

Screenshot 2023-06-02 at 7.43.34 AM.png (1×1 px, 90 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rohan edited the test plan for this revision. (Show Details)
rohan requested review of this revision.Jun 2 2023, 4:57 AM
ashoat requested changes to this revision.Jun 2 2023, 8:47 AM

This diff makes sense, but from a code search it looks like it might impact ThreadSettingsLeaveThread and its use of otherUsersButNoOtherAdmins.

In ThreadSettingsLeaveThread, we want to prevent somebody from leaving a chat if they are the only admin. I think it's important to consider "parent admins" there... otherwise, I think I'll be prevented from leaving any chats in eg. Comm. Not 100% sure if this is true, but can you investigate?

This revision now requires changes to proceed.Jun 2 2023, 8:47 AM

This diff makes sense, but from a code search it looks like it might impact ThreadSettingsLeaveThread and its use of otherUsersButNoOtherAdmins.

In ThreadSettingsLeaveThread, we want to prevent somebody from leaving a chat if they are the only admin. I think it's important to consider "parent admins" there... otherwise, I think I'll be prevented from leaving any chats in eg. Comm. Not 100% sure if this is true, but can you investigate?

It looks like baseOtherUsersButNoOtherAdmins will early check for if there is an Admin role present for the thread - if not, it returns false.

So in the case of what looks to be all threads within a community, it will always be false since it seems like the Admins role is present only at the top-level community root channel, so you would be able to leave any of those.

In regards to the top level community channel, it seems to function as before:

BeforeAfter

Once another member has access to the "Admins" role however, you'll be able to leave:

Let me know if that answers your question!

Okay, cool. I'm a bit worried that in the future we might introduce an "admin" role for a channel in a community, and in that scenario this code would break ThreadSettingsLeaveThread's usage of otherUsersButNoOtherAdmins. But I guess we can address that when we get there...

This revision is now accepted and ready to land.Jun 6 2023, 8:50 AM