mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +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 standardRoles = memberDatabase.getGroupMemberRoles(groupId, standardPublicKey)
|
||||||
val blindedRoles = blindedPublicKey?.let { memberDatabase.getGroupMemberRoles(groupId, it) } ?: emptyList()
|
val blindedRoles = blindedPublicKey?.let { memberDatabase.getGroupMemberRoles(groupId, it) } ?: emptyList()
|
||||||
|
|
||||||
return GroupMemberRole.ADMIN in standardRoles || GroupMemberRole.MODERATOR in standardRoles ||
|
// roles to check against
|
||||||
GroupMemberRole.ADMIN in blindedRoles || GroupMemberRole.MODERATOR in blindedRoles
|
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 {
|
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 {
|
pollInfo.details?.moderators?.forEach {
|
||||||
storage.addGroupMember(GroupMember(groupId, it, GroupMemberRole.MODERATOR))
|
storage.addGroupMember(GroupMember(groupId, it, GroupMemberRole.MODERATOR))
|
||||||
}
|
}
|
||||||
|
pollInfo.details?.hiddenModerators?.forEach {
|
||||||
|
storage.addGroupMember(GroupMember(groupId, it, GroupMemberRole.HIDDEN_MODERATOR))
|
||||||
|
}
|
||||||
// - Admins
|
// - Admins
|
||||||
pollInfo.details?.admins?.forEach {
|
pollInfo.details?.admins?.forEach {
|
||||||
storage.addGroupMember(GroupMember(groupId, it, GroupMemberRole.ADMIN))
|
storage.addGroupMember(GroupMember(groupId, it, GroupMemberRole.ADMIN))
|
||||||
}
|
}
|
||||||
|
pollInfo.details?.hiddenAdmins?.forEach {
|
||||||
|
storage.addGroupMember(GroupMember(groupId, it, GroupMemberRole.HIDDEN_ADMIN))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleMessages(
|
private fun handleMessages(
|
||||||
|
Loading…
Reference in New Issue
Block a user