Merge pull request #4761 from nextcloud/edit_bot_messages

Edit bot messages in 1:1 conversations
This commit is contained in:
Marcel Hibbe 2025-03-06 12:45:47 +00:00 committed by GitHub
commit 869c8154d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 6 deletions

View File

@ -98,12 +98,18 @@ class MessageActionsDialog(
SpreedFeatures
.EDIT_MESSAGES_NOTE_TO_SELF
) && currentConversation?.type == ConversationEnums.ConversationType.NOTE_TO_SELF
private val isMessageBotOneToOne = (message.actorType == ACTOR_BOTS) && (
message.isOneToOneConversation ||
message.isFormerOneToOneConversation
) && !isOlderThanTwentyFourHours
private var messageIsEditable = hasSpreedFeatureCapability(
spreedCapabilities,
SpreedFeatures.EDIT_MESSAGES
) && messageHasRegularText && !isOlderThanTwentyFourHours && isUserAllowedToEdit
private val isMessageEditable = isNoTimeLimitOnNoteToSelf || messageIsEditable
private val isMessageEditable = isNoTimeLimitOnNoteToSelf || messageIsEditable || isMessageBotOneToOne
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -550,5 +556,6 @@ class MessageActionsDialog(
private const val NO_PREVIOUS_MESSAGE_ID: Int = -1
private const val DELAY: Long = 200
private const val AGE_THRESHOLD_FOR_EDIT_MESSAGE: Long = 86400000
private const val ACTOR_BOTS = "bots"
}
}

View File

@ -74,7 +74,7 @@
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
android:gravity = "end"
app:layout_alignSelf="center"
app:layout_alignSelf="flex_end"
app:layout_flexGrow="1"
app:layout_wrapBefore="false"
tools:text="12:38" />
@ -86,10 +86,11 @@
android:layout_height="wrap_content"
android:layout_below="@id/messageText"
android:layout_marginStart="8dp"
android:gravity="end"
android:alpha="0.6"
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
app:layout_alignSelf="center"
app:layout_alignSelf="flex_end"
android:text = "@string/hint_edited_message"
android:textSize="12sp">

View File

@ -53,7 +53,8 @@
android:gravity="end"
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
app:layout_alignSelf="center"
app:layout_alignSelf="flex_end"
android:layout_gravity="end"
app:layout_flexGrow="1"
app:layout_wrapBefore="false"
tools:text="10:35" />
@ -67,7 +68,8 @@
android:alpha="0.6"
android:textColor="@color/no_emphasis_text"
android:textIsSelectable="false"
app:layout_alignSelf="center"
android:gravity="end"
app:layout_alignSelf="flex_end"
android:text = "@string/hint_edited_message"
android:textSize="12sp">
@ -80,7 +82,8 @@
android:layout_below="@id/messageTime"
android:layout_marginStart="8dp"
android:contentDescription="@null"
app:layout_alignSelf="center"
app:layout_alignSelf="flex_end"
android:gravity="end"
app:tint="@color/high_emphasis_text"
tools:src="@drawable/ic_check_all" />