diff --git a/src/app/commoncomponents/EditedPopup.qml b/src/app/commoncomponents/EditedPopup.qml index 2df12aef0639156a4d4615ee6a4f45e7aef49f59..d85b03c7a2bbcc3c015b16a53a77562b63a0878f 100644 --- a/src/app/commoncomponents/EditedPopup.qml +++ b/src/app/commoncomponents/EditedPopup.qml @@ -55,8 +55,9 @@ BaseModalDialog { anchors.centerIn: parent Text { - Layout.preferredWidth: root.width / 4 + Layout.maximumWidth: root.width / 2 Layout.leftMargin: JamiTheme.settingsMarginSize + elide: Text.ElideRight text: MessagesAdapter.getFormattedDay(modelData.timestamp.toString()) + " - " + MessagesAdapter.getFormattedTime(modelData.timestamp.toString()) @@ -72,7 +73,7 @@ BaseModalDialog { id: metrics elide: Text.ElideRight elideWidth: 3 * rowBody.width / 4 - 2 * JamiTheme.preferredMarginSize - text: modelData.body + text: modelData.body === "" ? JamiStrings.deletedMessage : modelData.body } text: metrics.elidedText diff --git a/src/app/commoncomponents/EmojiReactions.qml b/src/app/commoncomponents/EmojiReactions.qml index 83563bd3a967b80132a1e51ffb710ba42a3fc02f..f991f17be9c221adf255a97914766aa91ec92f72 100644 --- a/src/app/commoncomponents/EmojiReactions.qml +++ b/src/app/commoncomponents/EmojiReactions.qml @@ -31,7 +31,7 @@ Item { property real contentWidth: bubble.width property var emojiTexts: ownEmojiList - visible: emojis ? emojis.length : false + visible: emojis.length && Body !== "" property string emojis: { var space = "" diff --git a/src/app/commoncomponents/ReplyToRow.qml b/src/app/commoncomponents/ReplyToRow.qml index 9e9a1449d374a35b5b5960712e35651a071e3e46..6dc194eea49f4026fb8c6cf2ea71923ca194087f 100644 --- a/src/app/commoncomponents/ReplyToRow.qml +++ b/src/app/commoncomponents/ReplyToRow.qml @@ -88,7 +88,7 @@ Item { id: metrics elide: Text.ElideRight elideWidth: JamiTheme.preferredFieldWidth - JamiTheme.preferredMarginSize - text: ReplyToBody + text: ReplyToBody === "" && ReplyToAuthor !== "" ? "*(Deleted Message)*" : ReplyToBody } textFormat: Text.MarkdownText diff --git a/src/app/commoncomponents/SBSMessageBase.qml b/src/app/commoncomponents/SBSMessageBase.qml index 688d596f01842e50ca508f1cff7f901e83452a69..686b710cbfe947d32d9ac0f1974b9721869eceec 100644 --- a/src/app/commoncomponents/SBSMessageBase.qml +++ b/src/app/commoncomponents/SBSMessageBase.qml @@ -174,10 +174,10 @@ Control { anchors.verticalCenter: parent.verticalCenter anchors.right: isOutgoing ? optionButtonItem.right : undefined anchors.left: !isOutgoing ? optionButtonItem.left : undefined - visible: bubbleArea.bubbleHovered + visible: Body !== "" && (bubbleArea.bubbleHovered || hovered || reply.hovered - || bgHandler.hovered + || bgHandler.hovered) source: JamiResources.more_vert_24dp_svg width: optionButtonItem.width / 2 height: optionButtonItem.height @@ -202,10 +202,10 @@ Control { anchors.verticalCenter: parent.verticalCenter anchors.right: isOutgoing ? more.left : undefined anchors.left: !isOutgoing ? more.right : undefined - visible: bubbleArea.bubbleHovered + visible: Body !== "" && (bubbleArea.bubbleHovered || hovered || more.hovered - || bgHandler.hovered + || bgHandler.hovered) onClicked: { MessagesAdapter.editId = "" diff --git a/src/app/commoncomponents/TextMessageDelegate.qml b/src/app/commoncomponents/TextMessageDelegate.qml index 05feb3388aceae53fe11ad873218a7e89516a0ed..adaa0bbee7d9b926851a9de7f10cd5aef4914fd3 100644 --- a/src/app/commoncomponents/TextMessageDelegate.qml +++ b/src/app/commoncomponents/TextMessageDelegate.qml @@ -58,7 +58,7 @@ SBSMessageBase { padding: isEmojiOnly ? 0 : JamiTheme.preferredMarginSize anchors.right: isOutgoing ? parent.right : undefined - text: Body + text: Body === "" ? "*("+ JamiStrings.deletedMessage +")*" : Body horizontalAlignment: Text.AlignLeft HoverHandler { diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml index 20ff8d70ef8521165a6f107c5e5f885a871c96be..a00f6b9e3252e48619f065ed8d74c3d2754ed46c 100644 --- a/src/app/constant/JamiStrings.qml +++ b/src/app/constant/JamiStrings.qml @@ -352,6 +352,7 @@ Item { property string backendError: qsTr("This is the error from the backend: %0") property string disabledAccount: qsTr("The account is disabled") property string noNetworkConnectivity: qsTr("No network connectivity") + property string deletedMessage: qsTr("Deleted message") // Chatview footer property string jumpToLatest: qsTr("Jump to latest") diff --git a/src/app/mainview/components/MessageListView.qml b/src/app/mainview/components/MessageListView.qml index 4f321329937d14dfd1107564c674c2b3a2b1108d..009337b146403749dc93237884d806c9c1654faf 100644 --- a/src/app/mainview/components/MessageListView.qml +++ b/src/app/mainview/components/MessageListView.qml @@ -215,8 +215,7 @@ JamiListView { readonly property int mergeType: Interaction.Type.MERGE readonly property int editedType: Interaction.Type.EDITED readonly property int reactionType: Interaction.Type.REACTION - expression: Body !== "" - && Type !== mergeType + expression: Type !== mergeType && Type !== editedType && Type !== reactionType } diff --git a/src/libclient/messagelistmodel.cpp b/src/libclient/messagelistmodel.cpp index a17bada72b62a44e12ce28cdbdf355a271f50117..4828e48eda1de306599df71ebb9311b95a40ae73 100644 --- a/src/libclient/messagelistmodel.cpp +++ b/src/libclient/messagelistmodel.cpp @@ -394,6 +394,8 @@ MessageListModel::roleNames() const bool MessageListModel::isOnlyEmoji(const QString& text) const { + if (text.isEmpty()) + return false; auto codepointList = text.toUcs4(); for (QList<uint>::iterator it = codepointList.begin(); it != codepointList.end(); it++) { auto cur = false; @@ -418,7 +420,7 @@ QVariant MessageListModel::dataForItem(item_t item, int, int role) const { QString replyId = item.second.commit["reply-to"]; - int repliedMsg; + int repliedMsg = -1; if (!replyId.isEmpty() && (role == Role::ReplyToAuthor || role == Role::ReplyToBody)) { repliedMsg = getIndexOfMessage(replyId); } @@ -695,7 +697,10 @@ MessageListModel::editMessage(const QString& msgId, interaction::Info& info) } info.body = it->rbegin()->body; editedBodies_.erase(it); - emitDataChanged(msgId, {MessageList::Role::Body, MessageList::Role::PreviousBodies}); + emitDataChanged(msgId, + {MessageList::Role::Body, + MessageList::Role::PreviousBodies, + MessageList::Role::IsEmojiOnly}); // Body changed, replies should update for (const auto& replyId : replyTo_[msgId]) {