Implement new "read only" room flag

While still maintaining the ability to answer polls and send reactions in channels (when "read only" is false)
This commit is contained in:
N-Pex 2024-04-26 16:44:06 +02:00
parent 1e31b0c24e
commit 371a5069af
10 changed files with 112 additions and 68 deletions

View file

@ -46,6 +46,7 @@ import InteractiveAuth from './InteractiveAuth.vue';
import util, { ROOM_TYPE_CHANNEL } from "../plugins/utils";
import YouAre from "../components/YouAre.vue";
import User from "../models/user";
import { CHANNEL_POWER_LEVELS } from "../services/matrix.service";
export default {
name: "CreateChannel",
@ -194,16 +195,10 @@ export default {
powerLevels[this.$matrix.currentUserId] = 100;
let powerLevelContent = {
users: powerLevels,
events_default: 50
events_default: 50,
state_default: 50,
events: CHANNEL_POWER_LEVELS
}
powerLevelContent.events = {
"m.room.encrypted": 0, // NOTE! Since practically all events in encrypted rooms get sent as "m.room.encrypted" we need to set
// power to 0 here. Otherwise we would not be able to send quick reactions or poll responses...
"m.poll.response": 0,
"org.matrix.msc3381.poll.response": 0,
"m.reaction": 0,
"m.room.redaction": 0,
};
createRoomOptions.initial_state.push(
{
type: "m.room.power_levels",