summaryrefslogtreecommitdiffstats
path: root/webapp/components/rhs_thread.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-12-02 12:25:50 -0500
committerChristopher Speller <crspeller@gmail.com>2016-12-02 12:25:50 -0500
commit67c60d236d357680d3893d19fde43b305243d6a2 (patch)
tree7b6def5026badd4a41b5cb1c98ecbe6e92efc755 /webapp/components/rhs_thread.jsx
parentea26c72dad3bc1a2ccb020310b635bd6484a1b15 (diff)
downloadchat-67c60d236d357680d3893d19fde43b305243d6a2.tar.gz
chat-67c60d236d357680d3893d19fde43b305243d6a2.tar.bz2
chat-67c60d236d357680d3893d19fde43b305243d6a2.zip
Fix preview collapsing in RHS root post (#4677)
Diffstat (limited to 'webapp/components/rhs_thread.jsx')
-rw-r--r--webapp/components/rhs_thread.jsx16
1 files changed, 14 insertions, 2 deletions
diff --git a/webapp/components/rhs_thread.jsx b/webapp/components/rhs_thread.jsx
index a3266e9ba..0329d76b2 100644
--- a/webapp/components/rhs_thread.jsx
+++ b/webapp/components/rhs_thread.jsx
@@ -65,6 +65,7 @@ export default class RhsThread extends React.Component {
state.compactDisplay = PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.MESSAGE_DISPLAY, Preferences.MESSAGE_DISPLAY_DEFAULT) === Preferences.MESSAGE_DISPLAY_COMPACT;
state.flaggedPosts = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_FLAGGED_POST);
state.statuses = Object.assign({}, UserStore.getStatuses());
+ state.previewsCollapsed = PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.COLLAPSE_DISPLAY, 'false');
this.state = state;
}
@@ -130,6 +131,10 @@ export default class RhsThread extends React.Component {
return true;
}
+ if (nextState.previewsCollapsed !== this.state.previewsCollapsed) {
+ return true;
+ }
+
if (!Utils.areObjectsEqual(nextState.flaggedPosts, this.state.flaggedPosts)) {
return true;
}
@@ -162,10 +167,16 @@ export default class RhsThread extends React.Component {
});
}
- onPreferenceChange() {
+ onPreferenceChange(category) {
+ let previewSuffix = '';
+ if (category === Preferences.CATEGORY_DISPLAY_SETTINGS) {
+ previewSuffix = '_' + Utils.generateId();
+ }
+
this.setState({
compactDisplay: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.MESSAGE_DISPLAY, Preferences.MESSAGE_DISPLAY_DEFAULT) === Preferences.MESSAGE_DISPLAY_COMPACT,
- flaggedPosts: PreferenceStore.getCategory(Constants.Preferences.CATEGORY_FLAGGED_POST)
+ flaggedPosts: PreferenceStore.getCategory(Constants.Preferences.CATEGORY_FLAGGED_POST),
+ previewsCollapsed: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.COLLAPSE_DISPLAY, 'false') + previewSuffix
});
this.forceUpdateInfo();
}
@@ -300,6 +311,7 @@ export default class RhsThread extends React.Component {
useMilitaryTime={this.props.useMilitaryTime}
isFlagged={isRootFlagged}
status={rootStatus}
+ previewCollapsed={this.state.previewsCollapsed}
/>
<div className='post-right-comments-container'>
{postsArray.map((comPost) => {