Don't allow changing the power level for users with a power level higher or equal to ours

The server won't allow it anyway
This commit is contained in:
Tobias Fella
2023-11-11 18:36:33 +01:00
parent bbb0bc3092
commit 2d55dca508

View File

@@ -50,7 +50,8 @@ FormCard.FormCardPage {
contentItem.children: RowLayout {
spacing: Kirigami.Units.largeSpacing
QQC2.Label {
visible: !room.canSendState("m.room.power_levels")
id: powerLevelLabel
visible: !room.canSendState("m.room.power_levels") || (room.getUserPowerLevel(room.localUser.id) <= model.powerLevel && model.userId != room.localUser.id)
text: powerLevelString
color: Kirigami.Theme.disabledTextColor
}
@@ -59,7 +60,7 @@ FormCard.FormCardPage {
model: powerLevelModel
textRole: "text"
valueRole: "powerLevel"
visible: room.canSendState("m.room.power_levels")
visible: !powerLevelLabel.visible
Component.onCompleted: {
/**
* This is very silly but the only way to populate the model with