mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-25 14:40:41 +01:00
Merge pull request #4761 from nextcloud/edit_bot_messages
Edit bot messages in 1:1 conversations
This commit is contained in:
commit
869c8154d7
@ -98,12 +98,18 @@ class MessageActionsDialog(
|
|||||||
SpreedFeatures
|
SpreedFeatures
|
||||||
.EDIT_MESSAGES_NOTE_TO_SELF
|
.EDIT_MESSAGES_NOTE_TO_SELF
|
||||||
) && currentConversation?.type == ConversationEnums.ConversationType.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(
|
private var messageIsEditable = hasSpreedFeatureCapability(
|
||||||
spreedCapabilities,
|
spreedCapabilities,
|
||||||
SpreedFeatures.EDIT_MESSAGES
|
SpreedFeatures.EDIT_MESSAGES
|
||||||
) && messageHasRegularText && !isOlderThanTwentyFourHours && isUserAllowedToEdit
|
) && messageHasRegularText && !isOlderThanTwentyFourHours && isUserAllowedToEdit
|
||||||
|
|
||||||
private val isMessageEditable = isNoTimeLimitOnNoteToSelf || messageIsEditable
|
private val isMessageEditable = isNoTimeLimitOnNoteToSelf || messageIsEditable || isMessageBotOneToOne
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@ -550,5 +556,6 @@ class MessageActionsDialog(
|
|||||||
private const val NO_PREVIOUS_MESSAGE_ID: Int = -1
|
private const val NO_PREVIOUS_MESSAGE_ID: Int = -1
|
||||||
private const val DELAY: Long = 200
|
private const val DELAY: Long = 200
|
||||||
private const val AGE_THRESHOLD_FOR_EDIT_MESSAGE: Long = 86400000
|
private const val AGE_THRESHOLD_FOR_EDIT_MESSAGE: Long = 86400000
|
||||||
|
private const val ACTOR_BOTS = "bots"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
android:textColor="@color/no_emphasis_text"
|
android:textColor="@color/no_emphasis_text"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
android:gravity = "end"
|
android:gravity = "end"
|
||||||
app:layout_alignSelf="center"
|
app:layout_alignSelf="flex_end"
|
||||||
app:layout_flexGrow="1"
|
app:layout_flexGrow="1"
|
||||||
app:layout_wrapBefore="false"
|
app:layout_wrapBefore="false"
|
||||||
tools:text="12:38" />
|
tools:text="12:38" />
|
||||||
@ -86,10 +86,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/messageText"
|
android:layout_below="@id/messageText"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
|
android:gravity="end"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:textColor="@color/no_emphasis_text"
|
android:textColor="@color/no_emphasis_text"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_alignSelf="center"
|
app:layout_alignSelf="flex_end"
|
||||||
android:text = "@string/hint_edited_message"
|
android:text = "@string/hint_edited_message"
|
||||||
android:textSize="12sp">
|
android:textSize="12sp">
|
||||||
|
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:textColor="@color/no_emphasis_text"
|
android:textColor="@color/no_emphasis_text"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_alignSelf="center"
|
app:layout_alignSelf="flex_end"
|
||||||
|
android:layout_gravity="end"
|
||||||
app:layout_flexGrow="1"
|
app:layout_flexGrow="1"
|
||||||
app:layout_wrapBefore="false"
|
app:layout_wrapBefore="false"
|
||||||
tools:text="10:35" />
|
tools:text="10:35" />
|
||||||
@ -67,7 +68,8 @@
|
|||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:textColor="@color/no_emphasis_text"
|
android:textColor="@color/no_emphasis_text"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
app:layout_alignSelf="center"
|
android:gravity="end"
|
||||||
|
app:layout_alignSelf="flex_end"
|
||||||
android:text = "@string/hint_edited_message"
|
android:text = "@string/hint_edited_message"
|
||||||
android:textSize="12sp">
|
android:textSize="12sp">
|
||||||
|
|
||||||
@ -80,7 +82,8 @@
|
|||||||
android:layout_below="@id/messageTime"
|
android:layout_below="@id/messageTime"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
app:layout_alignSelf="center"
|
app:layout_alignSelf="flex_end"
|
||||||
|
android:gravity="end"
|
||||||
app:tint="@color/high_emphasis_text"
|
app:tint="@color/high_emphasis_text"
|
||||||
tools:src="@drawable/ic_check_all" />
|
tools:src="@drawable/ic_check_all" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user