Set a default power level to join calls in room (#1927)
* Set a default power level to join calls. Also, create new rooms taking this power level into account. * Modify test to make sure we display the disabled state even when there is an ongoing call --------- Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
parent
7582d2f12e
commit
2e8d5ac86a
12 changed files with 98 additions and 21 deletions
|
|
@ -77,6 +77,7 @@ import org.matrix.rustcomponents.sdk.BackupState
|
|||
import org.matrix.rustcomponents.sdk.Client
|
||||
import org.matrix.rustcomponents.sdk.ClientDelegate
|
||||
import org.matrix.rustcomponents.sdk.NotificationProcessSetup
|
||||
import org.matrix.rustcomponents.sdk.PowerLevels
|
||||
import org.matrix.rustcomponents.sdk.Room
|
||||
import org.matrix.rustcomponents.sdk.RoomListItem
|
||||
import org.matrix.rustcomponents.sdk.TaskHandle
|
||||
|
|
@ -275,6 +276,7 @@ class RustMatrixClient constructor(
|
|||
},
|
||||
invite = createRoomParams.invite?.map { it.value },
|
||||
avatar = createRoomParams.avatar,
|
||||
powerLevelContentOverride = defaultRoomCreationPowerLevels,
|
||||
)
|
||||
val roomId = RoomId(client.createRoom(rustParams))
|
||||
|
||||
|
|
@ -297,7 +299,7 @@ class RustMatrixClient constructor(
|
|||
isDirect = true,
|
||||
visibility = RoomVisibility.PRIVATE,
|
||||
preset = RoomPreset.TRUSTED_PRIVATE_CHAT,
|
||||
invite = listOf(userId)
|
||||
invite = listOf(userId),
|
||||
)
|
||||
return createRoom(createRoomParams)
|
||||
}
|
||||
|
|
@ -482,3 +484,18 @@ class RustMatrixClient constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private val defaultRoomCreationPowerLevels = PowerLevels(
|
||||
usersDefault = null,
|
||||
eventsDefault = null,
|
||||
stateDefault = null,
|
||||
ban = null,
|
||||
kick = null,
|
||||
redact = null,
|
||||
invite = null,
|
||||
notifications = null,
|
||||
users = mapOf(),
|
||||
events = mapOf(
|
||||
"m.call.member" to 0,
|
||||
"org.matrix.msc3401.call.member" to 0,
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -364,6 +364,12 @@ class RustMatrixRoom(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun canUserJoinCall(userId: UserId): Result<Boolean> {
|
||||
return runCatching {
|
||||
innerRoom.canUserSendState(userId.value, StateEventType.ROOM_MEMBER_EVENT.map())
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun sendImage(file: File, thumbnailFile: File, imageInfo: ImageInfo, progressCallback: ProgressCallback?): Result<MediaUploadHandler> {
|
||||
return sendAttachment(listOf(file, thumbnailFile)) {
|
||||
innerTimeline.sendImage(file.path, thumbnailFile.path, imageInfo.map(), progressCallback?.toProgressWatcher())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue