fix(ActivityCenter): Workaround for nil message (#10460)

* fix(ActivityCenter): Workaround for nil message

Close #10455

* Update src/app/modules/main/activity_center/model.nim

Co-authored-by: saledjenic <86303051+saledjenic@users.noreply.github.com>

---------

Co-authored-by: saledjenic <86303051+saledjenic@users.noreply.github.com>
This commit is contained in:
Mikhail Rogachev 2023-04-27 19:19:17 +04:00 committed by GitHub
parent c548a96a2a
commit 591d466029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -71,7 +71,10 @@ QtObject:
of NotifRoles.Name: result = newQVariant(activityNotificationItem.name)
of NotifRoles.Author: result = newQVariant(activityNotificationItem.author)
of NotifRoles.NotificationType: result = newQVariant(activityNotificationItem.notificationType.int)
of NotifRoles.Message: result = newQVariant(activityNotificationItem.messageItem)
of NotifRoles.Message: result = if not activityNotificationItem.messageItem.isNil:
newQVariant(activityNotificationItem.messageItem)
else:
newQVariant()
of NotifRoles.Timestamp: result = newQVariant(activityNotificationItem.timestamp)
of NotifRoles.PreviousTimestamp: result = newQVariant(if index.row > 0:
self.activityCenterNotifications[index.row - 1].timestamp

View File

@ -143,8 +143,8 @@ method convertToItems*(
): seq[notification_item.Item] =
result = activityCenterNotifications.map(
proc(notification: ActivityCenterNotificationDto): notification_item.Item =
var messageItem = msg_item_qobj.newMessageItem(nil)
var repliedMessageItem = msg_item_qobj.newMessageItem(nil)
var messageItem: MessageItem
var repliedMessageItem: MessageItem
# default section id is `Chat` section
let sectionId = if notification.communityId.len > 0:
notification.communityId