Skip to content

Commit

Permalink
code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jrainville committed Sep 6, 2024
1 parent 5aa80d3 commit 3314d35
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 75 deletions.
40 changes: 40 additions & 0 deletions src/app/modules/main/chat_section/chat_content/chat_details.nim
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ QtObject:
notify = nameChanged

proc setName*(self: ChatDetails, value: string) = # this is not a slot
if self.name == value:
return
self.name = value
self.nameChanged()

Expand All @@ -125,6 +127,8 @@ QtObject:
notify = iconChanged

proc setIcon*(self: ChatDetails, icon: string) = # this is not a slot
if self.icon == icon:
return
self.icon = icon
self.iconChanged()

Expand All @@ -136,6 +140,8 @@ QtObject:
notify = colorChanged

proc setColor*(self: ChatDetails, value: string) = # this is not a slot
if self.color == value:
return
self.color = value
self.colorChanged()

Expand All @@ -147,6 +153,8 @@ QtObject:
notify = emojiChanged

proc setEmoji*(self: ChatDetails, value: string) = # this is not a slot
if self.emoji == value:
return
self.emoji = value
self.emojiChanged()

Expand All @@ -158,6 +166,8 @@ QtObject:
notify = descriptionChanged

proc setDescription*(self: ChatDetails, value: string) = # this is not a slot
if self.description == value:
return
self.description = value
self.descriptionChanged()

Expand All @@ -169,6 +179,8 @@ QtObject:
notify = hasUnreadMessages

proc setHasUnreadMessages*(self: ChatDetails, value: bool) = # this is not a slot
if self.hasUnreadMessages == value:
return
self.hasUnreadMessages = value
self.hasUnreadMessagesChanged()

Expand All @@ -180,6 +192,8 @@ QtObject:
notify = notificationCountChanged

proc setNotificationCount*(self: ChatDetails, value: int) = # this is not a slot
if self.notificationsCount == value:
return
self.notificationsCount = value
self.notificationCountChanged()

Expand All @@ -191,6 +205,8 @@ QtObject:
notify = highlightChanged

proc setHighlight*(self: ChatDetails, value: bool) = # this is not a slot
if self.highlight == value:
return
self.highlight = value
self.highlightChanged()

Expand All @@ -202,6 +218,8 @@ QtObject:
notify = mutedChanged

proc setMuted*(self: ChatDetails, value: bool) = # this is not a slot
if self.muted == value:
return
self.muted = value
self.mutedChanged()

Expand All @@ -213,6 +231,8 @@ QtObject:
notify = positionChanged

proc setPotion*(self: ChatDetails, value: int) = # this is not a slot
if self.position == value:
return
self.position = value
self.positionChanged()

Expand All @@ -224,6 +244,8 @@ QtObject:
notify = isMutualContactChanged

proc setIsMutualContact*(self: ChatDetails, value: bool) = # this is not a slot
if self.isContact == value:
return
self.isContact = value
self.isMutualContactChanged()

Expand All @@ -235,6 +257,8 @@ QtObject:
notify = isUntrustworthyChanged

proc setIsUntrustworthy*(self: ChatDetails, value: bool) = # this is not a slot
if self.isUntrustworthy == value:
return
self.isUntrustworthy = value
self.isUntrustworthyChanged()

Expand All @@ -246,6 +270,8 @@ QtObject:
notify = activeChanged

proc setActive*(self: ChatDetails, value: bool) =
if self.active == value:
return
self.active = value
self.activeChanged()

Expand All @@ -257,6 +283,8 @@ QtObject:
notify = blockedChanged

proc setBlocked*(self: ChatDetails, value: bool) =
if self.blocked == value:
return
self.blocked = value
self.blockedChanged()

Expand All @@ -268,6 +296,8 @@ QtObject:
notify = canPostChanged

proc setCanPost*(self: ChatDetails, value: bool) =
if self.canPost == value:
return
self.canPost = value
self.canPostChanged()

Expand All @@ -279,6 +309,8 @@ QtObject:
notify = canViewChanged

proc setCanView*(self: ChatDetails, value: bool) =
if self.canView == value:
return
self.canView = value
self.canViewChanged()

Expand All @@ -290,6 +322,8 @@ QtObject:
notify = canPostReactionsChanged

proc setCanPostReactions*(self: ChatDetails, value: bool) =
if self.canPostReactions == value:
return
self.canPostReactions = value
self.canPostReactionsChanged()

Expand All @@ -301,6 +335,8 @@ QtObject:
notify = hideIfPermissionsNotMetChanged

proc setHideIfPermissionsNotMet*(self: ChatDetails, value: bool) =
if self.hideIfPermissionsNotMet == value:
return
self.hideIfPermissionsNotMet = value
self.hideIfPermissionsNotMetChanged()

Expand All @@ -312,6 +348,8 @@ QtObject:
notify = missingEncryptionKeyChanged

proc setMissingEncryptionKey*(self: ChatDetails, value: bool) =
if self.missingEncryptionKey == value:
return
self.missingEncryptionKey = value
self.missingEncryptionKeyChanged()

Expand All @@ -323,5 +361,7 @@ QtObject:
notify = requiresPermissionsChanged

proc setRequiresPermissions*(self: ChatDetails, value: bool) =
if self.requiresPermissions == value:
return
self.requiresPermissions = value
self.requiresPermissionsChanged()
2 changes: 2 additions & 0 deletions src/app/modules/main/chat_section/chat_content/module.nim
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ method onChatUpdated*(self: Module, chatItem: chat_item.Item) =
self.view.chatDetails.setCanPostReactions(chatItem.canPostReactions)
self.view.chatDetails.setHideIfPermissionsNotMet(chat_item.hideIfPermissionsNotMet)
self.view.chatDetails.setMissingEncryptionKey(chat_item.missingEncryptionKey)
self.view.chatDetails.setRequiresPermissions(chat_item.requiresPermissions)

self.messagesModule.updateChatFetchMoreMessages()
self.messagesModule.updateChatIdentifier()
Expand All @@ -400,6 +401,7 @@ method onCommunityChannelEdited*(self: Module, chatDto: ChatDto) =
self.view.chatDetails.setName(chatDto.name)
self.view.chatDetails.setIcon(chatDto.icon)
self.view.chatDetails.setMissingEncryptionKey(chatDto.missingEncryptionKey)
self.view.chatDetails.setRequiresPermissions(chatDto.tokenGated)

self.messagesModule.updateChatFetchMoreMessages()
self.messagesModule.updateChatIdentifier()
Expand Down
Loading

0 comments on commit 3314d35

Please sign in to comment.