fix: cherry-pick https://github.com/status-im/status-desktop/pull/14977
This commit is contained in:
parent
4ed908e4e8
commit
2d4de5da6f
|
@ -700,12 +700,21 @@ proc getChatItemFromChatDto(
|
||||||
var viewersCanPostReactions = true
|
var viewersCanPostReactions = true
|
||||||
if self.controller.isCommunity:
|
if self.controller.isCommunity:
|
||||||
let communityChat = community.getCommunityChat(chatDto.id)
|
let communityChat = community.getCommunityChat(chatDto.id)
|
||||||
# Some properties are only available on CommunityChat (they are useless for normal chats)
|
# NOTE: workaround for new community chat, which is delivered in chatDto before the community will know about that
|
||||||
canPost = communityChat.canPost
|
if community.hasCommunityChat(chatDto.id):
|
||||||
canView = communityChat.canView
|
let communityChat = community.getCommunityChat(chatDto.id)
|
||||||
canPostReactions = communityChat.canPostReactions
|
# Some properties are only available on CommunityChat (they are useless for normal chats)
|
||||||
hideIfPermissionsNotMet = communityChat.hideIfPermissionsNotMet
|
canPost = communityChat.canPost
|
||||||
viewersCanPostReactions = communityChat.viewersCanPostReactions
|
canView = communityChat.canView
|
||||||
|
canPostReactions = communityChat.canPostReactions
|
||||||
|
hideIfPermissionsNotMet = communityChat.hideIfPermissionsNotMet
|
||||||
|
viewersCanPostReactions = communityChat.viewersCanPostReactions
|
||||||
|
else:
|
||||||
|
canPost = chatDto.canPost
|
||||||
|
canView = chatDto.canView
|
||||||
|
canPostReactions = chatDto.canPostReactions
|
||||||
|
hideIfPermissionsNotMet = chatDto.hideIfPermissionsNotMet
|
||||||
|
viewersCanPostReactions = chatDto.viewersCanPostReactions
|
||||||
|
|
||||||
result = chat_item.initItem(
|
result = chat_item.initItem(
|
||||||
chatDto.id,
|
chatDto.id,
|
||||||
|
|
|
@ -612,6 +612,12 @@ proc getCommunityChat*(self: CommunityDto, chatId: string): ChatDto =
|
||||||
if chats.len > 0:
|
if chats.len > 0:
|
||||||
return chats[0]
|
return chats[0]
|
||||||
|
|
||||||
|
proc hasCommunityChat*(self: CommunityDto, chatId: string): bool =
|
||||||
|
for communityChat in self.chats:
|
||||||
|
if chatId == communityChat.id:
|
||||||
|
return true
|
||||||
|
return false
|
||||||
|
|
||||||
proc isOwner*(self: CommunityDto): bool =
|
proc isOwner*(self: CommunityDto): bool =
|
||||||
return self.memberRole == MemberRole.Owner
|
return self.memberRole == MemberRole.Owner
|
||||||
|
|
||||||
|
|
|
@ -1312,6 +1312,7 @@ QtObject:
|
||||||
self.communities[communityId].chats.add(chatDto)
|
self.communities[communityId].chats.add(chatDto)
|
||||||
let data = CommunityChatArgs(chat: chatDto)
|
let data = CommunityChatArgs(chat: chatDto)
|
||||||
self.events.emit(SIGNAL_COMMUNITY_CHANNEL_CREATED, data)
|
self.events.emit(SIGNAL_COMMUNITY_CHANNEL_CREATED, data)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error "Error creating community channel", msg = e.msg, communityId, name, description, procName="createCommunityChannel"
|
error "Error creating community channel", msg = e.msg, communityId, name, description, procName="createCommunityChannel"
|
||||||
|
|
||||||
|
|
|
@ -553,7 +553,7 @@ Item {
|
||||||
property var deleteChatConfirmationDialog
|
property var deleteChatConfirmationDialog
|
||||||
|
|
||||||
onCreateCommunityChannel: function (chName, chDescription, chEmoji, chColor,
|
onCreateCommunityChannel: function (chName, chDescription, chEmoji, chColor,
|
||||||
chCategoryId, hideIfPermissionsNotMet) {
|
chCategoryId, viewOnlyCanAddReaction, hideIfPermissionsNotMet) {
|
||||||
root.store.createCommunityChannel(chName, chDescription, chEmoji, chColor,
|
root.store.createCommunityChannel(chName, chDescription, chEmoji, chColor,
|
||||||
chCategoryId, viewOnlyCanAddReaction, hideIfPermissionsNotMet)
|
chCategoryId, viewOnlyCanAddReaction, hideIfPermissionsNotMet)
|
||||||
chatId = root.store.currentChatContentModule().chatDetails.id
|
chatId = root.store.currentChatContentModule().chatDetails.id
|
||||||
|
|
Loading…
Reference in New Issue