Merge pull request #5099 from nextcloud/fix_delete_all_messages

Show delete all messages in 1:1 only when canDeleteConversation is true
This commit is contained in:
Sowjanya Kota 2025-07-01 11:36:38 +02:00 committed by GitHub
commit a3a5272dbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1065,21 +1065,13 @@ class ConversationInfoActivity :
) { ) {
binding.addParticipantsAction.visibility = GONE binding.addParticipantsAction.visibility = GONE
binding.startGroupChat.visibility = VISIBLE binding.startGroupChat.visibility = VISIBLE
showDeleteAllMessagesOption(conversationCopy)
} else if (ConversationUtils.canModerate(conversationCopy, spreedCapabilities)) { } else if (ConversationUtils.canModerate(conversationCopy, spreedCapabilities)) {
binding.addParticipantsAction.visibility = VISIBLE binding.addParticipantsAction.visibility = VISIBLE
if (hasSpreedFeatureCapability( showDeleteAllMessagesOption(conversationCopy)
spreedCapabilities,
SpreedFeatures.CLEAR_HISTORY
) && conversationCopy.canDeleteConversation
) {
binding.clearConversationHistory.visibility = VISIBLE
} else {
binding.clearConversationHistory.visibility = GONE
}
showOptionsMenu() showOptionsMenu()
} else { } else {
binding.addParticipantsAction.visibility = GONE binding.addParticipantsAction.visibility = GONE
if (ConversationUtils.isNoteToSelfConversation(conversation)) { if (ConversationUtils.isNoteToSelfConversation(conversation)) {
binding.notificationSettingsView.notificationSettings.visibility = VISIBLE binding.notificationSettingsView.notificationSettings.visibility = VISIBLE
} else { } else {
@ -1311,6 +1303,18 @@ class ConversationInfoActivity :
} }
} }
fun showDeleteAllMessagesOption(conversationCopy: ConversationModel) {
if (hasSpreedFeatureCapability(
spreedCapabilities,
SpreedFeatures.CLEAR_HISTORY
) && conversationCopy.canDeleteConversation
) {
binding.clearConversationHistory.visibility = VISIBLE
} else {
binding.clearConversationHistory.visibility = GONE
}
}
private fun submitRecordingConsentChanges() { private fun submitRecordingConsentChanges() {
val state = if (binding.recordingConsentView.recordingConsentForConversationSwitch.isChecked) { val state = if (binding.recordingConsentView.recordingConsentForConversationSwitch.isChecked) {
RECORDING_CONSENT_REQUIRED_FOR_CONVERSATION RECORDING_CONSENT_REQUIRED_FOR_CONVERSATION