Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 419857c

Browse files
Merge pull request #4647 from JorikSchellekens/joriks/fix-filepanel-regression
Fix FilePanel and NotificationsPanel regression
2 parents 6472ca4 + b61f170 commit 419857c

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

res/css/structures/_NotificationPanel.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ limitations under the License.
6363
padding-left: 32px;
6464
padding-top: 8px;
6565
position: relative;
66+
67+
a {
68+
display: flex;
69+
}
6670
}
6771

6872
.mx_NotificationPanel .mx_EventTile_roomName a,

src/components/structures/MessagePanel.js

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ export default class MessagePanel extends React.Component {
108108

109109
// whether to show reactions for an event
110110
showReactions: PropTypes.bool,
111+
112+
// whether to use the irc layout
113+
useIRCLayout: PropTypes.bool,
111114
};
112115

113116
// Force props to be loaded for useIRCLayout
@@ -119,7 +122,6 @@ export default class MessagePanel extends React.Component {
119122
// display 'ghost' read markers that are animating away
120123
ghostReadMarkers: [],
121124
showTypingNotifications: SettingsStore.getValue("showTypingNotifications"),
122-
useIRCLayout: this.useIRCLayout(SettingsStore.getValue("feature_irc_ui")),
123125
};
124126

125127
// opaque readreceipt info for each userId; used by ReadReceiptMarker
@@ -172,8 +174,6 @@ export default class MessagePanel extends React.Component {
172174

173175
this._showTypingNotificationsWatcherRef =
174176
SettingsStore.watchSetting("showTypingNotifications", null, this.onShowTypingNotificationsChange);
175-
176-
this._layoutWatcherRef = SettingsStore.watchSetting("feature_irc_ui", null, this.onLayoutChange);
177177
}
178178

179179
componentDidMount() {
@@ -183,7 +183,6 @@ export default class MessagePanel extends React.Component {
183183
componentWillUnmount() {
184184
this._isMounted = false;
185185
SettingsStore.unwatchSetting(this._showTypingNotificationsWatcherRef);
186-
SettingsStore.unwatchSetting(this._layoutWatcherRef);
187186
}
188187

189188
componentDidUpdate(prevProps, prevState) {
@@ -202,17 +201,6 @@ export default class MessagePanel extends React.Component {
202201
});
203202
};
204203

205-
onLayoutChange = () => {
206-
this.setState({
207-
useIRCLayout: this.useIRCLayout(SettingsStore.getValue("feature_irc_ui")),
208-
});
209-
}
210-
211-
useIRCLayout(ircLayoutSelected) {
212-
// if room is null we are not in a normal room list
213-
return ircLayoutSelected && this.props.room;
214-
}
215-
216204
/* get the DOM node representing the given event */
217205
getNodeForEventId(eventId) {
218206
if (!this.eventNodes) {
@@ -614,7 +602,7 @@ export default class MessagePanel extends React.Component {
614602
isSelectedEvent={highlight}
615603
getRelationsForEvent={this.props.getRelationsForEvent}
616604
showReactions={this.props.showReactions}
617-
useIRCLayout={this.state.useIRCLayout}
605+
useIRCLayout={this.props.useIRCLayout}
618606
/>
619607
</TileErrorBoundary>
620608
</li>,
@@ -797,8 +785,6 @@ export default class MessagePanel extends React.Component {
797785
this.props.className,
798786
{
799787
"mx_MessagePanel_alwaysShowTimestamps": this.props.alwaysShowTimestamps,
800-
"mx_IRCLayout": this.state.useIRCLayout,
801-
"mx_GroupLayout": !this.state.useIRCLayout,
802788
},
803789
);
804790

src/components/structures/RoomView.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ export default createReactClass({
165165
canReact: false,
166166
canReply: false,
167167

168+
useIRCLayout: SettingsStore.getValue("feature_irc_ui"),
169+
168170
matrixClientIsReady: this.context && this.context.isInitialSyncComplete(),
169171
};
170172
},
@@ -195,6 +197,8 @@ export default createReactClass({
195197

196198
this._roomView = createRef();
197199
this._searchResultsPanel = createRef();
200+
201+
this._layoutWatcherRef = SettingsStore.watchSetting("feature_irc_ui", null, this.onLayoutChange);
198202
},
199203

200204
_onReadReceiptsChange: function() {
@@ -535,6 +539,14 @@ export default createReactClass({
535539
// no need to do this as Dir & Settings are now overlays. It just burnt CPU.
536540
// console.log("Tinter.tint from RoomView.unmount");
537541
// Tinter.tint(); // reset colourscheme
542+
543+
SettingsStore.unwatchSetting(this._layoutWatcherRef);
544+
},
545+
546+
onLayoutChange: function() {
547+
this.setState({
548+
useIRCLayout: SettingsStore.getValue("feature_irc_ui"),
549+
});
538550
},
539551

540552
_onRightPanelStoreUpdate: function() {
@@ -1996,6 +2008,13 @@ export default createReactClass({
19962008
highlightedEventId = this.state.initialEventId;
19972009
}
19982010

2011+
const messagePanelClassNames = classNames(
2012+
"mx_RoomView_messagePanel",
2013+
{
2014+
"mx_IRCLayout": this.state.useIRCLayout,
2015+
"mx_GroupLayout": !this.state.useIRCLayout,
2016+
});
2017+
19992018
// console.info("ShowUrlPreview for %s is %s", this.state.room.roomId, this.state.showUrlPreview);
20002019
const messagePanel = (
20012020
<TimelinePanel
@@ -2011,11 +2030,12 @@ export default createReactClass({
20112030
onScroll={this.onMessageListScroll}
20122031
onReadMarkerUpdated={this._updateTopUnreadMessagesBar}
20132032
showUrlPreview = {this.state.showUrlPreview}
2014-
className="mx_RoomView_messagePanel"
2033+
className={messagePanelClassNames}
20152034
membersLoaded={this.state.membersLoaded}
20162035
permalinkCreator={this._getPermalinkCreatorForRoom(this.state.room)}
20172036
resizeNotifier={this.props.resizeNotifier}
20182037
showReactions={true}
2038+
useIRCLayout={this.state.useIRCLayout}
20192039
/>);
20202040

20212041
let topUnreadMessagesBar = null;

src/components/structures/TimelinePanel.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ const TimelinePanel = createReactClass({
112112

113113
// whether to show reactions for an event
114114
showReactions: PropTypes.bool,
115+
116+
// whether to use the irc layout
117+
useIRCLayout: PropTypes.bool,
115118
},
116119

117120
statics: {
@@ -1447,6 +1450,7 @@ const TimelinePanel = createReactClass({
14471450
getRelationsForEvent={this.getRelationsForEvent}
14481451
editState={this.state.editState}
14491452
showReactions={this.props.showReactions}
1453+
useIRCLayout={this.props.useIRCLayout}
14501454
/>
14511455
);
14521456
},

0 commit comments

Comments
 (0)