fix(@desktop/profile): Unmuted chat from profile -> notification

fixes #2557
This commit is contained in:
Anthony Laibe 2021-07-13 11:11:08 +02:00 committed by Iuri Matias
parent f755ba44e2
commit 869ae63518
3 changed files with 4 additions and 34 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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)
}
}
}
}