mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-15 16:18:53 +00:00
fix(MessageView): Ignore message editing with no actual changes
This commit is contained in:
parent
eb9f94630a
commit
784b9acd4f
@ -370,7 +370,7 @@ Control {
|
||||
Layout.rightMargin: 16
|
||||
active: root.editMode
|
||||
visible: active
|
||||
msgText: root.messageDetails.messageText
|
||||
messageText: root.messageDetails.messageText
|
||||
saveButtonText: root.saveButtonText
|
||||
cancelButtonText: root.cancelButtonText
|
||||
onEditCancelled: root.editCancelled()
|
||||
|
@ -13,7 +13,7 @@ Item {
|
||||
|
||||
property string cancelButtonText: ""
|
||||
property string saveButtonText: ""
|
||||
property string msgText: ""
|
||||
property string messageText: ""
|
||||
|
||||
signal editCancelled()
|
||||
signal editCompleted(var newMsgText)
|
||||
@ -40,7 +40,7 @@ Item {
|
||||
readonly property string messageText: input.text
|
||||
width: parent.width
|
||||
input.placeholderText: ""
|
||||
input.text: msgText
|
||||
input.text: root.messageText
|
||||
maximumHeight: 40
|
||||
}
|
||||
}
|
||||
|
@ -432,17 +432,29 @@ Loader {
|
||||
readonly property bool isReply: root.responseToMessageWithId !== ""
|
||||
|
||||
property var replyMessage: getReplyMessage()
|
||||
|
||||
readonly property string replySenderId: replyMessage ? replyMessage.senderId : ""
|
||||
|
||||
property string originalMessageText: ""
|
||||
|
||||
function getReplyMessage() {
|
||||
return root.messageStore && isReply
|
||||
? root.messageStore.getReplyMessageByIdAsJson(root.responseToMessageWithId)
|
||||
: null
|
||||
}
|
||||
|
||||
function editCancelledHandler() {
|
||||
root.messageStore.setEditModeOff(root.messageId)
|
||||
}
|
||||
|
||||
function editCompletedHandler(newMessageText) {
|
||||
|
||||
if (delegate.originalMessageText === newMessageText) {
|
||||
delegate.editCancelledHandler()
|
||||
return
|
||||
}
|
||||
|
||||
const message = root.rootStore.plainText(StatusQUtils.Emoji.deparse(newMessageText))
|
||||
|
||||
if (message.length <= 0)
|
||||
return;
|
||||
|
||||
@ -515,7 +527,7 @@ Loader {
|
||||
messageAttachments: root.messageAttachments
|
||||
|
||||
onEditCancelled: {
|
||||
root.messageStore.setEditModeOff(root.messageId)
|
||||
delegate.editCancelledHandler()
|
||||
}
|
||||
|
||||
onEditCompleted: {
|
||||
@ -719,6 +731,7 @@ Loader {
|
||||
|
||||
Component.onCompleted: {
|
||||
parseMessage(root.messageText);
|
||||
delegate.originalMessageText = editTextInput.textInput.text
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user