Refactor userEventPermissions
This commit is contained in:
parent
2605ddec7a
commit
6ad547833f
7 changed files with 41 additions and 24 deletions
|
|
@ -65,3 +65,8 @@ suspend fun MatrixRoom.canRedactOwn(): Result<Boolean> = canUserRedactOwn(sessio
|
|||
* Shortcut for calling [MatrixRoom.canRedactOther] with our own user.
|
||||
*/
|
||||
suspend fun MatrixRoom.canRedactOther(): Result<Boolean> = canUserRedactOther(sessionId)
|
||||
|
||||
/**
|
||||
* Shortcut for calling [MatrixRoom.canUserPinUnpin] with our own user.
|
||||
*/
|
||||
suspend fun MatrixRoom.canPinUnpin(): Result<Boolean> = canUserPinUnpin(sessionId)
|
||||
|
|
|
|||
|
|
@ -56,6 +56,13 @@ fun MatrixRoom.canCall(updateKey: Long): State<Boolean> {
|
|||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MatrixRoom.canPinUnpin(updateKey: Long): State<Boolean> {
|
||||
return produceState(initialValue = false, key1 = updateKey) {
|
||||
value = canUserPinUnpin(sessionId).getOrElse { false }
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MatrixRoom.isOwnUserAdmin(): Boolean {
|
||||
val roomInfo by roomInfoFlow.collectAsState(initial = null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue