mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
feat: add hidden moderator and admin roles, separated as they may be used independently in future (#942)
This commit is contained in:
parent
e7ca53ff72
commit
5469f232a0
@ -148,8 +148,12 @@ object OpenGroupManager {
|
||||
val standardRoles = memberDatabase.getGroupMemberRoles(groupId, standardPublicKey)
|
||||
val blindedRoles = blindedPublicKey?.let { memberDatabase.getGroupMemberRoles(groupId, it) } ?: emptyList()
|
||||
|
||||
return GroupMemberRole.ADMIN in standardRoles || GroupMemberRole.MODERATOR in standardRoles ||
|
||||
GroupMemberRole.ADMIN in blindedRoles || GroupMemberRole.MODERATOR in blindedRoles
|
||||
// roles to check against
|
||||
val moderatorRoles = listOf(
|
||||
GroupMemberRole.MODERATOR, GroupMemberRole.ADMIN,
|
||||
GroupMemberRole.HIDDEN_MODERATOR, GroupMemberRole.HIDDEN_ADMIN
|
||||
)
|
||||
return standardRoles.any { it in moderatorRoles } || blindedRoles.any { it in moderatorRoles }
|
||||
}
|
||||
|
||||
}
|
@ -7,5 +7,5 @@ data class GroupMember(
|
||||
)
|
||||
|
||||
enum class GroupMemberRole {
|
||||
STANDARD, ZOOMBIE, MODERATOR, ADMIN
|
||||
STANDARD, ZOOMBIE, MODERATOR, ADMIN, HIDDEN_MODERATOR, HIDDEN_ADMIN
|
||||
}
|
||||
|
@ -136,10 +136,16 @@ class OpenGroupPoller(private val server: String, private val executorService: S
|
||||
pollInfo.details?.moderators?.forEach {
|
||||
storage.addGroupMember(GroupMember(groupId, it, GroupMemberRole.MODERATOR))
|
||||
}
|
||||
pollInfo.details?.hiddenModerators?.forEach {
|
||||
storage.addGroupMember(GroupMember(groupId, it, GroupMemberRole.HIDDEN_MODERATOR))
|
||||
}
|
||||
// - Admins
|
||||
pollInfo.details?.admins?.forEach {
|
||||
storage.addGroupMember(GroupMember(groupId, it, GroupMemberRole.ADMIN))
|
||||
}
|
||||
pollInfo.details?.hiddenAdmins?.forEach {
|
||||
storage.addGroupMember(GroupMember(groupId, it, GroupMemberRole.HIDDEN_ADMIN))
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleMessages(
|
||||
|
Loading…
x
Reference in New Issue
Block a user