feat: use community.isControlNode as visible for archiveSupporVisible (#11560)

Close #11089
This commit is contained in:
Mikhail Rogachev 2023-07-22 01:05:42 +04:00 committed by GitHub
parent d2051c6247
commit b75d8630ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 39 additions and 2 deletions

View File

@ -145,6 +145,7 @@ method getCommunityItem(self: Module, c: CommunityDto): SectionItem =
SectionType.Community, SectionType.Community,
c.name, c.name,
c.memberRole, c.memberRole,
c.isControlNode,
c.description, c.description,
c.introMessage, c.introMessage,
c.outroMessage, c.outroMessage,

View File

@ -265,6 +265,7 @@ proc createChannelGroupItem[T](self: Module[T], channelGroup: ChannelGroupDto):
if isCommunity: SectionType.Community else: SectionType.Chat, if isCommunity: SectionType.Community else: SectionType.Chat,
if isCommunity: channelGroup.name else: conf.CHAT_SECTION_NAME, if isCommunity: channelGroup.name else: conf.CHAT_SECTION_NAME,
channelGroup.memberRole, channelGroup.memberRole,
if isCommunity: communityDetails.isControlNode else: false,
channelGroup.description, channelGroup.description,
channelGroup.introMessage, channelGroup.introMessage,
channelGroup.outroMessage, channelGroup.outroMessage,

View File

@ -26,6 +26,7 @@ type
id: string id: string
name: string name: string
memberRole: MemberRole memberRole: MemberRole
isControlNode: bool
description: string description: string
introMessage: string introMessage: string
outroMessage: string outroMessage: string
@ -62,6 +63,7 @@ proc initItem*(
sectionType: SectionType, sectionType: SectionType,
name: string, name: string,
memberRole = MemberRole.None, memberRole = MemberRole.None,
isControlNode = false,
description = "", description = "",
introMessage = "", introMessage = "",
outroMessage = "", outroMessage = "",
@ -97,6 +99,7 @@ proc initItem*(
result.sectionType = sectionType result.sectionType = sectionType
result.name = name result.name = name
result.memberRole = memberRole result.memberRole = memberRole
result.isControlNode = isControlNode
result.description = description result.description = description
result.introMessage = introMessage result.introMessage = introMessage
result.outroMessage = outroMessage result.outroMessage = outroMessage
@ -143,6 +146,7 @@ proc `$`*(self: SectionItem): string =
sectionType: {self.sectionType.int}, sectionType: {self.sectionType.int},
name: {self.name}, name: {self.name},
memberRole: {self.memberRole}, memberRole: {self.memberRole},
isControlNode: {self.isControlNode},
description: {self.description}, description: {self.description},
introMessage: {self.introMessage}, introMessage: {self.introMessage},
outroMessage: {self.outroMessage}, outroMessage: {self.outroMessage},
@ -189,6 +193,9 @@ proc memberRole*(self: SectionItem): MemberRole {.inline.} =
proc `memberRole=`*(self: var SectionItem, value: MemberRole) {.inline.} = proc `memberRole=`*(self: var SectionItem, value: MemberRole) {.inline.} =
self.memberRole = value self.memberRole = value
proc isControlNode*(self: SectionItem): bool {.inline.} =
self.isControlNode
proc description*(self: SectionItem): string {.inline.} = proc description*(self: SectionItem): string {.inline.} =
self.description self.description

View File

@ -13,6 +13,7 @@ type
SectionType SectionType
Name Name
MemberRole MemberRole
IsControlNode
Description Description
IntroMessage IntroMessage
OutroMessage OutroMessage
@ -85,6 +86,7 @@ QtObject:
ModelRole.SectionType.int:"sectionType", ModelRole.SectionType.int:"sectionType",
ModelRole.Name.int:"name", ModelRole.Name.int:"name",
ModelRole.MemberRole.int: "memberRole", ModelRole.MemberRole.int: "memberRole",
ModelRole.IsControlNode.int: "isControlNode",
ModelRole.Description.int:"description", ModelRole.Description.int:"description",
ModelRole.IntroMessage.int:"introMessage", ModelRole.IntroMessage.int:"introMessage",
ModelRole.OutroMessage.int:"outroMessage", ModelRole.OutroMessage.int:"outroMessage",
@ -137,6 +139,8 @@ QtObject:
result = newQVariant(item.name) result = newQVariant(item.name)
of ModelRole.MemberRole: of ModelRole.MemberRole:
result = newQVariant(item.memberRole.int) result = newQVariant(item.memberRole.int)
of ModelRole.IsControlNode:
result = newQVariant(item.isControlNode)
of ModelRole.Description: of ModelRole.Description:
result = newQVariant(item.description) result = newQVariant(item.description)
of ModelRole.IntroMessage: of ModelRole.IntroMessage:
@ -273,6 +277,7 @@ QtObject:
self.dataChanged(dataIndex, dataIndex, @[ self.dataChanged(dataIndex, dataIndex, @[
ModelRole.Name.int, ModelRole.Name.int,
ModelRole.MemberRole.int, ModelRole.MemberRole.int,
ModelRole.IsControlNode.int,
ModelRole.Description.int, ModelRole.Description.int,
ModelRole.IntroMessage.int, ModelRole.IntroMessage.int,
ModelRole.OutroMessage.int, ModelRole.OutroMessage.int,
@ -415,6 +420,7 @@ QtObject:
"id": item.id, "id": item.id,
"name": item.name, "name": item.name,
"memberRole": item.memberRole.int, "memberRole": item.memberRole.int,
"isControlNode": item.isControlNode,
"description": item.description, "description": item.description,
"introMessage": item.introMessage, "introMessage": item.introMessage,
"outroMessage": item.outroMessage, "outroMessage": item.outroMessage,

View File

@ -91,6 +91,7 @@ type CheckPermissionsToJoinResponseDto* = object
type CommunityDto* = object type CommunityDto* = object
id*: string id*: string
memberRole*: MemberRole memberRole*: MemberRole
isControlNode*: bool
verified*: bool verified*: bool
joined*: bool joined*: bool
spectated*: bool spectated*: bool
@ -304,6 +305,7 @@ proc toCommunityDto*(jsonObj: JsonNode): CommunityDto =
result = CommunityDto() result = CommunityDto()
discard jsonObj.getProp("id", result.id) discard jsonObj.getProp("id", result.id)
discard jsonObj.getProp("memberRole", result.memberRole) discard jsonObj.getProp("memberRole", result.memberRole)
discard jsonObj.getProp("isControlNode", result.isControlNode)
discard jsonObj.getProp("verified", result.verified) discard jsonObj.getProp("verified", result.verified)
discard jsonObj.getProp("joined", result.joined) discard jsonObj.getProp("joined", result.joined)
discard jsonObj.getProp("spectated", result.spectated) discard jsonObj.getProp("spectated", result.spectated)

View File

@ -38,6 +38,7 @@ SplitView {
joined: true, joined: true,
spectated: false, spectated: false,
memberRole: Constants.memberRole.owner, memberRole: Constants.memberRole.owner,
isControlNode: true,
image: ModelsData.icons.dribble, image: ModelsData.icons.dribble,
color: "yellow", color: "yellow",
muted: false, muted: false,
@ -52,6 +53,7 @@ SplitView {
joined: true, joined: true,
spectated: false, spectated: false,
memberRole: Constants.memberRole.none, memberRole: Constants.memberRole.none,
isControlNode: false,
image: ModelsData.icons.status, image: ModelsData.icons.status,
color: "peach", color: "peach",
muted: false, muted: false,
@ -66,6 +68,7 @@ SplitView {
joined: false, joined: false,
spectated: true, spectated: true,
memberRole: Constants.memberRole.none, memberRole: Constants.memberRole.none,
isControlNode: false,
image: ModelsData.icons.coinbase, image: ModelsData.icons.coinbase,
color: "red", color: "red",
muted: false, muted: false,
@ -80,6 +83,7 @@ SplitView {
joined: true, joined: true,
spectated: false, spectated: false,
memberRole: Constants.memberRole.none, memberRole: Constants.memberRole.none,
isControlNode: false,
image: "", image: "",
color: "whitesmoke", color: "whitesmoke",
muted: true, muted: true,
@ -94,6 +98,7 @@ SplitView {
joined: true, joined: true,
spectated: false, spectated: false,
memberRole: Constants.memberRole.admin, memberRole: Constants.memberRole.admin,
isControlNode: false,
image: ModelsData.icons.socks, image: ModelsData.icons.socks,
color: "green", color: "green",
muted: false, muted: false,
@ -108,6 +113,7 @@ SplitView {
joined: false, joined: false,
spectated: true, spectated: true,
memberRole: Constants.memberRole.none, memberRole: Constants.memberRole.none,
isControlNode: false,
image: ModelsData.icons.spotify, image: ModelsData.icons.spotify,
color: "pink", color: "pink",
muted: false, muted: false,

View File

@ -175,6 +175,7 @@ SplitView {
ListElement { ListElement {
name: "Not the cool gang" name: "Not the cool gang"
memberRole: 0 // Constants.memberRole.none memberRole: 0 // Constants.memberRole.none
isControlNode: false,
description: "Nothing to write home about" description: "Nothing to write home about"
color: "indigo" color: "indigo"
image: "" image: ""
@ -186,6 +187,7 @@ SplitView {
ListElement { ListElement {
name: "Awesome bunch" name: "Awesome bunch"
memberRole: 4 // Constants.memberRole.admin memberRole: 4 // Constants.memberRole.admin
isControlNode: false,
description: "Where the cool guys hang out & Nothing to write home about" description: "Where the cool guys hang out & Nothing to write home about"
color: "green" color: "green"
image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/ image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/
@ -202,6 +204,7 @@ SplitView {
ListElement { ListElement {
name: "Invisible community (should not display!)" name: "Invisible community (should not display!)"
memberRole: 1 // Constants.memberRole.owner memberRole: 1 // Constants.memberRole.owner
isControlNode: true,
description: "Get outta here" description: "Get outta here"
color: "red" color: "red"
image: "" image: ""

View File

@ -32,6 +32,7 @@ SplitView {
name: "Test community", name: "Test community",
joined: true, joined: true,
memberRole: Constants.memberRole.owner, memberRole: Constants.memberRole.owner,
isControlNode: true,
image: ModelsData.icons.dribble, image: ModelsData.icons.dribble,
color: "yellow" color: "yellow"
}, },
@ -40,6 +41,7 @@ SplitView {
name: "Test community 2", name: "Test community 2",
joined: true, joined: true,
memberRole: Constants.memberRole.none, memberRole: Constants.memberRole.none,
isControlNode: false,
image: ModelsData.collectibles.custom, image: ModelsData.collectibles.custom,
color: "peach" color: "peach"
}, },
@ -48,6 +50,7 @@ SplitView {
name: "Test community invisible", name: "Test community invisible",
joined: false, joined: false,
memberRole: Constants.memberRole.none, memberRole: Constants.memberRole.none,
isControlNode: false,
image: "", image: "",
color: "red" color: "red"
}, },
@ -56,6 +59,7 @@ SplitView {
name: "Test community 3", name: "Test community 3",
joined: true, joined: true,
memberRole: Constants.memberRole.none, memberRole: Constants.memberRole.none,
isControlNode: false,
image: "", image: "",
color: "whitesmoke" color: "whitesmoke"
}, },
@ -64,6 +68,7 @@ SplitView {
name: "Test community 4", name: "Test community 4",
joined: true, joined: true,
memberRole: Constants.memberRole.admin, memberRole: Constants.memberRole.admin,
isControlNode: false,
image: ModelsData.icons.spotify, image: ModelsData.icons.spotify,
color: "green" color: "green"
}, },

View File

@ -13,6 +13,8 @@ Column {
property alias requestToJoinEnabled: requestToJoinToggle.checked property alias requestToJoinEnabled: requestToJoinToggle.checked
property alias pinMessagesEnabled: pinMessagesToggle.checked property alias pinMessagesEnabled: pinMessagesToggle.checked
property alias archiveSupporVisible: archiveSupport.visible
spacing: 0 spacing: 0
QtObject { QtObject {
@ -24,7 +26,7 @@ Column {
id: archiveSupport id: archiveSupport
width: parent.width width: parent.width
height: d.optionHeight height: visible ? d.optionHeight : 0
StatusBaseText { StatusBaseText {
Layout.fillWidth: true Layout.fillWidth: true

View File

@ -33,6 +33,7 @@ StackLayout {
property bool pinMessagesEnabled property bool pinMessagesEnabled
property string previousPageName: (currentIndex === 1) ? qsTr("Overview") : "" property string previousPageName: (currentIndex === 1) ? qsTr("Overview") : ""
property bool archiveSupporVisible: true
property bool editable: false property bool editable: false
property bool owned: false property bool owned: false
property bool isControlNode: false property bool isControlNode: false
@ -190,6 +191,7 @@ StackLayout {
options { options {
archiveSupportEnabled: root.archiveSupportEnabled archiveSupportEnabled: root.archiveSupportEnabled
archiveSupporVisible: root.archiveSupporVisible
requestToJoinEnabled: root.requestToJoinEnabled requestToJoinEnabled: root.requestToJoinEnabled
pinMessagesEnabled: root.pinMessagesEnabled pinMessagesEnabled: root.pinMessagesEnabled
} }

View File

@ -442,6 +442,7 @@ StatusStackModal {
historyArchiveSupportEnabled: generalViewLayout.options.archiveSupportEnabled, historyArchiveSupportEnabled: generalViewLayout.options.archiveSupportEnabled,
checkedMembership: generalViewLayout.options.requestToJoinEnabled ? Constants.communityChatOnRequestAccess : Constants.communityChatPublicAccess, checkedMembership: generalViewLayout.options.requestToJoinEnabled ? Constants.communityChatOnRequestAccess : Constants.communityChatPublicAccess,
pinMessagesAllowedForMembers: generalViewLayout.options.pinMessagesEnabled, pinMessagesAllowedForMembers: generalViewLayout.options.pinMessagesEnabled,
archiveSupporVisible: true
}, },
bannerJsonStr: JSON.stringify({imagePath: String(generalViewLayout.bannerPath).replace("file://", ""), cropRect: generalViewLayout.bannerCropRect}) bannerJsonStr: JSON.stringify({imagePath: String(generalViewLayout.bannerPath).replace("file://", ""), cropRect: generalViewLayout.bannerCropRect})
} }

View File

@ -168,6 +168,7 @@ StatusSectionLayout {
tags: root.rootStore.communityTags tags: root.rootStore.communityTags
selectedTags: root.filteredSelectedTags selectedTags: root.filteredSelectedTags
archiveSupportEnabled: root.community.historyArchiveSupportEnabled archiveSupportEnabled: root.community.historyArchiveSupportEnabled
archiveSupporVisible: root.community.isControlNode
requestToJoinEnabled: root.community.access === Constants.communityChatOnRequestAccess requestToJoinEnabled: root.community.access === Constants.communityChatOnRequestAccess
pinMessagesEnabled: root.community.pinMessageAllMembersEnabled pinMessagesEnabled: root.community.pinMessageAllMembersEnabled
editable: true editable: true

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 42d5d36cf574674d5639cfdfa57810ce2319fa0c Subproject commit 631962ce88b7f8ba6226f49066f823007726c4cf