mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-16 16:47:24 +00:00
fix: community context menu should not say "Leave community" if not joined
- get rid of the `amISectionAdmin` for good (was done only partially in 82a1ed2f7aa46750fb5ab891e2ce40f61287eccb) - fix the corresponding storybook pages Fixes #10963
This commit is contained in:
parent
d79a93bb6a
commit
ecc1b5316f
@ -70,6 +70,7 @@ SplitView {
|
|||||||
trustStatus: trustStatus.currentValue,
|
trustStatus: trustStatus.currentValue,
|
||||||
verificationStatus: Constants.verificationStatus.unverified,
|
verificationStatus: Constants.verificationStatus.unverified,
|
||||||
incomingVerificationStatus: Constants.verificationStatus.unverified,
|
incomingVerificationStatus: Constants.verificationStatus.unverified,
|
||||||
|
contactRequestState: Constants.ContactRequestState.None,
|
||||||
bio: bio.text,
|
bio: bio.text,
|
||||||
socialLinks: JSON.stringify
|
socialLinks: JSON.stringify
|
||||||
([{
|
([{
|
||||||
@ -173,7 +174,7 @@ SplitView {
|
|||||||
communitiesModel: ListModel {
|
communitiesModel: ListModel {
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "Not the cool gang"
|
name: "Not the cool gang"
|
||||||
amISectionAdmin: false
|
memberRole: 0 // Constants.memberRole.none
|
||||||
description: "Nothing to write home about"
|
description: "Nothing to write home about"
|
||||||
color: "indigo"
|
color: "indigo"
|
||||||
image: ""
|
image: ""
|
||||||
@ -184,7 +185,7 @@ SplitView {
|
|||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "Awesome bunch"
|
name: "Awesome bunch"
|
||||||
amISectionAdmin: true
|
memberRole: 4 // Constants.memberRole.admin
|
||||||
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/
|
||||||
@ -200,7 +201,7 @@ SplitView {
|
|||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "Invisible community (should not display!)"
|
name: "Invisible community (should not display!)"
|
||||||
amISectionAdmin: false
|
memberRole: 1 // Constants.memberRole.owner
|
||||||
description: "Get outta here"
|
description: "Get outta here"
|
||||||
color: "red"
|
color: "red"
|
||||||
image: ""
|
image: ""
|
||||||
@ -222,27 +223,27 @@ SplitView {
|
|||||||
ListElement {
|
ListElement {
|
||||||
name: "My Status Account"
|
name: "My Status Account"
|
||||||
address: "0xcdc2ea3b6ba8fed3a3402f8db8b2fab53e7b7420"
|
address: "0xcdc2ea3b6ba8fed3a3402f8db8b2fab53e7b7420"
|
||||||
color: "aliceblue"
|
colorId: "primary"
|
||||||
emoji: "🇨🇿"
|
emoji: "🇨🇿"
|
||||||
walletType: ""
|
walletType: ""
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "testing (no emoji, colored, saved, seed)"
|
name: "testing (no emoji, colored, saved, seed)"
|
||||||
address: "0xcdc2ea3b6ba8fed3a3402f8db8b2fab53e7b7000"
|
address: "0xcdc2ea3b6ba8fed3a3402f8db8b2fab53e7b7000"
|
||||||
color: "olive"
|
colorId: "turquoise"
|
||||||
walletType: "seed"
|
walletType: "seed"
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "My Bro's Account"
|
name: "My Bro's Account"
|
||||||
address: "0xcdc2ea3b6ba8fed3a3402f8db8b2fab53e7b7421"
|
address: "0xcdc2ea3b6ba8fed3a3402f8db8b2fab53e7b7421"
|
||||||
color: "ghostwhite"
|
colorId: "sky"
|
||||||
emoji: "🇸🇰"
|
emoji: "🇸🇰"
|
||||||
walletType: "watch"
|
walletType: "watch"
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
name: "Keycard"
|
name: "Keycard"
|
||||||
address: "0xdeadbeef"
|
address: "0xdeadbeef"
|
||||||
color: "red"
|
colorId: "purple"
|
||||||
emoji: ""
|
emoji: ""
|
||||||
walletType: "key"
|
walletType: "key"
|
||||||
}
|
}
|
||||||
@ -267,63 +268,61 @@ SplitView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var currentAccount: QtObject {
|
readonly property var assets: ListModel {
|
||||||
readonly property var assets: ListModel {
|
readonly property var data: [
|
||||||
readonly property var data: [
|
{
|
||||||
{
|
symbol: "MANA",
|
||||||
symbol: "MANA",
|
enabledNetworkBalance: {
|
||||||
enabledNetworkBalance: {
|
amount: 301,
|
||||||
amount: 301,
|
symbol: "MANA"
|
||||||
symbol: "MANA"
|
|
||||||
},
|
|
||||||
changePct24hour: -2.1,
|
|
||||||
visibleForNetworkWithPositiveBalance: true
|
|
||||||
},
|
},
|
||||||
{
|
changePct24hour: -2.1,
|
||||||
symbol: "AAVE",
|
visibleForNetworkWithPositiveBalance: true
|
||||||
enabledNetworkBalance: {
|
},
|
||||||
amount: 23.3,
|
{
|
||||||
symbol: "AAVE"
|
symbol: "AAVE",
|
||||||
},
|
enabledNetworkBalance: {
|
||||||
changePct24hour: 4.56,
|
amount: 23.3,
|
||||||
visibleForNetworkWithPositiveBalance: true
|
symbol: "AAVE"
|
||||||
},
|
},
|
||||||
{
|
changePct24hour: 4.56,
|
||||||
symbol: "POLY",
|
visibleForNetworkWithPositiveBalance: true
|
||||||
enabledNetworkBalance: {
|
},
|
||||||
amount: 3590,
|
{
|
||||||
symbol: "POLY"
|
symbol: "POLY",
|
||||||
},
|
enabledNetworkBalance: {
|
||||||
changePct24hour: -11.6789,
|
amount: 3590,
|
||||||
visibleForNetworkWithPositiveBalance: true
|
symbol: "POLY"
|
||||||
},
|
},
|
||||||
{
|
changePct24hour: -11.6789,
|
||||||
symbol: "CDT",
|
visibleForNetworkWithPositiveBalance: true
|
||||||
enabledNetworkBalance: {
|
},
|
||||||
amount: 1000,
|
{
|
||||||
symbol: "CDT"
|
symbol: "CDT",
|
||||||
},
|
enabledNetworkBalance: {
|
||||||
changePct24hour: 0,
|
amount: 1000,
|
||||||
visibleForNetworkWithPositiveBalance: true
|
symbol: "CDT"
|
||||||
},
|
},
|
||||||
{
|
changePct24hour: 0,
|
||||||
symbol: "MKR",
|
visibleForNetworkWithPositiveBalance: true
|
||||||
enabledNetworkBalance: {
|
},
|
||||||
amount: 1.3,
|
{
|
||||||
symbol: "MKR"
|
symbol: "MKR",
|
||||||
},
|
enabledNetworkBalance: {
|
||||||
//changePct24hour: undefined // NB 'undefined' on purpose
|
amount: 1.3,
|
||||||
visibleForNetworkWithPositiveBalance: true
|
symbol: "MKR"
|
||||||
},
|
},
|
||||||
{
|
//changePct24hour: undefined // NB 'undefined' on purpose
|
||||||
symbol: "InvisibleHere",
|
visibleForNetworkWithPositiveBalance: true
|
||||||
enabledNetworkBalance: {},
|
},
|
||||||
changePct24hour: 0,
|
{
|
||||||
visibleForNetworkWithPositiveBalance: false
|
symbol: "InvisibleHere",
|
||||||
}
|
enabledNetworkBalance: {},
|
||||||
]
|
changePct24hour: 0,
|
||||||
Component.onCompleted: append(data)
|
visibleForNetworkWithPositiveBalance: false
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
Component.onCompleted: append(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var flatCollectibles: ListModel {
|
readonly property var flatCollectibles: ListModel {
|
||||||
|
@ -31,7 +31,7 @@ SplitView {
|
|||||||
id: "0x0001",
|
id: "0x0001",
|
||||||
name: "Test community",
|
name: "Test community",
|
||||||
joined: true,
|
joined: true,
|
||||||
amISectionAdmin: true,
|
memberRole: Constants.memberRole.owner,
|
||||||
image: ModelsData.icons.dribble,
|
image: ModelsData.icons.dribble,
|
||||||
color: "yellow"
|
color: "yellow"
|
||||||
},
|
},
|
||||||
@ -39,7 +39,7 @@ SplitView {
|
|||||||
id: "0x0002",
|
id: "0x0002",
|
||||||
name: "Test community 2",
|
name: "Test community 2",
|
||||||
joined: true,
|
joined: true,
|
||||||
amISectionAdmin: false,
|
memberRole: Constants.memberRole.none,
|
||||||
image: ModelsData.collectibles.custom,
|
image: ModelsData.collectibles.custom,
|
||||||
color: "peach"
|
color: "peach"
|
||||||
},
|
},
|
||||||
@ -47,7 +47,7 @@ SplitView {
|
|||||||
id: "0x0003",
|
id: "0x0003",
|
||||||
name: "Test community invisible",
|
name: "Test community invisible",
|
||||||
joined: false,
|
joined: false,
|
||||||
amISectionAdmin: false,
|
memberRole: Constants.memberRole.none,
|
||||||
image: "",
|
image: "",
|
||||||
color: "red"
|
color: "red"
|
||||||
},
|
},
|
||||||
@ -55,7 +55,7 @@ SplitView {
|
|||||||
id: "0x0004",
|
id: "0x0004",
|
||||||
name: "Test community 3",
|
name: "Test community 3",
|
||||||
joined: true,
|
joined: true,
|
||||||
amISectionAdmin: false,
|
memberRole: Constants.memberRole.none,
|
||||||
image: "",
|
image: "",
|
||||||
color: "whitesmoke"
|
color: "whitesmoke"
|
||||||
},
|
},
|
||||||
@ -63,7 +63,7 @@ SplitView {
|
|||||||
id: "0x0005",
|
id: "0x0005",
|
||||||
name: "Test community 4",
|
name: "Test community 4",
|
||||||
joined: true,
|
joined: true,
|
||||||
amISectionAdmin: true,
|
memberRole: Constants.memberRole.admin,
|
||||||
image: ModelsData.icons.spotify,
|
image: ModelsData.icons.spotify,
|
||||||
color: "green"
|
color: "green"
|
||||||
},
|
},
|
||||||
|
@ -18,6 +18,7 @@ Feature: Status Desktop community navigation
|
|||||||
** when user signs up with username "tester123" and password "TesTEr16843/!@00"
|
** when user signs up with username "tester123" and password "TesTEr16843/!@00"
|
||||||
** and the user lands on the signed in app
|
** and the user lands on the signed in app
|
||||||
|
|
||||||
|
@mayfail
|
||||||
Scenario Outline: User creates and leaves community
|
Scenario Outline: User creates and leaves community
|
||||||
# Create a community
|
# Create a community
|
||||||
Given the user opens the community portal section
|
Given the user opens the community portal section
|
||||||
@ -33,4 +34,4 @@ Feature: Status Desktop community navigation
|
|||||||
Then the count of communities in navbar is 0
|
Then the count of communities in navbar is 0
|
||||||
Examples:
|
Examples:
|
||||||
| community_name |
|
| community_name |
|
||||||
| My community 1 |
|
| My community 1 |
|
||||||
|
@ -73,7 +73,7 @@ Column {
|
|||||||
|
|
||||||
StatusListItem {
|
StatusListItem {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
visible: !root.community.amISectionAdmin
|
visible: root.community.memberRole !== Constants.memberRole.owner
|
||||||
title: root.community.spectated ? qsTr("Close Community") : qsTr("Leave Community")
|
title: root.community.spectated ? qsTr("Close Community") : qsTr("Leave Community")
|
||||||
asset.name: root.community.spectated ? "close-circle" : "arrow-left"
|
asset.name: root.community.spectated ? "close-circle" : "arrow-left"
|
||||||
type: StatusListItem.Type.Danger
|
type: StatusListItem.Type.Danger
|
||||||
|
@ -49,7 +49,7 @@ StatusListView {
|
|||||||
size: StatusBaseButton.Size.Small
|
size: StatusBaseButton.Size.Small
|
||||||
type: StatusBaseButton.Type.Danger
|
type: StatusBaseButton.Type.Danger
|
||||||
borderColor: "transparent"
|
borderColor: "transparent"
|
||||||
enabled: !model.amISectionAdmin
|
enabled: model.memberRole !== Constants.memberRole.owner
|
||||||
text: model.spectated ? qsTr("Close Community") : qsTr("Leave Community")
|
text: model.spectated ? qsTr("Close Community") : qsTr("Leave Community")
|
||||||
onClicked: model.spectated ? root.closeCommunityClicked(model.id) : root.leaveCommunityClicked(model.name, model.id, model.outroMessage)
|
onClicked: model.spectated ? root.closeCommunityClicked(model.id) : root.leaveCommunityClicked(model.name, model.id, model.outroMessage)
|
||||||
},
|
},
|
||||||
|
@ -368,7 +368,7 @@ Item {
|
|||||||
|
|
||||||
StatusAction {
|
StatusAction {
|
||||||
id: leaveCommunityMenuItem
|
id: leaveCommunityMenuItem
|
||||||
enabled: !model.amISectionAdmin
|
enabled: model.memberRole !== Constants.memberRole.owner
|
||||||
text: {
|
text: {
|
||||||
if (model.spectated)
|
if (model.spectated)
|
||||||
return qsTr("Close Community")
|
return qsTr("Close Community")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user