Fix API break: use new methods canUserRedactOwn and canUserRedactOther.

This commit is contained in:
Benoit Marty 2024-01-23 12:20:07 +01:00 committed by Benoit Marty
parent ce7d77059c
commit f844399025
13 changed files with 286 additions and 49 deletions

View file

@ -127,7 +127,9 @@ interface MatrixRoom : Closeable {
suspend fun canUserInvite(userId: UserId): Result<Boolean>
suspend fun canUserRedact(userId: UserId): Result<Boolean>
suspend fun canUserRedactOwn(userId: UserId): Result<Boolean>
suspend fun canUserRedactOther(userId: UserId): Result<Boolean>
suspend fun canUserSendState(userId: UserId, type: StateEventType): Result<Boolean>

View file

@ -36,6 +36,11 @@ suspend fun MatrixRoom.canSendState(type: StateEventType): Result<Boolean> = can
suspend fun MatrixRoom.canSendMessage(type: MessageEventType): Result<Boolean> = canUserSendMessage(sessionId, type)
/**
* Shortcut for calling [MatrixRoom.canUserRedact] with our own user.
* Shortcut for calling [MatrixRoom.canUserRedactOwn] with our own user.
*/
suspend fun MatrixRoom.canRedact(): Result<Boolean> = canUserRedact(sessionId)
suspend fun MatrixRoom.canRedactOwn(): Result<Boolean> = canUserRedactOwn(sessionId)
/**
* Shortcut for calling [MatrixRoom.canRedactOther] with our own user.
*/
suspend fun MatrixRoom.canRedactOther(): Result<Boolean> = canUserRedactOther(sessionId)