Skip to content

Commit

Permalink
fix(status/chat): extend editCommunityChannel API to accept `position…
Browse files Browse the repository at this point in the history
…` property (#52)

This was missing and causes chat item positions in communities to be reset
to 0.
  • Loading branch information
0x-r4bbit committed Oct 5, 2021
1 parent 964e52c commit e3389d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions status/chat.nim
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@ proc editCommunity*(self: ChatModel, id: string, name: string, description: stri
proc createCommunityChannel*(self: ChatModel, communityId: string, name: string, description: string): Chat =
result = status_chat.createCommunityChannel(communityId, name, description)

proc editCommunityChannel*(self: ChatModel, communityId: string, channelId: string, name: string, description: string, categoryId: string): Chat =
result = status_chat.editCommunityChannel(communityId, channelId, name, description, categoryId)
proc editCommunityChannel*(self: ChatModel, communityId: string, channelId: string, name: string, description: string, categoryId: string, position: int): Chat =
result = status_chat.editCommunityChannel(communityId, channelId, name, description, categoryId, position)

proc deleteCommunityChat*(self: ChatModel, communityId: string, channelId: string) =
status_chat.deleteCommunityChat(communityId, channelId)
Expand Down
5 changes: 3 additions & 2 deletions status/statusgo_backend/chat.nim
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ proc createCommunityChannel*(communityId: string, name: string, description: str
if rpcResult{"result"} != nil and rpcResult{"result"}.kind != JNull:
result = rpcResult["result"]["chats"][0].toChat()

proc editCommunityChannel*(communityId: string, channelId: string, name: string, description: string, categoryId: string): Chat =
proc editCommunityChannel*(communityId: string, channelId: string, name: string, description: string, categoryId: string, position: int): Chat =
let rpcResult = callPrivateRPC("editCommunityChat".prefix, %*[
communityId,
channelId.replace(communityId, ""),
Expand All @@ -358,7 +358,8 @@ proc editCommunityChannel*(communityId: string, channelId: string, name: string,
# }
# ]
},
"category_id": categoryId
"category_id": categoryId,
"position": position
}]).parseJSON()

if rpcResult{"error"} != nil:
Expand Down

0 comments on commit e3389d6

Please sign in to comment.