Allow poll answers and quick reactions on read only room

This commit is contained in:
N-Pex 2024-02-13 12:13:34 +01:00
parent 60d536062b
commit cd2640a85a
4 changed files with 26 additions and 7 deletions

View file

@ -477,14 +477,25 @@ export default {
// Set power level event. Need to do that here, because we might not have the userId when the options object is created.
const powerLevels = {};
powerLevels[this.$matrix.currentUserId] = 100;
let powerLevelContent = {
users: powerLevels,
events_default: this.readOnlyRoom ? 50 : 0
}
if (this.readOnlyRoom) {
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",
state_key: "",
content: {
users: powerLevels,
events_default: this.readOnlyRoom ? 50 : 0
}
content: powerLevelContent
});
return this.$matrix.matrixClient