fix(act-center): multiple fixes to the activity center

This commit is contained in:
Jonathan Rainville 2021-07-27 12:59:38 -04:00 committed by Iuri Matias
parent d7c368bcb6
commit e2d91dc66b
4 changed files with 16 additions and 3 deletions

View File

@ -243,6 +243,12 @@ QtObject:
self.setNewData(activityCenterNotifications) self.setNewData(activityCenterNotifications)
else: else:
for activityCenterNotification in activityCenterNotifications: 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.addActivityNotificationItemToList(activityCenterNotification, false)
self.nbUnreadNotifications = self.status.chat.unreadActivityCenterNotificationsCount() self.nbUnreadNotifications = self.status.chat.unreadActivityCenterNotificationsCount()

View File

@ -234,7 +234,7 @@ Item {
membersButton.visible: appSettings.showOnlineUsers && chatsModel.channelView.activeChannel.chatType !== Constants.chatTypeOneToOne membersButton.visible: appSettings.showOnlineUsers && chatsModel.channelView.activeChannel.chatType !== Constants.chatTypeOneToOne
notificationButton.visible: appSettings.isActivityCenterEnabled notificationButton.visible: appSettings.isActivityCenterEnabled
notificationCount: chatsModel.activityNotificationList.unreadCount notificationCount: chatsModel.activityNotificationList.unreadCount + profileModel.contacts.contactRequests.count
onSearchButtonClicked: searchPopup.open() onSearchButtonClicked: searchPopup.open()
SearchPopup { SearchPopup {

View File

@ -20,7 +20,9 @@ Item {
(model.notificationType === Constants.activityCenterNotificationTypeReply && activityCenter.currentFilter === ActivityCenter.Filter.Replies) (model.notificationType === Constants.activityCenterNotificationTypeReply && activityCenter.currentFilter === ActivityCenter.Filter.Replies)
} }
width: parent.width 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() { function openProfile() {
const pk = model.author const pk = model.author
@ -58,8 +60,13 @@ Item {
AcceptRejectOptionsButtons { AcceptRejectOptionsButtons {
id: buttons id: buttons
onAcceptClicked: { onAcceptClicked: {
const setActiveChannel = chatsModel.channelView.setActiveChannel
const chatId = model.message.chatId
const messageId = model.message.messageId
profileModel.contacts.addContact(model.author) profileModel.contacts.addContact(model.author)
chatsModel.activityNotificationList.acceptActivityCenterNotification(model.id) chatsModel.activityNotificationList.acceptActivityCenterNotification(model.id)
setActiveChannel(chatId)
positionAtMessage(messageId)
} }
onDeclineClicked: chatsModel.activityNotificationList.dismissActivityCenterNotification(model.id) onDeclineClicked: chatsModel.activityNotificationList.dismissActivityCenterNotification(model.id)
onProfileClicked: root.openProfile() onProfileClicked: root.openProfile()

View File

@ -50,7 +50,7 @@ Rectangle {
id: replyComponent id: replyComponent
Item { 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") : ""; property string repliedMessageContent: replyMessageIndex > -1 ? chatsModel.messageView.getMessageData(chatId, replyMessageIndex, "message") : "";