Support room color in settings

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-11-04 16:10:25 -06:00
parent bb5f7bed85
commit 358298e4ee
4 changed files with 38 additions and 21 deletions

View file

@ -28,6 +28,13 @@ export default class RoomAccountSettingsHandler extends SettingsHandler {
return !content['disable'];
}
// Special case room color
if (settingName === "roomColor") {
// The event content should already be in an appropriate format, we just need
// to get the right value.
return this._getSettings(roomId, "org.matrix.room.color_scheme");
}
return this._getSettings(roomId)[settingName];
}
@ -39,6 +46,12 @@ export default class RoomAccountSettingsHandler extends SettingsHandler {
return MatrixClientPeg.get().setRoomAccountData(roomId, "org.matrix.room.preview_urls", content);
}
// Special case room color
if (settingName === "roomColor") {
// The new value should match our requirements, we just need to store it in the right place.
return MatrixClientPeg.get().setRoomAccountData(roomId, "org.matrix.room.color_scheme", newValue);
}
const content = this._getSettings(roomId);
content[settingName] = newValue;
return MatrixClientPeg.get().setRoomAccountData(roomId, "im.vector.web.settings", content);