Experimental "read only" room support
This commit is contained in:
parent
490c436e09
commit
0b84bf3caa
8 changed files with 169 additions and 17 deletions
|
|
@ -165,9 +165,9 @@
|
|||
</v-card-text>
|
||||
</v-card>
|
||||
|
||||
<v-card class="account ma-3" flat v-if="$config.experimental_voice_mode">
|
||||
<v-card class="account ma-3" flat v-if="$config.experimental_voice_mode || canChangeReadOnly()">
|
||||
<v-card-title class="h2 with-right-label"><div>{{ $t("room_info.experimental_features") }}</div><div></div></v-card-title>
|
||||
<v-card-text class="with-right-label">
|
||||
<v-card-text class="with-right-label" v-if="$config.experimental_voice_mode">
|
||||
<div>
|
||||
<div class="option-title">{{ $t('room_info.voice_mode') }}</div>
|
||||
<div class="option-text">{{ $t('room_info.voice_mode_info') }}</div>
|
||||
|
|
@ -176,6 +176,15 @@
|
|||
v-model="useVoiceMode"
|
||||
></v-switch>
|
||||
</v-card-text>
|
||||
<v-card-text class="with-right-label" v-if="canChangeReadOnly()">
|
||||
<div>
|
||||
<div class="option-title">{{ $t('room_info.read_only_room') }}</div>
|
||||
<div class="option-text">{{ $t('room_info.read_only_room_info') }}</div>
|
||||
</div>
|
||||
<v-switch
|
||||
v-model="readOnlyRoom"
|
||||
></v-switch>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
|
||||
<v-card class="members ma-3" flat>
|
||||
|
|
@ -389,6 +398,14 @@ export default {
|
|||
this.$matrix.matrixClient.setRoomTag(this.room.roomId, "ui_options", options);
|
||||
}
|
||||
},
|
||||
},
|
||||
readOnlyRoom: {
|
||||
get: function () {
|
||||
return this.$matrix.isReadOnlyRoom(this.room.roomId);
|
||||
},
|
||||
set: function (readOnly) {
|
||||
this.$matrix.setReadOnlyRoom(this.room.roomId, readOnly);
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -591,6 +608,16 @@ export default {
|
|||
}
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* Return true if we can change power levels in the room, i.e. make read only room
|
||||
*/
|
||||
canChangeReadOnly() {
|
||||
if (!this.$config.experimental_read_only_room) { return false; }
|
||||
if (this.room) {
|
||||
return this.room.currentState && this.room.currentState.maySendStateEvent("m.room.power_levels", this.$matrix.currentUserId);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// TODO - following power level comparisons assume that default power levels are used in the room!
|
||||
isAdmin(member) {
|
||||
return member.powerLevelNorm > 50;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue