From 869ae63518ccf394a5570c01e03b89cc4410f359 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Tue, 13 Jul 2021 11:11:08 +0200 Subject: [PATCH] fix(@desktop/profile): Unmuted chat from profile -> notification fixes #2557 --- src/app/chat/views/channel.nim | 14 -------------- src/app/profile/views/muted_chats.nim | 17 ----------------- .../Profile/Sections/MutedChatsModal.qml | 7 ++++--- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/src/app/chat/views/channel.nim b/src/app/chat/views/channel.nim index 019f8a85bf..fc8d2d9813 100644 --- a/src/app/chat/views/channel.nim +++ b/src/app/chat/views/channel.nim @@ -270,20 +270,6 @@ QtObject: self.status.chat.muteChat(selectedChannel) self.updateChannelInRightList(selectedChannel) - # TODO(pascal): replace with `unmuteChatItem`, which is id based - # instead of index based, when refactoring/removing `ChannelContextMenu` - # (they still make use of this) - proc unmuteChannel*(self: ChannelView, channelIndex: int) {.slot.} = - if (self.chats.chats.len == 0): return - let selectedChannel = self.getChannel(channelIndex) - if (selectedChannel == nil): return - if (selectedChannel.id == self.activeChannel.id): - self.unmuteCurrentChannel() - return - selectedChannel.muted = false - self.status.chat.unmuteChat(selectedChannel) - self.updateChannelInRightList(selectedChannel) - proc unmuteChatItem*(self: ChannelView, id: string) {.slot.} = if (self.chats.chats.len == 0): return let selectedChannel = self.getChannelById(id) diff --git a/src/app/profile/views/muted_chats.nim b/src/app/profile/views/muted_chats.nim index a430f9faad..955f4a4502 100644 --- a/src/app/profile/views/muted_chats.nim +++ b/src/app/profile/views/muted_chats.nim @@ -53,23 +53,6 @@ QtObject: read = getMutedContactsList notify = mutedContactsListChanged - proc unmuteChannel*(self: MutedChatsView, chatId: string) {.slot.} = - echo "A" - if (self.mutedChats.chats.len == 0 and self.mutedContacts.chats.len == 0): return - echo "B" - var selectedChannel = self.mutedChats.getChannelById(chatId) - if (selectedChannel != nil): - discard self.mutedChats.removeChatItemFromList(chatId) - else: - selectedChannel = self.mutedContacts.getChannelById(chatId) - if (selectedChannel == nil): return - discard self.mutedContacts.removeChatItemFromList(chatId) - echo "C" - selectedChannel.muted = false - self.status.chat.unmuteChat(selectedChannel) - self.mutedChatsListChanged() - self.mutedContactsListChanged() - proc updateChats*(self: MutedChatsView, chats: seq[Chat]) = for chat in chats: if not chat.muted: diff --git a/ui/app/AppLayouts/Profile/Sections/MutedChatsModal.qml b/ui/app/AppLayouts/Profile/Sections/MutedChatsModal.qml index f33ee8fad4..4d03dd8a40 100644 --- a/ui/app/AppLayouts/Profile/Sections/MutedChatsModal.qml +++ b/ui/app/AppLayouts/Profile/Sections/MutedChatsModal.qml @@ -73,9 +73,7 @@ ModalPopup { anchors.verticalCenter: parent.verticalCenter //% "Unmute" text: qsTrId("unmute") - onClicked: { - profileModel.mutedChats.unmuteChannel(model.id) - } + MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor @@ -83,6 +81,9 @@ ModalPopup { onEntered: { channelItem.isHovered = true } + onClicked: { + chatsModel.channelView.unmuteChatItem(model.id) + } } } }