From e2d91dc66bb791a4923eb7d25ec5374a4f5c75cc Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 27 Jul 2021 12:59:38 -0400 Subject: [PATCH] fix(act-center): multiple fixes to the activity center --- src/app/chat/views/activity_notification_list.nim | 6 ++++++ ui/app/AppLayouts/Chat/ChatColumn.qml | 2 +- .../ChatComponents/ActivityCenterMessageComponent.qml | 9 ++++++++- .../ChatColumn/ChatComponents/ActivityChannelBadge.qml | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/app/chat/views/activity_notification_list.nim b/src/app/chat/views/activity_notification_list.nim index 948be280f3..d34f9d9e2a 100644 --- a/src/app/chat/views/activity_notification_list.nim +++ b/src/app/chat/views/activity_notification_list.nim @@ -243,6 +243,12 @@ QtObject: self.setNewData(activityCenterNotifications) else: for activityCenterNotification in activityCenterNotifications: + var found = false + for notif in self.activityCenterNotifications: + if activityCenterNotification.id == notif.id: + found = true + break + if found: continue self.addActivityNotificationItemToList(activityCenterNotification, false) self.nbUnreadNotifications = self.status.chat.unreadActivityCenterNotificationsCount() diff --git a/ui/app/AppLayouts/Chat/ChatColumn.qml b/ui/app/AppLayouts/Chat/ChatColumn.qml index dc8a68b311..cbb1c4bea3 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn.qml @@ -234,7 +234,7 @@ Item { membersButton.visible: appSettings.showOnlineUsers && chatsModel.channelView.activeChannel.chatType !== Constants.chatTypeOneToOne notificationButton.visible: appSettings.isActivityCenterEnabled - notificationCount: chatsModel.activityNotificationList.unreadCount + notificationCount: chatsModel.activityNotificationList.unreadCount + profileModel.contacts.contactRequests.count onSearchButtonClicked: searchPopup.open() SearchPopup { diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ActivityCenterMessageComponent.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ActivityCenterMessageComponent.qml index b839d61346..9ff6bb030d 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ActivityCenterMessageComponent.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ActivityCenterMessageComponent.qml @@ -20,7 +20,9 @@ Item { (model.notificationType === Constants.activityCenterNotificationTypeReply && activityCenter.currentFilter === ActivityCenter.Filter.Replies) } width: parent.width - height: visible ? messageNotificationContent.height : 0 + // Setting a height of 0 breaks the layout for when it comes back visible + // The Item never goes back to actually have a height or width + height: visible ? messageNotificationContent.height : 0.01 function openProfile() { const pk = model.author @@ -58,8 +60,13 @@ Item { AcceptRejectOptionsButtons { id: buttons onAcceptClicked: { + const setActiveChannel = chatsModel.channelView.setActiveChannel + const chatId = model.message.chatId + const messageId = model.message.messageId profileModel.contacts.addContact(model.author) chatsModel.activityNotificationList.acceptActivityCenterNotification(model.id) + setActiveChannel(chatId) + positionAtMessage(messageId) } onDeclineClicked: chatsModel.activityNotificationList.dismissActivityCenterNotification(model.id) onProfileClicked: root.openProfile() diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ActivityChannelBadge.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ActivityChannelBadge.qml index d668aada87..5775a7e84e 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ActivityChannelBadge.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ActivityChannelBadge.qml @@ -50,7 +50,7 @@ Rectangle { id: replyComponent Item { - property int replyMessageIndex: chatsModel.getMessageIndex(chatId, responseTo) + property int replyMessageIndex: chatsModel.messageView.getMessageIndex(chatId, responseTo) property string repliedMessageContent: replyMessageIndex > -1 ? chatsModel.messageView.getMessageData(chatId, replyMessageIndex, "message") : "";