Settings/Communities: fix duplicate entries
in case a community is both `spectated` and `joined` Fixes #11301
This commit is contained in:
parent
e35945b76c
commit
6d6cb7a7a7
|
@ -47,6 +47,7 @@ StatusListView {
|
||||||
|
|
||||||
onClicked: setActiveCommunityClicked(model.id)
|
onClicked: setActiveCommunityClicked(model.id)
|
||||||
|
|
||||||
|
readonly property bool isSpectator: model.spectated && !model.joined
|
||||||
readonly property bool isOwner: model.memberRole === Constants.memberRole.owner
|
readonly property bool isOwner: model.memberRole === Constants.memberRole.owner
|
||||||
readonly property bool isAdmin: model.memberRole === Constants.memberRole.admin
|
readonly property bool isAdmin: model.memberRole === Constants.memberRole.admin
|
||||||
readonly property bool isInvitationPending: root.rootStore.isCommunityRequestPending(model.id)
|
readonly property bool isInvitationPending: root.rootStore.isCommunityRequestPending(model.id)
|
||||||
|
@ -64,7 +65,7 @@ StatusListView {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
size: StatusBaseButton.Size.Small
|
size: StatusBaseButton.Size.Small
|
||||||
text: listItem.isInvitationPending ? qsTr("Membership Request Sent") : qsTr("View & Join Community")
|
text: listItem.isInvitationPending ? qsTr("Membership Request Sent") : qsTr("View & Join Community")
|
||||||
visible: model.spectated
|
visible: listItem.isSpectator
|
||||||
onClicked: root.showCommunityIntroDialog(model.id, model.name, model.introMessage, model.image, model.access)
|
onClicked: root.showCommunityIntroDialog(model.id, model.name, model.introMessage, model.image, model.access)
|
||||||
},
|
},
|
||||||
StatusFlatButton {
|
StatusFlatButton {
|
||||||
|
@ -98,7 +99,7 @@ StatusListView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MuteChatMenuItem {
|
MuteChatMenuItem {
|
||||||
enabled: (model.joined || (model.spectated && !listItem.isInvitationPending)) && !model.muted
|
enabled: (model.joined || (listItem.isSpectator && !listItem.isInvitationPending)) && !model.muted
|
||||||
title: qsTr("Mute Community")
|
title: qsTr("Mute Community")
|
||||||
onMuteTriggered: {
|
onMuteTriggered: {
|
||||||
moreMenu.close()
|
moreMenu.close()
|
||||||
|
@ -120,7 +121,7 @@ StatusListView {
|
||||||
enabled: {
|
enabled: {
|
||||||
if (listItem.isOwner)
|
if (listItem.isOwner)
|
||||||
return false
|
return false
|
||||||
if (model.spectated && !listItem.isInvitationPending)
|
if (listItem.isSpectator && !listItem.isInvitationPending)
|
||||||
return false
|
return false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -139,12 +140,12 @@ StatusListView {
|
||||||
text: {
|
text: {
|
||||||
if (listItem.isInvitationPending)
|
if (listItem.isInvitationPending)
|
||||||
return qsTr("Cancel Membership Request")
|
return qsTr("Cancel Membership Request")
|
||||||
return model.spectated ? qsTr("Close Community") : qsTr("Leave Community")
|
return listItem.isSpectator ? qsTr("Close Community") : qsTr("Leave Community")
|
||||||
}
|
}
|
||||||
icon.name: {
|
icon.name: {
|
||||||
if (listItem.isInvitationPending)
|
if (listItem.isInvitationPending)
|
||||||
return "arrow-left"
|
return "arrow-left"
|
||||||
return model.spectated ? "close-circle" : "arrow-left"
|
return listItem.isSpectator ? "close-circle" : "arrow-left"
|
||||||
}
|
}
|
||||||
type: StatusAction.Type.Danger
|
type: StatusAction.Type.Danger
|
||||||
enabled: !listItem.isOwner
|
enabled: !listItem.isOwner
|
||||||
|
@ -152,7 +153,7 @@ StatusListView {
|
||||||
moreMenu.close()
|
moreMenu.close()
|
||||||
if (listItem.isInvitationPending)
|
if (listItem.isInvitationPending)
|
||||||
root.cancelMembershipRequest(model.id)
|
root.cancelMembershipRequest(model.id)
|
||||||
else if (model.spectated)
|
else if (listItem.isSpectator)
|
||||||
root.closeCommunityClicked(model.id)
|
root.closeCommunityClicked(model.id)
|
||||||
else
|
else
|
||||||
root.leaveCommunityClicked(model.name, model.id, model.outroMessage)
|
root.leaveCommunityClicked(model.name, model.id, model.outroMessage)
|
||||||
|
|
|
@ -139,9 +139,8 @@ SettingsContentBase {
|
||||||
|
|
||||||
Panel {
|
Panel {
|
||||||
id: panelPendingRequests
|
id: panelPendingRequests
|
||||||
filters: ValueFilter {
|
filters: ExpressionFilter {
|
||||||
roleName: "spectated"
|
expression: model.spectated && !model.joined
|
||||||
value: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue