Implement changing join rules

This commit is contained in:
Tobias Fella
2022-11-16 02:49:40 +01:00
parent 1946228d2b
commit 752e7f4d9a
3 changed files with 37 additions and 5 deletions

View File

@@ -24,7 +24,10 @@ Kirigami.ScrollablePage {
text: i18nc("@option:check", "Private (invite only)")
Kirigami.FormData.label: i18nc("@option:check", "Access:")
checked: room.joinRule === "invite"
enabled: false
enabled: room.canSendState("m.room.join_rules")
onCheckedChanged: if (checked) {
room.joinRule = "invite";
}
}
QQC2.Label {
text: i18n("Only invited people can join.")
@@ -33,19 +36,32 @@ Kirigami.ScrollablePage {
QQC2.RadioButton {
text: i18nc("@option:check", "Space members")
checked: room.joinRule === "restricted"
enabled: false
enabled: room.canSendState("m.room.join_rules") && ["8", "9", "10"].includes(room.version) && false
onCheckedChanged: if (checked) {
room.joinRule = "restricted";
}
}
QQC2.Label {
text: i18n("Anyone in a space can find and join.")
wrapMode: Qt.Wrap
width: root.width
font: Kirigami.Theme.smallFont
}
QQC2.Label {
font: Kirigami.Theme.smallFont
visible: !["8", "9", "10"].includes(room.version)
text: i18n("You need to upgrade this room to a newer version to enable this setting.")
}
QQC2.RadioButton {
text: i18nc("@option:check", "Public")
checked: room.joinRule === "public"
enabled: false
enabled: room.canSendState("m.room.join_rules")
onCheckedChanged: if (checked) {
room.joinRule = "public";
}
}
QQC2.Label {
text: i18nc("@option:check", "Anyone can find and join.") + room.joinRule
text: i18nc("@option:check", "Anyone can find and join.")
font: Kirigami.Theme.smallFont
}
}