fix: community chat positions
This commit is contained in:
parent
b21d2c5618
commit
3fd10e7915
|
@ -352,3 +352,9 @@ method setCommunityMuted*(self: Controller, muted: bool) =
|
|||
|
||||
method inviteUsersToCommunity*(self: Controller, pubKeys: string): string =
|
||||
result = self.communityService.inviteUsersToCommunityById(self.sectionId, pubKeys)
|
||||
|
||||
method reorderCommunityCategories*(self: Controller, categoryId: string, position: int) =
|
||||
self.communityService.reorderCommunityCategories(self.sectionId, categoryId, position)
|
||||
|
||||
method reorderCommunityChat*(self: Controller, categoryId: string, chatId: string, position: int): string =
|
||||
self.communityService.reorderCommunityChat(self.sectionId, categoryId, chatId, position)
|
||||
|
|
|
@ -151,3 +151,9 @@ method setCommunityMuted*(self: AccessInterface, muted: bool) {.base.} =
|
|||
|
||||
method inviteUsersToCommunity*(self: AccessInterface, pubKeys: string): string {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method reorderCommunityCategories*(self: AccessInterface, categoryId: string, position: int) =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method reorderCommunityChat*(self: AccessInterface, categoryId: string, chatId: string, position: int): string =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
|
|
@ -677,3 +677,9 @@ method prepareEditCategoryModel*(self: Module, categoryId: string) =
|
|||
let item = initItem(c.id, c.name, "", false, c.color, c.description, c.chatType.int, false,
|
||||
false, 0, c.muted, false, active = false, c.position, categoryId)
|
||||
self.view.editCategoryChannelsModel().appendItem(item)
|
||||
|
||||
method reorderCommunityCategories*(self: Module, categoryId: string, position: int) =
|
||||
self.controller.reorderCommunityCategories(categoryId, position)
|
||||
|
||||
method reorderCommunityChat*(self: Module, categoryId: string, chatId: string, position: int): string =
|
||||
self.controller.reorderCommunityChat(categoryId, chatId, position)
|
||||
|
|
|
@ -123,3 +123,9 @@ method deleteCommunityCategory*(self: AccessInterface, categoryId: string) {.bas
|
|||
|
||||
method prepareEditCategoryModel*(self: AccessInterface, categoryId: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method reorderCommunityCategories*(self: AccessInterface, categoryId: string, position: int) =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method reorderCommunityChat*(self: AccessInterface, categoryId: string, chatId: string, position: int): string =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
|
|
@ -250,3 +250,9 @@ QtObject:
|
|||
|
||||
proc prepareEditCategoryModel*(self: View, categoryId: string) {.slot.} =
|
||||
self.delegate.prepareEditCategoryModel(categoryId)
|
||||
|
||||
proc reorderCommunityCategories*(self: View, categoryId: string, position: int) {.slot} =
|
||||
self.delegate.reorderCommunityCategories(categoryId, position)
|
||||
|
||||
proc reorderCommunityChat*(self: View, categoryId: string, chatId: string, position: int): string {.slot} =
|
||||
self.delegate.reorderCommunityChat(categoryId, chatId, position)
|
||||
|
|
|
@ -51,6 +51,10 @@ method init*(self: Controller) =
|
|||
method getAllCommunities*(self: Controller): seq[CommunityDto] =
|
||||
result = self.communityService.getAllCommunities()
|
||||
|
||||
self.events.on(SIGNAL_COMMUNITY_CATEGORY_REORDERED) do(e:Args):
|
||||
let args = CommunityCategoryOrderArgs(e)
|
||||
# self.delegate.communityCategoryReordered()
|
||||
|
||||
method joinCommunity*(self: Controller, communityId: string): string =
|
||||
self.communityService.joinCommunity(communityId)
|
||||
|
||||
|
|
|
@ -43,6 +43,11 @@ type
|
|||
categoryId*: string
|
||||
position*: int
|
||||
|
||||
CommunityCategoryOrderArgs* = ref object of Args
|
||||
communityId*: string
|
||||
categoryId*: string
|
||||
position*: int
|
||||
|
||||
CommunityCategoryArgs* = ref object of Args
|
||||
communityId*: string
|
||||
category*: Category
|
||||
|
@ -67,6 +72,7 @@ const SIGNAL_COMMUNITY_CHANNEL_DELETED* = "communityChannelDeleted"
|
|||
const SIGNAL_COMMUNITY_CATEGORY_CREATED* = "communityCategoryCreated"
|
||||
const SIGNAL_COMMUNITY_CATEGORY_EDITED* = "communityCategoryEdited"
|
||||
const SIGNAL_COMMUNITY_CATEGORY_DELETED* = "communityCategoryDeleted"
|
||||
const SIGNAL_COMMUNITY_CATEGORY_REORDERED* = "communityCategoryReordered"
|
||||
const SIGNAL_COMMUNITY_MEMBER_APPROVED* = "communityMemberApproved"
|
||||
|
||||
QtObject:
|
||||
|
@ -639,6 +645,31 @@ QtObject:
|
|||
except Exception as e:
|
||||
error "Error deleting community category", msg = e.msg, communityId, categoryId
|
||||
|
||||
proc reorderCommunityCategories*(
|
||||
self: Service,
|
||||
communityId: string,
|
||||
categoryId: string,
|
||||
position: int) =
|
||||
try:
|
||||
let response = status_go.reorderCommunityCategories(
|
||||
communityId,
|
||||
categoryId,
|
||||
position)
|
||||
|
||||
if response.error != nil:
|
||||
let error = Json.decode($response.error, RpcError)
|
||||
raise newException(RpcException, "Error reordering community category: " & error.message)
|
||||
|
||||
self.events.emit(SIGNAL_COMMUNITY_CATEGORY_REORDERED,
|
||||
CommunityCategoryOrderArgs(
|
||||
communityId: communityId,
|
||||
categoryId: categoryId,
|
||||
position: position
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
error "Error reordering category channel", msg = e.msg, communityId, categoryId, position
|
||||
|
||||
proc requestCommunityInfo*(self: Service, communityId: string) =
|
||||
try:
|
||||
let response = status_go.requestCommunityInfo(communityId)
|
||||
|
|
|
@ -210,4 +210,12 @@ QtObject {
|
|||
function removeCommunityChat(chatId) {
|
||||
chatCommunitySectionModule.removeCommunityChat(chatId)
|
||||
}
|
||||
|
||||
function reorderCommunityCategories(categoryId, to){
|
||||
chatCommunitySectionModule.reorderCommunityCategories(categoryId, to)
|
||||
}
|
||||
|
||||
function reorderCommunityChat(categoryId, chatId, to){
|
||||
chatCommunitySectionModule.reorderCommunityChat(categoryId, chatId, to)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,12 +160,8 @@ Item {
|
|||
|
||||
// onChatItemSelected: root.store.chatsModelInst.channelView.setActiveChannel(id)
|
||||
// onChatItemUnmuted: root.store.chatsModelInst.channelView.unmuteChatItem(id)
|
||||
// onChatItemReordered: function (categoryId, id, from, to) {
|
||||
// root.store.chatsModelInst.communities.reorderCommunityChannel(chatsModel.communities.activeCommunity.id, categoryId, id, to);
|
||||
// }
|
||||
// onChatListCategoryReordered: function (categoryId, from, to) {
|
||||
// root.store.chatsModelInst.communities.reorderCommunityCategories(chatsModel.communities.activeCommunity.id, categoryId, to);
|
||||
// }
|
||||
onChatItemReordered: root.store.reorderCommunityChat(categoryId, id, to)
|
||||
onChatListCategoryReordered: root.store.reorderCommunityCategories(categoryId, to)
|
||||
|
||||
onCategoryAddButtonClicked: Global.openPopup(createChannelPopup, {
|
||||
categoryId: id
|
||||
|
|
Loading…
Reference in New Issue