fix: Disable typing and message requests in read-only open groups

This commit is contained in:
charles
2022-10-03 13:15:14 +11:00
parent fbd1721eaf
commit ffa280bc1b
5 changed files with 14 additions and 8 deletions

View File

@@ -466,6 +466,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
// called from onCreate
private fun setUpInputBar() {
binding!!.inputBar.isVisible = viewModel.openGroup == null || viewModel.openGroup?.canWrite == true
binding!!.inputBar.delegate = this
binding!!.inputBarRecordingView.delegate = this
// GIF button

View File

@@ -153,12 +153,13 @@ class VisibleMessageView : LinearLayout {
if (isGroupThread && !message.isOutgoing) {
if (isEndOfMessageCluster) {
val openGroup = lokiThreadDb.getOpenGroupChat(threadID)
binding.profilePictureView.root.publicKey = senderSessionID
binding.profilePictureView.root.glide = glide
binding.profilePictureView.root.update(message.individualRecipient)
binding.profilePictureView.root.setOnClickListener {
if (thread.isOpenGroupRecipient) {
if (IdPrefix.fromValue(senderSessionID) == IdPrefix.BLINDED) {
if (IdPrefix.fromValue(senderSessionID) == IdPrefix.BLINDED && openGroup?.canWrite == true) {
val intent = Intent(context, ConversationActivityV2::class.java)
intent.putExtra(ConversationActivityV2.FROM_GROUP_THREAD_ID, threadID)
intent.putExtra(ConversationActivityV2.ADDRESS, Address.fromSerialized(senderSessionID))
@@ -169,7 +170,7 @@ class VisibleMessageView : LinearLayout {
}
}
if (thread.isOpenGroupRecipient) {
val openGroup = lokiThreadDb.getOpenGroupChat(threadID) ?: return
openGroup ?: return
var standardPublicKey = ""
var blindedPublicKey: String? = null
if (IdPrefix.fromValue(senderSessionID) == IdPrefix.BLINDED) {

View File

@@ -83,7 +83,7 @@ object OpenGroupManager {
if (threadID < 0) {
threadID = GroupManager.createOpenGroup(openGroupID, context, null, info.name).threadId
}
val openGroup = OpenGroup(server, room, info.name, info.infoUpdates, publicKey)
val openGroup = OpenGroup(server, room, info.name, info.infoUpdates, publicKey, info.write)
threadDB.setOpenGroupChat(openGroup, threadID)
}