From aab86cdbabe64d6687c0848275648509542c6ea8 Mon Sep 17 00:00:00 2001 From: sowjanyakch Date: Thu, 29 Aug 2024 09:03:44 +0200 Subject: [PATCH] No Edit Time limit on Note to Self Signed-off-by: sowjanyakch --- .../nextcloud/talk/ui/dialog/MessageActionsDialog.kt | 10 ++++++++-- .../java/com/nextcloud/talk/utils/CapabilitiesUtil.kt | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt index 55f40854fd..88a84fcf9d 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt @@ -87,12 +87,18 @@ class MessageActionsDialog( .before(Date(System.currentTimeMillis() - AGE_THRESHOLD_FOR_EDIT_MESSAGE)) private val isUserAllowedToEdit = chatActivity.userAllowedByPrivilages(message) - - private val isMessageEditable = hasSpreedFeatureCapability( + private var isNoTimeLimitOnNoteToSelf = hasSpreedFeatureCapability( + spreedCapabilities, + SpreedFeatures + .EDIT_MESSAGES_NOTE_TO_SELF + ) && currentConversation?.type == ConversationEnums.ConversationType.NOTE_TO_SELF + private var messageIsEditable = hasSpreedFeatureCapability( spreedCapabilities, SpreedFeatures.EDIT_MESSAGES ) && messageHasRegularText && !isOlderThanTwentyFourHours && isUserAllowedToEdit + private val isMessageEditable = isNoTimeLimitOnNoteToSelf || messageIsEditable + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this) diff --git a/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt b/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt index 5048e5656b..69d34c497d 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt @@ -54,7 +54,8 @@ enum class SpreedFeatures(val value: String) { CONVERSATION_PERMISSION("conversation-permissions"), FEDERATION_V1("federation-v1"), DELETE_MESSAGES_UNLIMITED("delete-messages-unlimited"), - BAN_V1("ban-v1") + BAN_V1("ban-v1"), + EDIT_MESSAGES_NOTE_TO_SELF("edit-messages-note-to-self") } @Suppress("TooManyFunctions")