Prevent read-only 1-1 chat room

This commit is contained in:
Sylvain Berfini 2022-03-16 14:54:22 +01:00
parent 48c10e863e
commit 2e9e3459e4
3 changed files with 5 additions and 5 deletions

View file

@ -305,7 +305,7 @@ class ChatMessagesListAdapter(
popupView.addToContactsHidden = true popupView.addToContactsHidden = true
totalSize -= itemSize totalSize -= itemSize
} }
if (chatMessage.chatRoom.hasBeenLeft()) { if (chatMessage.chatRoom.isReadOnly()) {
popupView.replyHidden = true popupView.replyHidden = true
totalSize -= itemSize totalSize -= itemSize
} }

View file

@ -114,7 +114,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
private val chatRoomListener: ChatRoomListenerStub = object : ChatRoomListenerStub() { private val chatRoomListener: ChatRoomListenerStub = object : ChatRoomListenerStub() {
override fun onStateChanged(chatRoom: ChatRoom, state: ChatRoom.State) { override fun onStateChanged(chatRoom: ChatRoom, state: ChatRoom.State) {
if (state == ChatRoom.State.Created || state == ChatRoom.State.Terminated) { if (state == ChatRoom.State.Created || state == ChatRoom.State.Terminated) {
isReadOnly.value = chatRoom.hasBeenLeft() isReadOnly.value = chatRoom.isReadOnly()
} }
} }
} }
@ -128,7 +128,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
attachFileEnabled.value = true attachFileEnabled.value = true
sendMessageEnabled.value = false sendMessageEnabled.value = false
isReadOnly.value = chatRoom.hasBeenLeft() isReadOnly.value = chatRoom.isReadOnly()
val recorderParams = coreContext.core.createRecorderParams() val recorderParams = coreContext.core.createRecorderParams()
if (corePreferences.voiceMessagesFormatMkv) { if (corePreferences.voiceMessagesFormatMkv) {

View file

@ -97,8 +97,8 @@ class GroupInfoViewModel(val chatRoom: ChatRoom?) : MessageNotifierViewModel() {
init { init {
subject.value = chatRoom?.subject subject.value = chatRoom?.subject
isMeAdmin.value = chatRoom == null || (chatRoom.me?.isAdmin == true && !chatRoom.hasBeenLeft()) isMeAdmin.value = chatRoom == null || (chatRoom.me?.isAdmin == true && !chatRoom.isReadOnly())
canLeaveGroup.value = chatRoom != null && !chatRoom.hasBeenLeft() canLeaveGroup.value = chatRoom != null && !chatRoom.isReadOnly()
isEncrypted.value = chatRoom?.hasCapability(ChatRoomCapabilities.Encrypted.toInt()) isEncrypted.value = chatRoom?.hasCapability(ChatRoomCapabilities.Encrypted.toInt())
if (chatRoom != null) updateParticipants() if (chatRoom != null) updateParticipants()