fix(Chat): Added group/channel name to notifications title
This commit is contained in:
parent
3456c5232b
commit
f022e02efe
|
@ -263,6 +263,12 @@ proc getChatDetails*(self: Controller, chatId: string): ChatDto =
|
|||
proc getChatDetailsForChatTypes*(self: Controller, types: seq[ChatType]): seq[ChatDto] =
|
||||
return self.chatService.getChatsOfChatTypes(types)
|
||||
|
||||
proc getCommunityDetails*(self: Controller, communityId: string): CommunityDto =
|
||||
return self.communityService.getCommunityById(communityId)
|
||||
|
||||
proc getCommunityCategoryDetails*(self: Controller, communityId: string, categoryId: string): Category =
|
||||
return self.communityService.getCategoryById(communityId, categoryId)
|
||||
|
||||
proc setActiveItemSubItem*(self: Controller, itemId: string, subItemId: string) =
|
||||
self.activeItemId = itemId
|
||||
self.activeSubItemId = subItemId
|
||||
|
|
|
@ -722,7 +722,25 @@ method onNewMessagesReceived*(self: Module, sectionIdMsgBelongsTo: string, chatI
|
|||
let contactDetails = self.controller.getContactDetails(message.`from`)
|
||||
let renderedMessageText = self.controller.getRenderedText(message.parsedText)
|
||||
let plainText = singletonInstance.utils.plainText(renderedMessageText)
|
||||
singletonInstance.globalEvents.showMessageNotification(contactDetails.defaultDisplayName, plainText, sectionIdMsgBelongsTo,
|
||||
let chatDetails = self.controller.getChatDetails(chatIdMsgBelongsTo)
|
||||
var notificationTitle = contactDetails.defaultDisplayName
|
||||
|
||||
case chatDetails.chatType:
|
||||
of ChatType.Public:
|
||||
notificationTitle.add(fmt" ({chatDetails.name})")
|
||||
of ChatType.PrivateGroupChat:
|
||||
notificationTitle.add(fmt" ({chatDetails.name})")
|
||||
of ChatType.CommunityChat:
|
||||
let communityDetails = self.controller.getCommunityDetails(chatDetails.communityId)
|
||||
if (chatDetails.categoryId.len == 0):
|
||||
notificationTitle.add(fmt" (#{chatDetails.name})")
|
||||
else:
|
||||
let categoryDetails = self.controller.getCommunityCategoryDetails(chatDetails.communityId, chatDetails.categoryId)
|
||||
notificationTitle.add(fmt" (#{chatDetails.name}, {categoryDetails.name})")
|
||||
else:
|
||||
discard
|
||||
|
||||
singletonInstance.globalEvents.showMessageNotification(notificationTitle, plainText, sectionIdMsgBelongsTo,
|
||||
self.controller.isCommunity(), messageBelongsToActiveSection, chatIdMsgBelongsTo, messageBelongsToActiveChat,
|
||||
message.id, notificationType.int,
|
||||
chatTypeMsgBelongsTo == ChatType.OneToOne, chatTypeMsgBelongsTo == ChatType.PrivateGroupChat)
|
||||
|
|
|
@ -523,6 +523,15 @@ QtObject:
|
|||
else:
|
||||
return 0
|
||||
|
||||
proc getCategoryById*(self: Service, communityId: string, categoryId: string): Category =
|
||||
if(not self.joinedCommunities.contains(communityId)):
|
||||
error "trying to get community categories for an unexisting community id"
|
||||
return
|
||||
|
||||
let categories = self.joinedCommunities[communityId].categories
|
||||
let categoryIndex = findIndexById(categoryId, categories)
|
||||
return categories[categoryIndex]
|
||||
|
||||
proc getCategories*(self: Service, communityId: string, order: SortOrder = SortOrder.Ascending): seq[Category] =
|
||||
if(not self.joinedCommunities.contains(communityId)):
|
||||
error "trying to get community categories for an unexisting community id"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 12907e411b5b5f1580a087f8235c7afc018f36e4
|
||||
Subproject commit 14499ccf9bc85a523c5520488d23055346ddfd2a
|
Loading…
Reference in New Issue