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:
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()

View File

@ -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:

View File

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

View File

@ -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

View File

@ -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) {

View File

@ -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 {