From 4b3c86595949b49ba278938ad18e038e2178d3ec Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Mon, 22 Oct 2018 23:07:41 -0500 Subject: [PATCH 1/3] lint: make colorScheme camel case Signed-off-by: Aaron Raimist --- src/components/structures/MatrixChat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index f385aacd40..dce1ac698d 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -1406,8 +1406,8 @@ export default React.createClass({ // Fire the tinter right on startup to ensure the default theme is applied // A later sync can/will correct the tint to be the right value for the user - const color_scheme = SettingsStore.getValue("roomColor"); - Tinter.tint(color_scheme.primary_color, color_scheme.secondary_color); + const colorScheme = SettingsStore.getValue("roomColor"); + Tinter.tint(colorScheme.primary_color, colorScheme.secondary_color); }, /** From cb033bcaddb08e649b2f3de804c992e7dca6ca2f Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Mon, 22 Oct 2018 23:15:28 -0500 Subject: [PATCH 2/3] Why not change it everywhere while we're at it Signed-off-by: Aaron Raimist --- src/components/structures/RoomView.js | 10 +++++----- src/settings/handlers/RoomAccountSettingsHandler.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 54f51c7a71..5bf6146525 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -678,8 +678,8 @@ module.exports = React.createClass({ if (!room) return; console.log("Tinter.tint from updateTint"); - const color_scheme = SettingsStore.getValue("roomColor", room.roomId); - Tinter.tint(color_scheme.primary_color, color_scheme.secondary_color); + const colorScheme = SettingsStore.getValue("roomColor", room.roomId); + Tinter.tint(colorScheme.primary_color, colorScheme.secondary_color); }, onAccountData: function(event) { @@ -693,11 +693,11 @@ module.exports = React.createClass({ onRoomAccountData: function(event, room) { if (room.roomId == this.state.roomId) { const type = event.getType(); - if (type === "org.matrix.room.color_scheme") { - const color_scheme = event.getContent(); + if (type === "org.matrix.room.colorScheme") { + const colorScheme = event.getContent(); // XXX: we should validate the event console.log("Tinter.tint from onRoomAccountData"); - Tinter.tint(color_scheme.primary_color, color_scheme.secondary_color); + Tinter.tint(colorScheme.primary_color, colorScheme.secondary_color); } else if (type === "org.matrix.room.preview_urls" || type === "im.vector.web.settings") { // non-e2ee url previews are stored in legacy event type `org.matrix.room.preview_urls` this._updatePreviewUrlVisibility(room); diff --git a/src/settings/handlers/RoomAccountSettingsHandler.js b/src/settings/handlers/RoomAccountSettingsHandler.js index d0dadc2de7..ae8fb79297 100644 --- a/src/settings/handlers/RoomAccountSettingsHandler.js +++ b/src/settings/handlers/RoomAccountSettingsHandler.js @@ -36,7 +36,7 @@ export default class RoomAccountSettingsHandler extends SettingsHandler { // The event content should already be in an appropriate format, we just need // to get the right value. // don't fallback to {} because thats truthy and would imply there is an event specifying tint - return this._getSettings(roomId, "org.matrix.room.color_scheme"); + return this._getSettings(roomId, "org.matrix.room.colorScheme"); } const settings = this._getSettings(roomId) || {}; @@ -54,7 +54,7 @@ export default class RoomAccountSettingsHandler extends SettingsHandler { // 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); + return MatrixClientPeg.get().setRoomAccountData(roomId, "org.matrix.room.colorScheme", newValue); } const content = this._getSettings(roomId) || {}; From 1aa308595859469cd592a7166c1ac1c37f23c059 Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Mon, 22 Oct 2018 23:33:33 -0500 Subject: [PATCH 3/3] Oh right, can't change these Signed-off-by: Aaron Raimist --- src/components/structures/RoomView.js | 2 +- src/settings/handlers/RoomAccountSettingsHandler.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 5bf6146525..e20ac54006 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -693,7 +693,7 @@ module.exports = React.createClass({ onRoomAccountData: function(event, room) { if (room.roomId == this.state.roomId) { const type = event.getType(); - if (type === "org.matrix.room.colorScheme") { + if (type === "org.matrix.room.color_scheme") { const colorScheme = event.getContent(); // XXX: we should validate the event console.log("Tinter.tint from onRoomAccountData"); diff --git a/src/settings/handlers/RoomAccountSettingsHandler.js b/src/settings/handlers/RoomAccountSettingsHandler.js index ae8fb79297..d0dadc2de7 100644 --- a/src/settings/handlers/RoomAccountSettingsHandler.js +++ b/src/settings/handlers/RoomAccountSettingsHandler.js @@ -36,7 +36,7 @@ export default class RoomAccountSettingsHandler extends SettingsHandler { // The event content should already be in an appropriate format, we just need // to get the right value. // don't fallback to {} because thats truthy and would imply there is an event specifying tint - return this._getSettings(roomId, "org.matrix.room.colorScheme"); + return this._getSettings(roomId, "org.matrix.room.color_scheme"); } const settings = this._getSettings(roomId) || {}; @@ -54,7 +54,7 @@ export default class RoomAccountSettingsHandler extends SettingsHandler { // 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.colorScheme", newValue); + return MatrixClientPeg.get().setRoomAccountData(roomId, "org.matrix.room.color_scheme", newValue); } const content = this._getSettings(roomId) || {};