From ba863acd4e4273383585de4bc7f2f6d01f92bfef Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Fri, 28 Jan 2022 09:49:56 -0400 Subject: [PATCH] fix: code review --- src/app/modules/main/chat_section/model.nim | 2 +- src/app/modules/main/chat_section/module.nim | 4 ++-- src/app_service/service/chat/dto/chat.nim | 1 - .../AppLayouts/Chat/popups/community/CreateCategoryPopup.qml | 5 ++--- ui/app/AppLayouts/Chat/views/ChatColumnView.qml | 2 +- ui/imports/utils/Constants.qml | 1 - 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/app/modules/main/chat_section/model.nim b/src/app/modules/main/chat_section/model.nim index 62b76b197f..cab30e18ad 100644 --- a/src/app/modules/main/chat_section/model.nim +++ b/src/app/modules/main/chat_section/model.nim @@ -121,7 +121,7 @@ QtObject: of ModelRole.SubItems: result = newQVariant(item.subItems) of ModelRole.IsCategory: - result = newQVariant(item.`type` == ChatType.Category.int) + result = newQVariant(item.`type` == ChatType.Unknown.int) proc appendItem*(self: Model, item: Item) = let parentModelIndex = newQModelIndex() diff --git a/src/app/modules/main/chat_section/module.nim b/src/app/modules/main/chat_section/module.nim index 2170a43188..245b1d01c1 100644 --- a/src/app/modules/main/chat_section/module.nim +++ b/src/app/modules/main/chat_section/module.nim @@ -186,7 +186,7 @@ proc buildCommunityUI(self: Module, events: EventEmitter, selectedItemId = cat.id selectedSubItemId = channelItem.id - var categoryItem = initItem(cat.id, cat.name, "", false, "", "", ChatType.Category.int, false, + var categoryItem = initItem(cat.id, cat.name, "", false, "", "", ChatType.Unknown.int, false, hasNotificationPerCategory, notificationsCountPerCategory, false, false, cat.position) categoryItem.prependSubItems(categoryChannels) self.view.chatsModel().appendItem(categoryItem) @@ -383,7 +383,7 @@ method removeCommunityChat*(self: Module, chatId: string) = self.controller.removeCommunityChat(chatId) method onCommunityCategoryCreated*(self: Module, cat: Category, chats: seq[ChatDto]) = - var categoryItem = initItem(cat.id, cat.name, "", false, "", "", ChatType.Category.int, false, + var categoryItem = initItem(cat.id, cat.name, "", false, "", "", ChatType.Unknown.int, false, false, 0, false, false, cat.position) var categoryChannels: seq[SubItem] for chatDto in chats: diff --git a/src/app_service/service/chat/dto/chat.nim b/src/app_service/service/chat/dto/chat.nim index 685100d29c..9f772a163d 100644 --- a/src/app_service/service/chat/dto/chat.nim +++ b/src/app_service/service/chat/dto/chat.nim @@ -12,7 +12,6 @@ type ChatType* {.pure.}= enum Profile = 4, Timeline = 5 CommunityChat = 6 - Category = 9999 type ChatMember* = object id*: string diff --git a/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml b/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml index 66646fe9f0..92a4251e26 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CreateCategoryPopup.qml @@ -110,8 +110,7 @@ StatusModal { anchors.top: channelsLabel.bottom height: childrenRect.height width: parent.width - // Not Refactored Yet - model: root.store.chatCommunitySectionModule.model//activeCommunityChatsModel + model: root.store.chatCommunitySectionModule.model interactive: false clip: true @@ -119,7 +118,7 @@ StatusModal { anchors.horizontalCenter: parent.horizontalCenter visible: { // TODO: if edit, show only the subitems of the current category - return root.isEdit ? null : !model.isCategory + return root.isEdit ? null : model.type != Constants.chatType.unknown } height: visible ? implicitHeight : 0 title: "#" + model.name diff --git a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml index 2976348709..ebaacc0f8b 100644 --- a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml @@ -149,7 +149,7 @@ Item { id: delegateChooser role: "type" DelegateChoice { // In case of category - roleValue: Constants.chatType.category + roleValue: Constants.chatType.unknown delegate: Repeater { model: { if (!subItems) { diff --git a/ui/imports/utils/Constants.qml b/ui/imports/utils/Constants.qml index 081f75029f..f1ab6eb005 100644 --- a/ui/imports/utils/Constants.qml +++ b/ui/imports/utils/Constants.qml @@ -53,7 +53,6 @@ QtObject { readonly property int profile: 4 readonly property int timeline: 5 readonly property int communityChat: 6 - readonly property int category: 9999 } readonly property QtObject messageContentType: QtObject {