[Room] Fix get send event permissions

This commit is contained in:
Christian Pauly 2020-01-05 08:15:25 +00:00
parent 1b057d602f
commit fa277f1834

View file

@ -879,7 +879,7 @@ class Room {
bool _hasPermissionFor(String action) { bool _hasPermissionFor(String action) {
if (getState("m.room.power_levels") == null || if (getState("m.room.power_levels") == null ||
getState("m.room.power_levels").content[action] == null) return false; getState("m.room.power_levels").content[action] == null) return true;
return ownPowerLevel >= getState("m.room.power_levels").content[action]; return ownPowerLevel >= getState("m.room.power_levels").content[action];
} }
@ -904,7 +904,7 @@ class Room {
bool get canChangePowerLevel => canSendEvent("m.room.power_levels"); bool get canChangePowerLevel => canSendEvent("m.room.power_levels");
bool canSendEvent(String eventType) { bool canSendEvent(String eventType) {
if (getState("m.room.power_levels") == null) return false; if (getState("m.room.power_levels") == null) return true;
if (getState("m.room.power_levels").content["events"] == null || if (getState("m.room.power_levels").content["events"] == null ||
getState("m.room.power_levels").content["events"][eventType] == null) { getState("m.room.power_levels").content["events"][eventType] == null) {
return eventType == "m.room.message" return eventType == "m.room.message"