fix: hide kick and ban options for non-admin users

fixes #2515
This commit is contained in:
Richard Ramos 2021-05-24 11:11:52 -04:00 committed by Iuri Matias
parent f6302928de
commit a79400e023
2 changed files with 13 additions and 2 deletions

View File

@ -155,9 +155,12 @@ ModalPopup {
icon.height: 16
//% "Roles"
text: qsTrId("roles")
enabled: chatsModel.communities.activeCommunity.admin
onTriggered: console.log("TODO")
}
Separator {}
Separator {
visible: chatsModel.communities.activeCommunity.admin
}
Action {
icon.source: "../../../img/communities/menu/kick.svg"
icon.width: 16
@ -165,6 +168,7 @@ ModalPopup {
icon.color: Style.current.red
//% "Kick"
text: qsTrId("kick")
enabled: chatsModel.communities.activeCommunity.admin
onTriggered: chatsModel.communities.removeUserFromCommunity(model.pubKey)
}
Action {
@ -174,9 +178,12 @@ ModalPopup {
icon.color: Style.current.red
//% "Ban"
text: qsTrId("ban")
enabled: chatsModel.communities.activeCommunity.admin
onTriggered: console.log("TODO")
}
Separator {}
Separator {
visible: chatsModel.communities.activeCommunity.admin
}
Action {
icon.source: "../../../img/communities/menu/transfer-ownership.svg"
icon.width: 16
@ -184,6 +191,7 @@ ModalPopup {
icon.color: Style.current.red
//% "Transfer ownership"
text: qsTrId("transfer-ownership")
enabled: chatsModel.communities.activeCommunity.admin
onTriggered: console.log("TODO")
}
}

View File

@ -152,6 +152,7 @@ Item {
/* } */
Separator {
height: 10
visible: chatsModel.communities.activeCommunity.admin
}
Action {
property string type: "danger"
@ -161,6 +162,7 @@ Item {
icon.color: Style.current.red
//% "Kick"
text: qsTrId("kick")
enabled: chatsModel.communities.activeCommunity.admin
onTriggered: chatsModel.communities.removeUserFromCommunity(model.pubKey)
}
Action {
@ -171,6 +173,7 @@ Item {
icon.color: Style.current.red
//% "Ban"
text: qsTrId("ban")
enabled: chatsModel.communities.activeCommunity.admin
onTriggered: chatsModel.communities.banUserFromCommunity(model.pubKey, chatsModel.communities.activeCommunity.id)
}
/* Separator {} */