refactor: create categories (WIP)
This commit is contained in:
parent
caa85a79b4
commit
0065f5cae5
|
@ -275,6 +275,9 @@ method createCommunityChannel*(
|
|||
description: string) =
|
||||
self.communityService.createCommunityChannel(self.sectionId, name, description)
|
||||
|
||||
method createCommunityCategory*(self: Controller, name: string, channels: seq[string]) =
|
||||
self.communityService.createCommunityCategory(self.sectionId, name, channels)
|
||||
|
||||
method leaveCommunity*(self: Controller) =
|
||||
self.communityService.leaveCommunity(self.sectionId)
|
||||
|
||||
|
|
|
@ -126,6 +126,9 @@ method declineRequestToJoinCommunity*(self: AccessInterface, requestId: string)
|
|||
method createCommunityChannel*(self: AccessInterface, name: string, description: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method createCommunityCategory*(self: AccessInterface, name: string, channels: seq[string]) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method leaveCommunity*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -541,6 +541,12 @@ method declineRequestToJoinCommunity*(self: Module, requestId: string) =
|
|||
method createCommunityChannel*(self: Module, name, description: string,) =
|
||||
self.controller.createCommunityChannel(name, description)
|
||||
|
||||
proc createChannelsSeq(self: Module, channels: string): seq[string] =
|
||||
return map(parseJson(channels).getElems(), proc(x:JsonNode):string = x.getStr())
|
||||
|
||||
method createCommunityCategory*(self: Module, name: string, channels: string) =
|
||||
self.controller.createCommunityCategory(name, self.createChannelsSeq(channels))
|
||||
|
||||
method leaveCommunity*(self: Module) =
|
||||
self.controller.leaveCommunity()
|
||||
|
||||
|
|
|
@ -108,3 +108,6 @@ method setCommunityMuted*(self: AccessInterface, muted: bool) {.base.} =
|
|||
|
||||
method inviteUsersToCommunity*(self: AccessInterface, pubKeysJSON: string): string {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method createCommunityCategory*(self: AccessInterface, name: string, channels: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
|
|
@ -205,3 +205,6 @@ QtObject:
|
|||
|
||||
proc inviteUsersToCommunity*(self: View, pubKeysJSON: string): string {.slot.} =
|
||||
result = self.delegate.inviteUsersToCommunity(pubKeysJSON)
|
||||
|
||||
proc createCommunityCategory*(self: View, name: string, channels: string) {.slot.} =
|
||||
self.delegate.createCommunityCategory(name, channels)
|
|
@ -31,7 +31,7 @@ StatusModal {
|
|||
if(isEdit){
|
||||
root.contentItem.categoryName.input.text = categoryName
|
||||
// Not Refactored Yet
|
||||
// channels = JSON.parse(root.store.chatsModelInst.communities.activeCommunity.getChatIdsByCategory(categoryId))
|
||||
// channels = //JSON.parse(root.store.chatsModelInst.communities.activeCommunity.getChatIdsByCategory(categoryId))
|
||||
}
|
||||
root.contentItem.categoryName.input.forceActiveFocus(Qt.MouseFocusReason)
|
||||
}
|
||||
|
@ -111,15 +111,15 @@ StatusModal {
|
|||
height: childrenRect.height
|
||||
width: parent.width
|
||||
// Not Refactored Yet
|
||||
// model: root.store.activeCommunityChatsModel
|
||||
model: root.store.chatCommunitySectionModule.model//activeCommunityChatsModel
|
||||
interactive: false
|
||||
clip: true
|
||||
|
||||
delegate: StatusListItem {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: root.isEdit ?
|
||||
visible: true/*root.isEdit ?
|
||||
model.categoryId === root.categoryId || model.categoryId === "" :
|
||||
model.categoryId === ""
|
||||
model.categoryId === ""*/
|
||||
height: visible ? implicitHeight : 0
|
||||
title: "#" + model.name
|
||||
icon.isLetterIdenticon: true
|
||||
|
@ -129,12 +129,13 @@ StatusModal {
|
|||
components: [
|
||||
StatusCheckBox {
|
||||
id: channelItemCheckbox
|
||||
checked: root.isEdit ? root.channels.indexOf(model.id) > - 1 : false
|
||||
checked: root.isEdit ? root.channels.indexOf(model.itemId) > - 1 : false
|
||||
onCheckedChanged: {
|
||||
var idx = root.channels.indexOf(model.id)
|
||||
print("CHECK CHANNEL", model.itemId)
|
||||
var idx = root.channels.indexOf(model.itemId)
|
||||
if(checked){
|
||||
if(idx === -1){
|
||||
root.channels.push(model.id)
|
||||
root.channels.push(model.itemId)
|
||||
}
|
||||
} else {
|
||||
if(idx > -1){
|
||||
|
@ -221,9 +222,9 @@ StatusModal {
|
|||
let error = ""
|
||||
|
||||
if (isEdit) {
|
||||
error = root.store.editCommunityCategory(communityId, categoryId, Utils.filterXSS(root.contentItem.categoryName.input.text), JSON.stringify(channels));
|
||||
// error = root.store.editCommunityCategory(communityId, categoryId, Utils.filterXSS(root.contentItem.categoryName.input.text), JSON.stringify(channels));
|
||||
} else {
|
||||
error = root.store.createCommunityCategory(communityId, Utils.filterXSS(root.contentItem.categoryName.input.text), JSON.stringify(channels));
|
||||
error = root.store.createCommunityCategory(root.contentItem.categoryName.input.text, JSON.stringify(channels));
|
||||
}
|
||||
|
||||
if (error) {
|
||||
|
|
|
@ -146,9 +146,8 @@ QtObject {
|
|||
communitiesModuleInst.createCommunity(communityName, communityDescription, checkedMembership, ensOnlySwitchChecked, communityColor, communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY);
|
||||
}
|
||||
|
||||
function createCommunityCategory(communityId, categoryName, channels) {
|
||||
// Not Refactored Yet
|
||||
// chatsModelInst.communities.createCommunityCategory(communityId, categoryName, channels);
|
||||
function createCommunityCategory(categoryName, channels) {
|
||||
chatCommunitySectionModule.createCommunityCategory(categoryName, channels)
|
||||
}
|
||||
|
||||
function editCommunityCategory(communityId, categoryId, categoryName, channels) {
|
||||
|
|
|
@ -69,7 +69,7 @@ Item {
|
|||
icon.name: "channel-category"
|
||||
enabled: communityData.amISectionAdmin
|
||||
// Not Refactored Yet
|
||||
// onTriggered: Global.openPopup(createCategoryPopup, {communityId: chatsModel.communities.activeCommunity.id})
|
||||
onTriggered: Global.openPopup(createCategoryPopup, {communityId: root.store.chatCommunitySectionModule.activeItem.id})
|
||||
}
|
||||
|
||||
StatusMenuSeparator {}
|
||||
|
@ -189,7 +189,7 @@ Item {
|
|||
icon.name: "channel-category"
|
||||
// Not Refactored Yet
|
||||
enabled: communityData.amISectionAdmin
|
||||
// onTriggered: Global.openPopup(createCategoryPopup, {communityId: root.store.chatsModelInst.communities.activeCommunity.id})
|
||||
onTriggered: Global.openPopup(createCategoryPopup, {communityId: root.store.chatCommunitySectionModule.activeItem.id})
|
||||
}
|
||||
|
||||
StatusMenuSeparator {}
|
||||
|
|
Loading…
Reference in New Issue