fix: code review

This commit is contained in:
Richard Ramos 2022-01-28 09:49:56 -04:00 committed by Sale Djenic
parent a05a821f51
commit ba863acd4e
6 changed files with 6 additions and 9 deletions

View File

@ -121,7 +121,7 @@ QtObject:
of ModelRole.SubItems: of ModelRole.SubItems:
result = newQVariant(item.subItems) result = newQVariant(item.subItems)
of ModelRole.IsCategory: of ModelRole.IsCategory:
result = newQVariant(item.`type` == ChatType.Category.int) result = newQVariant(item.`type` == ChatType.Unknown.int)
proc appendItem*(self: Model, item: Item) = proc appendItem*(self: Model, item: Item) =
let parentModelIndex = newQModelIndex() let parentModelIndex = newQModelIndex()

View File

@ -186,7 +186,7 @@ proc buildCommunityUI(self: Module, events: EventEmitter,
selectedItemId = cat.id selectedItemId = cat.id
selectedSubItemId = channelItem.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) hasNotificationPerCategory, notificationsCountPerCategory, false, false, cat.position)
categoryItem.prependSubItems(categoryChannels) categoryItem.prependSubItems(categoryChannels)
self.view.chatsModel().appendItem(categoryItem) self.view.chatsModel().appendItem(categoryItem)
@ -383,7 +383,7 @@ method removeCommunityChat*(self: Module, chatId: string) =
self.controller.removeCommunityChat(chatId) self.controller.removeCommunityChat(chatId)
method onCommunityCategoryCreated*(self: Module, cat: Category, chats: seq[ChatDto]) = 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) false, 0, false, false, cat.position)
var categoryChannels: seq[SubItem] var categoryChannels: seq[SubItem]
for chatDto in chats: for chatDto in chats:

View File

@ -12,7 +12,6 @@ type ChatType* {.pure.}= enum
Profile = 4, Profile = 4,
Timeline = 5 Timeline = 5
CommunityChat = 6 CommunityChat = 6
Category = 9999
type ChatMember* = object type ChatMember* = object
id*: string id*: string

View File

@ -110,8 +110,7 @@ StatusModal {
anchors.top: channelsLabel.bottom anchors.top: channelsLabel.bottom
height: childrenRect.height height: childrenRect.height
width: parent.width width: parent.width
// Not Refactored Yet model: root.store.chatCommunitySectionModule.model
model: root.store.chatCommunitySectionModule.model//activeCommunityChatsModel
interactive: false interactive: false
clip: true clip: true
@ -119,7 +118,7 @@ StatusModal {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: { visible: {
// TODO: if edit, show only the subitems of the current category // 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 height: visible ? implicitHeight : 0
title: "#" + model.name title: "#" + model.name

View File

@ -149,7 +149,7 @@ Item {
id: delegateChooser id: delegateChooser
role: "type" role: "type"
DelegateChoice { // In case of category DelegateChoice { // In case of category
roleValue: Constants.chatType.category roleValue: Constants.chatType.unknown
delegate: Repeater { delegate: Repeater {
model: { model: {
if (!subItems) { if (!subItems) {

View File

@ -53,7 +53,6 @@ QtObject {
readonly property int profile: 4 readonly property int profile: 4
readonly property int timeline: 5 readonly property int timeline: 5
readonly property int communityChat: 6 readonly property int communityChat: 6
readonly property int category: 9999
} }
readonly property QtObject messageContentType: QtObject { readonly property QtObject messageContentType: QtObject {