Fix preview collapsing in RHS root post (#4677)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
ea26c72dad
Коммит
67c60d236d
@@ -59,6 +59,10 @@ export default class RhsRootPost extends React.Component {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nextProps.previewCollapsed !== this.props.previewCollapsed) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Utils.areObjectsEqual(nextProps.post, this.props.post)) {
|
if (!Utils.areObjectsEqual(nextProps.post, this.props.post)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -388,6 +392,7 @@ export default class RhsRootPost extends React.Component {
|
|||||||
<PostBodyAdditionalContent
|
<PostBodyAdditionalContent
|
||||||
post={post}
|
post={post}
|
||||||
message={messageWrapper}
|
message={messageWrapper}
|
||||||
|
previewCollapsed={this.props.previewCollapsed}
|
||||||
/>
|
/>
|
||||||
{fileAttachment}
|
{fileAttachment}
|
||||||
<ReactionListContainer
|
<ReactionListContainer
|
||||||
@@ -413,5 +418,6 @@ RhsRootPost.propTypes = {
|
|||||||
compactDisplay: React.PropTypes.bool,
|
compactDisplay: React.PropTypes.bool,
|
||||||
useMilitaryTime: React.PropTypes.bool.isRequired,
|
useMilitaryTime: React.PropTypes.bool.isRequired,
|
||||||
isFlagged: React.PropTypes.bool,
|
isFlagged: React.PropTypes.bool,
|
||||||
status: React.PropTypes.string
|
status: React.PropTypes.string,
|
||||||
|
previewCollapsed: React.PropTypes.string
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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.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.flaggedPosts = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_FLAGGED_POST);
|
||||||
state.statuses = Object.assign({}, UserStore.getStatuses());
|
state.statuses = Object.assign({}, UserStore.getStatuses());
|
||||||
|
state.previewsCollapsed = PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.COLLAPSE_DISPLAY, 'false');
|
||||||
|
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
@@ -130,6 +131,10 @@ export default class RhsThread extends React.Component {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nextState.previewsCollapsed !== this.state.previewsCollapsed) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Utils.areObjectsEqual(nextState.flaggedPosts, this.state.flaggedPosts)) {
|
if (!Utils.areObjectsEqual(nextState.flaggedPosts, this.state.flaggedPosts)) {
|
||||||
return true;
|
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({
|
this.setState({
|
||||||
compactDisplay: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.MESSAGE_DISPLAY, Preferences.MESSAGE_DISPLAY_DEFAULT) === Preferences.MESSAGE_DISPLAY_COMPACT,
|
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();
|
this.forceUpdateInfo();
|
||||||
}
|
}
|
||||||
@@ -300,6 +311,7 @@ export default class RhsThread extends React.Component {
|
|||||||
useMilitaryTime={this.props.useMilitaryTime}
|
useMilitaryTime={this.props.useMilitaryTime}
|
||||||
isFlagged={isRootFlagged}
|
isFlagged={isRootFlagged}
|
||||||
status={rootStatus}
|
status={rootStatus}
|
||||||
|
previewCollapsed={this.state.previewsCollapsed}
|
||||||
/>
|
/>
|
||||||
<div className='post-right-comments-container'>
|
<div className='post-right-comments-container'>
|
||||||
{postsArray.map((comPost) => {
|
{postsArray.map((comPost) => {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user