fix(edit): fix mentions in edits not counting towards the badge
Fixes #10077 The fix itself is in the status-go PR. The desktop changes are just to clean up the old code that no longer worked
This commit is contained in:
parent
eb39d2814f
commit
7ca3084dde
|
@ -313,9 +313,5 @@ proc getWalletAccounts*(self: Controller): seq[wallet_account_service.WalletAcco
|
|||
proc leaveChat*(self: Controller) =
|
||||
self.chatService.leaveChat(self.chatId)
|
||||
|
||||
method checkEditedMessageForMentions*(self: Controller, chatId: string,
|
||||
editedMessage: MessageDto, oldMentions: seq[string]) =
|
||||
self.messageService.checkEditedMessageForMentions(chatId, editedMessage, oldMentions)
|
||||
|
||||
method resendChatMessage*(self: Controller, messageId: string): string =
|
||||
return self.messageService.resendChatMessage(messageId)
|
||||
|
|
|
@ -603,9 +603,6 @@ method onMessageEdited*(self: Module, message: MessageDto) =
|
|||
message.mentionedUsersPks
|
||||
)
|
||||
|
||||
# ask service to send SIGNAL_MENTIONED_IN_EDITED_MESSAGE signal if there is a new user's mention
|
||||
self.controller.checkEditedMessageForMentions(self.getChatId(), message, mentionedUsersPks)
|
||||
|
||||
method onHistoryCleared*(self: Module) =
|
||||
self.view.model().clear()
|
||||
|
||||
|
|
|
@ -136,10 +136,6 @@ proc init*(self: Controller) =
|
|||
self.delegate.onNewMessagesReceived(args.sectionId, args.chatId, args.chatType, args.lastMessageTimestamp,
|
||||
args.unviewedMessagesCount, args.unviewedMentionsCount, args.messages[0])
|
||||
|
||||
self.events.on(message_service.SIGNAL_MENTIONED_IN_EDITED_MESSAGE) do(e: Args):
|
||||
let args = MessageEditedArgs(e)
|
||||
self.delegate.onMeMentionedInEditedMessage(args.chatId, args.message)
|
||||
|
||||
self.events.on(chat_service.SIGNAL_CHAT_MUTED) do(e:Args):
|
||||
let args = chat_service.ChatArgs(e)
|
||||
self.delegate.onChatMuted(args.chatId)
|
||||
|
|
|
@ -325,9 +325,6 @@ method reorderCommunityCategories*(self: AccessInterface, categoryId: string, po
|
|||
method reorderCommunityChat*(self: AccessInterface, categoryId: string, chatId: string, position: int): string =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method onMeMentionedInEditedMessage*(self: AccessInterface, chatId: string, editedMessage : MessageDto) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method downloadMessages*(self: AccessInterface, chatId: string, filePath: string) =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -482,9 +482,6 @@ proc updateParentBadgeNotifications(self: Module) =
|
|||
unviewedMentionsCount
|
||||
)
|
||||
|
||||
proc incrementParentBadgeNotifications(self: Module) =
|
||||
self.delegate.onNotificationsIncremented(self.controller.getMySectionId())
|
||||
|
||||
proc updateBadgeNotifications(self: Module, chatId: string, hasUnreadMessages: bool, unviewedMentionsCount: int) =
|
||||
# update model of this module (appropriate chat from the chats list (chats model))
|
||||
self.view.chatsModel().updateNotificationsForItemById(chatId, hasUnreadMessages, unviewedMentionsCount)
|
||||
|
@ -494,15 +491,6 @@ proc updateBadgeNotifications(self: Module, chatId: string, hasUnreadMessages: b
|
|||
# update parent module
|
||||
self.updateParentBadgeNotifications()
|
||||
|
||||
proc incrementBadgeNotifications(self: Module, chatId: string) =
|
||||
if self.chatsLoaded:
|
||||
let notificationCount = self.view.chatsModel().incrementNotificationsForItemByIdAndGetNotificationCount(chatId)
|
||||
# update child module
|
||||
if (self.chatContentModules.contains(chatId)):
|
||||
self.chatContentModules[chatId].onNotificationsUpdated(hasUnreadMessages = true, notificationCount)
|
||||
# update parent module
|
||||
self.incrementParentBadgeNotifications()
|
||||
|
||||
method updateLastMessageTimestamp*(self: Module, chatId: string, lastMessageTimestamp: int) =
|
||||
self.view.chatsModel().updateLastMessageTimestampOnItemById(chatId, lastMessageTimestamp)
|
||||
|
||||
|
@ -965,15 +953,6 @@ method onNewMessagesReceived*(self: Module, sectionIdMsgBelongsTo: string, chatI
|
|||
message.id, notificationType.int, chatTypeMsgBelongsTo == ChatType.OneToOne,
|
||||
chatTypeMsgBelongsTo == ChatType.PrivateGroupChat)
|
||||
|
||||
method onMeMentionedInEditedMessage*(self: Module, chatId: string, editedMessage : MessageDto) =
|
||||
if((editedMessage.communityId.len == 0 and
|
||||
self.controller.getMySectionId() != singletonInstance.userProfile.getPubKey()) or
|
||||
(editedMessage.communityId.len > 0 and
|
||||
self.controller.getMySectionId() != editedMessage.communityId)):
|
||||
return
|
||||
|
||||
self.incrementBadgeNotifications(chatId)
|
||||
|
||||
method addGroupMembers*(self: Module, chatId: string, pubKeys: string) =
|
||||
self.controller.addGroupMembers(chatId, self.convertPubKeysToJson(pubKeys))
|
||||
|
||||
|
|
|
@ -123,9 +123,6 @@ method onNotificationsUpdated*(self: AccessInterface, sectionId: string, section
|
|||
sectionNotificationCount: int) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method onNotificationsIncremented*(self: AccessInterface, sectionId: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method onNotificationsIncreased*(self: AccessInterface, sectionId: string, addedSectionNotificationCount: bool,
|
||||
sectionNotificationCount: int) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
|
|
@ -827,9 +827,6 @@ method onNotificationsUpdated[T](self: Module[T], sectionId: string, sectionHasU
|
|||
sectionNotificationCount: int) =
|
||||
self.view.model().updateNotifications(sectionId, sectionHasUnreadMessages, sectionNotificationCount)
|
||||
|
||||
method onNotificationsIncremented[T](self: Module[T], sectionId: string) =
|
||||
self.view.model().incrementNotifications(sectionId)
|
||||
|
||||
method onNetworkConnected[T](self: Module[T]) =
|
||||
self.view.setConnected(true)
|
||||
|
||||
|
|
|
@ -397,18 +397,6 @@ QtObject:
|
|||
self.notificationsCountChanged()
|
||||
return
|
||||
|
||||
proc incrementNotifications*(self: SectionModel, id: string) =
|
||||
let index = self.getItemIndex(id)
|
||||
if (index == -1):
|
||||
return
|
||||
|
||||
self.items[index].hasNotification = true
|
||||
self.items[index].notificationsCount = self.items[index].notificationsCount + 1
|
||||
let modelIndex = self.createIndex(index, 0, nil)
|
||||
defer: modelIndex.delete
|
||||
self.dataChanged(modelIndex, modelIndex, @[ModelRole.HasNotification.int, ModelRole.NotificationsCount.int])
|
||||
self.notificationsCountChanged()
|
||||
|
||||
proc appendCommunityToken*(self: SectionModel, id: string, item: TokenItem) =
|
||||
for i in 0 ..< self.items.len:
|
||||
if(self.items[i].id == id):
|
||||
|
|
|
@ -55,7 +55,6 @@ const SIGNAL_MESSAGE_EDITED* = "messageEdited"
|
|||
const SIGNAL_ENVELOPE_SENT* = "envelopeSent"
|
||||
const SIGNAL_ENVELOPE_EXPIRED* = "envelopeExpired"
|
||||
const SIGNAL_MESSAGE_LINK_PREVIEW_DATA_LOADED* = "messageLinkPreviewDataLoaded"
|
||||
const SIGNAL_MENTIONED_IN_EDITED_MESSAGE* = "mentionedInEditedMessage"
|
||||
const SIGNAL_RELOAD_MESSAGES* = "reloadMessages"
|
||||
|
||||
include async_tasks
|
||||
|
@ -829,12 +828,6 @@ proc editMessage*(self: Service, messageId: string, contentType: int, msg: strin
|
|||
proc getWalletAccounts*(self: Service): seq[wallet_account_service.WalletAccountDto] =
|
||||
return self.walletAccountService.getWalletAccounts()
|
||||
|
||||
proc checkEditedMessageForMentions*(self: Service, chatId: string, editedMessage: MessageDto, oldMentions: seq[string]) =
|
||||
let myPubKey = singletonInstance.userProfile.getPubKey()
|
||||
if not oldMentions.contains(myPubKey) and editedMessage.mentionedUsersPks().contains(myPubKey):
|
||||
let data = MessageEditedArgs(chatId: chatId, message: editedMessage)
|
||||
self.events.emit(SIGNAL_MENTIONED_IN_EDITED_MESSAGE, data)
|
||||
|
||||
proc resendChatMessage*(self: Service, messageId: string): string =
|
||||
try:
|
||||
let response = status_go.resendChatMessage(messageId)
|
||||
|
|
Loading…
Reference in New Issue