Invite users to existing rooms (#441)
Invite users to existing rooms Scope: - Allow inviting from the room detail screen and the member list - Invite option is only shown if the user has the correct power level - Search flow the same as creating a new room, allowing multi-select - Existing room members/invitees are disabled with a custom caption - Sending is asynchronous, an error dialog will appear wherever the user is if necessary Closes #245
This commit is contained in:
parent
6825d8ac2b
commit
198d6d4c56
85 changed files with 1668 additions and 69 deletions
|
|
@ -59,6 +59,8 @@ class FakeMatrixRoom(
|
|||
private var updateMembersResult: Result<Unit> = Result.success(Unit)
|
||||
private var acceptInviteResult = Result.success(Unit)
|
||||
private var rejectInviteResult = Result.success(Unit)
|
||||
private var inviteUserResult = Result.success(Unit)
|
||||
private var canInviteResult = Result.success(true)
|
||||
private var sendMediaResult = Result.success(Unit)
|
||||
var sendMediaCount = 0
|
||||
private set
|
||||
|
|
@ -69,6 +71,9 @@ class FakeMatrixRoom(
|
|||
var isInviteRejected: Boolean = false
|
||||
private set
|
||||
|
||||
var invitedUserId: UserId? = null
|
||||
private set
|
||||
|
||||
private var leaveRoomError: Throwable? = null
|
||||
|
||||
override val membersStateFlow: MutableStateFlow<MatrixRoomMembersState> = MutableStateFlow(MatrixRoomMembersState.Unknown)
|
||||
|
|
@ -136,6 +141,15 @@ class FakeMatrixRoom(
|
|||
return rejectInviteResult
|
||||
}
|
||||
|
||||
override suspend fun inviteUserById(id: UserId): Result<Unit> {
|
||||
invitedUserId = id
|
||||
return inviteUserResult
|
||||
}
|
||||
|
||||
override suspend fun canInvite(): Result<Boolean> {
|
||||
return canInviteResult
|
||||
}
|
||||
|
||||
override suspend fun sendImage(file: File, thumbnailFile: File, imageInfo: ImageInfo): Result<Unit> = sendMediaResult.also { sendMediaCount++ }
|
||||
|
||||
override suspend fun sendVideo(file: File, thumbnailFile: File, videoInfo: VideoInfo): Result<Unit> = sendMediaResult.also { sendMediaCount++ }
|
||||
|
|
@ -174,6 +188,14 @@ class FakeMatrixRoom(
|
|||
rejectInviteResult = result
|
||||
}
|
||||
|
||||
fun givenInviteUserResult(result: Result<Unit>) {
|
||||
inviteUserResult = result
|
||||
}
|
||||
|
||||
fun givenCanInviteResult(result: Result<Boolean>) {
|
||||
canInviteResult = result
|
||||
}
|
||||
|
||||
fun givenIgnoreResult(result: Result<Unit>) {
|
||||
ignoreResult = result
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue