From 1c0c3c46958f06cd4cf4ef9d8fec956883f81157 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 20 Mar 2020 09:29:59 +0000 Subject: [PATCH] Watch for show-RR settings changes, use room-specific and fix margins Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- res/css/views/rooms/_EventTile.scss | 9 +++++++-- src/components/structures/RoomView.js | 29 +++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/res/css/views/rooms/_EventTile.scss b/res/css/views/rooms/_EventTile.scss index d292c729dd..2fa9994155 100644 --- a/res/css/views/rooms/_EventTile.scss +++ b/res/css/views/rooms/_EventTile.scss @@ -112,8 +112,6 @@ limitations under the License. .mx_EventTile_line, .mx_EventTile_reply { position: relative; - /* ideally should be 100px, but 95px gives us a max thumbnail size of 800x600, which is nice */ - margin-right: 110px; padding-left: 65px; /* left gutter */ padding-top: 4px; padding-bottom: 2px; @@ -122,6 +120,13 @@ limitations under the License. line-height: 22px; } +.mx_RoomView_timeline_rr_enabled { + .mx_EventTile_line, .mx_EventTile_reply { + /* ideally should be 100px, but 95px gives us a max thumbnail size of 800x600, which is nice */ + margin-right: 110px; + } +} + .mx_EventTile_bubbleContainer { display: grid; grid-template-columns: 1fr 100px; diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 17a496b037..78f32cf63e 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -131,6 +131,7 @@ export default createReactClass({ isAlone: false, isPeeking: false, showingPinned: false, + showReadReceipts: true, // error object, as from the matrix client/server API // If we failed to load information about the room, @@ -179,11 +180,19 @@ export default createReactClass({ this._onRoomViewStoreUpdate(true); WidgetEchoStore.on('update', this._onWidgetEchoStoreUpdate); + this._showReadReceiptsWatchRef = SettingsStore.watchSetting("showReadReceipts", null, + this._onReadReceiptsChange); this._roomView = createRef(); this._searchResultsPanel = createRef(); }, + _onReadReceiptsChange: function() { + this.setState({ + showReadReceipts: SettingsStore.getValue("showReadReceipts", this.state.roomId), + }); + }, + _onRoomViewStoreUpdate: function(initial) { if (this.unmounted) { return; @@ -204,8 +213,10 @@ export default createReactClass({ return; } + const roomId = RoomViewStore.getRoomId(); + const newState = { - roomId: RoomViewStore.getRoomId(), + roomId, roomAlias: RoomViewStore.getRoomAlias(), roomLoading: RoomViewStore.isRoomLoading(), roomLoadError: RoomViewStore.getRoomLoadError(), @@ -214,7 +225,8 @@ export default createReactClass({ isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(), forwardingEvent: RoomViewStore.getForwardingEvent(), shouldPeek: RoomViewStore.shouldPeek(), - showingPinned: SettingsStore.getValue("PinnedEvents.isOpen", RoomViewStore.getRoomId()), + showingPinned: SettingsStore.getValue("PinnedEvents.isOpen", roomId), + showReadReceipts: SettingsStore.getValue("showReadReceipts", roomId), }; // Temporary logging to diagnose https://github.com/vector-im/riot-web/issues/4307 @@ -491,6 +503,11 @@ export default createReactClass({ WidgetEchoStore.removeListener('update', this._onWidgetEchoStoreUpdate); + if (this._showReadReceiptsWatchRef) { + SettingsStore.unwatchSetting(this._showReadReceiptsWatchRef); + this._showReadReceiptsWatchRef = null; + } + // cancel any pending calls to the rate_limited_funcs this._updateRoomMembers.cancelPendingCall(); @@ -1948,7 +1965,7 @@ export default createReactClass({