mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fix multiple pinned post issues (#6887)
This commit is contained in:
committed by
Saturnino Abril
parent
2190a288e0
commit
0c910cc8c5
@@ -329,3 +329,23 @@ export function searchForTerm(term) {
|
||||
do_search: true
|
||||
});
|
||||
}
|
||||
|
||||
export function pinPost(postId) {
|
||||
return async (doDispatch, doGetState) => {
|
||||
await PostActions.pinPost(postId)(doDispatch, doGetState);
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_POST_PINNED
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function unpinPost(postId) {
|
||||
return async (doDispatch, doGetState) => {
|
||||
await PostActions.unpinPost(postId)(doDispatch, doGetState);
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_POST_UNPINNED
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
import {connect} from 'react-redux';
|
||||
import {bindActionCreators} from 'redux';
|
||||
import {flagPost, unflagPost, pinPost, unpinPost} from 'mattermost-redux/actions/posts';
|
||||
import {flagPost, unflagPost} from 'mattermost-redux/actions/posts';
|
||||
import {pinPost, unpinPost} from 'actions/post_actions.jsx';
|
||||
|
||||
import DotMenu from './dot_menu.jsx';
|
||||
|
||||
|
||||
@@ -77,12 +77,12 @@ export default class SidebarRight extends React.Component {
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
return !Utils.areObjectsEqual(nextState, this.state) || !Utils.areObjectsEqual(nextProps, this.props);
|
||||
return !Utils.areObjectsEqual(nextState, this.state) || this.props.postRightVisible !== nextProps.postRightVisible;
|
||||
}
|
||||
|
||||
componentWillUpdate(nextProps, nextState) {
|
||||
const isOpen = this.state.searchVisible || this.props.postRightVisible;
|
||||
const willOpen = nextState.searchVisible || nextState.postRightVisible;
|
||||
const willOpen = nextState.searchVisible || nextProps.postRightVisible;
|
||||
|
||||
if (!isOpen && willOpen) {
|
||||
trackEvent('ui', 'ui_rhs_opened');
|
||||
|
||||
Reference in New Issue
Block a user