fix(delete): disable deleting certain message types
This commit is contained in:
parent
6dc5e1177b
commit
7d169e85f2
|
@ -54,7 +54,7 @@ proc handleChatEvents(self: ChatController) =
|
|||
# was not deleted.
|
||||
discard self.view.deleteMessageWhichReplacedMessageWithId(message.chatId, message.replace)
|
||||
if (message.deleted):
|
||||
self.view.deleteMessage(message.chatId, message.id)
|
||||
discard self.view.deleteMessage(message.chatId, message.id)
|
||||
|
||||
|
||||
self.view.reactions.push(evArgs.emojiReactions)
|
||||
|
|
|
@ -460,7 +460,7 @@ QtObject:
|
|||
let chatId = self.messageView.getChatIdForMessage(messageId)
|
||||
if (chatId.len == 0):
|
||||
return
|
||||
self.deleteMessage(chatId, messageId)
|
||||
discard self.deleteMessage(chatId, messageId)
|
||||
|
||||
|
||||
proc clearMessages*(self: ChatsView, id: string) =
|
||||
|
|
|
@ -422,7 +422,7 @@ QtObject:
|
|||
proc deleteMessage*(self: MessageView, channelId: string, messageId: string): bool =
|
||||
result = self.messageList[channelId].deleteMessage(messageId)
|
||||
if (result):
|
||||
self.pinnedMessagesList[channelId].deleteMessage(messageId)
|
||||
discard self.pinnedMessagesList[channelId].deleteMessage(messageId)
|
||||
self.hideMessage(messageId)
|
||||
|
||||
proc deleteMessageWhichReplacedMessageWithId*(self: MessageView, channelId: string, messageId: string): bool =
|
||||
|
|
|
@ -105,7 +105,7 @@ proc update*(self: ChatModel, chats: seq[Chat], messages: seq[Message], emojiRea
|
|||
if self.lastMessageTimestamps[chatId] > ts:
|
||||
self.lastMessageTimestamps[chatId] = ts
|
||||
|
||||
self.events.emit("chatUpdate", ChatUpdateArgs(messages: messages,chats: chats, contacts: @[], emojiReactions: emojiReactions, communities: communities, communityMembershipRequests: communityMembershipRequests, pinnedMessages: pinnedMessages, activityCenterNotifications: activityCenterNotifications, statusUpdates: statusUpdates, deletedMessages: deletedMessages))=
|
||||
self.events.emit("chatUpdate", ChatUpdateArgs(messages: messages,chats: chats, contacts: @[], emojiReactions: emojiReactions, communities: communities, communityMembershipRequests: communityMembershipRequests, pinnedMessages: pinnedMessages, activityCenterNotifications: activityCenterNotifications, statusUpdates: statusUpdates, deletedMessages: deletedMessages))
|
||||
|
||||
proc hasChannel*(self: ChatModel, chatId: string): bool =
|
||||
self.channels.hasKey(chatId)
|
||||
|
|
|
@ -204,6 +204,7 @@ Item {
|
|||
let nickname = appMain.getUserNickname(fromAuthor)
|
||||
messageContextMenu.messageId = root.messageId;
|
||||
messageContextMenu.linkUrls = root.linkUrls;
|
||||
messageContextMenu.contentType = root.contentType
|
||||
messageContextMenu.isProfile = !!isProfileClick;
|
||||
messageContextMenu.isCurrentUser = root.isCurrentUser
|
||||
messageContextMenu.isText = root.isText
|
||||
|
|
|
@ -13,6 +13,7 @@ PopupMenu {
|
|||
closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
|
||||
|
||||
property string messageId
|
||||
property int contentType
|
||||
property bool isProfile: false
|
||||
property bool isSticker: false
|
||||
property bool emojiOnly: false
|
||||
|
@ -298,6 +299,12 @@ PopupMenu {
|
|||
|
||||
Action {
|
||||
id: deleteMessageAction
|
||||
enabled: isCurrentUser &&
|
||||
(contentType === Constants.messageType ||
|
||||
contentType === Constants.stickerType ||
|
||||
contentType === Constants.emojiType ||
|
||||
contentType === Constants.imageType ||
|
||||
contentType === Constants.audioType)
|
||||
text: qsTr("Delete message")
|
||||
onTriggered: {
|
||||
if (!appSettings.showDeleteMessageWarning) {
|
||||
|
@ -323,6 +330,5 @@ PopupMenu {
|
|||
icon.color: Style.current.danger
|
||||
icon.width: 16
|
||||
icon.height: 16
|
||||
enabled: isCurrentUser
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d45535fecbe66d1cabc6384fb357ffa1de4d7a49
|
||||
Subproject commit 6d845ab9270c40684e25211b1631d3cbb3401940
|
Loading…
Reference in New Issue