Change a room's permissions power levels (#2525)

* Change a room's permissions power levels

* Make `currentPermissions` use a `MatrixRoomPowerLevels?` instance instead.

* Update strings

* Update screenshots

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
Jorge Martin Espinosa 2024-03-12 15:45:06 +01:00 committed by GitHub
parent 3453738344
commit 59a682b407
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
71 changed files with 1556 additions and 58 deletions

View file

@ -29,6 +29,7 @@ import io.element.android.libraries.matrix.api.media.MediaUploadHandler
import io.element.android.libraries.matrix.api.media.VideoInfo
import io.element.android.libraries.matrix.api.poll.PollKind
import io.element.android.libraries.matrix.api.room.location.AssetType
import io.element.android.libraries.matrix.api.room.powerlevels.MatrixRoomPowerLevels
import io.element.android.libraries.matrix.api.room.powerlevels.UserRoleChange
import io.element.android.libraries.matrix.api.timeline.MatrixTimeline
import io.element.android.libraries.matrix.api.timeline.ReceiptType
@ -97,6 +98,12 @@ interface MatrixRoom : Closeable {
suspend fun unsubscribeFromSync()
suspend fun powerLevels(): Result<MatrixRoomPowerLevels>
suspend fun updatePowerLevels(matrixRoomPowerLevels: MatrixRoomPowerLevels): Result<Unit>
suspend fun resetPowerLevels(): Result<MatrixRoomPowerLevels>
suspend fun userRole(userId: UserId): Result<RoomMember.Role>
suspend fun updateUsersRoles(changes: List<UserRoleChange>): Result<Unit>

View file

@ -20,6 +20,17 @@ import io.element.android.libraries.matrix.api.room.MatrixRoom
import io.element.android.libraries.matrix.api.room.MessageEventType
import io.element.android.libraries.matrix.api.room.StateEventType
data class MatrixRoomPowerLevels(
val ban: Long,
val invite: Long,
val kick: Long,
val sendEvents: Long,
val redactEvents: Long,
val roomName: Long,
val roomAvatar: Long,
val roomTopic: Long,
)
/**
* Shortcut for calling [MatrixRoom.canUserInvite] with our own user.
*/

View file

@ -33,7 +33,7 @@ sealed interface OtherState {
data object RoomJoinRules : OtherState
data class RoomName(val name: String?) : OtherState
data object RoomPinnedEvents : OtherState
data class RoomPowerLevels(val users: Map<String, Long>) : OtherState
data class RoomUserPowerLevels(val users: Map<String, Long>) : OtherState
data object RoomServerAcl : OtherState
data class RoomThirdPartyInvite(val displayName: String?) : OtherState
data object RoomTombstone : OtherState