Deleting the focused post now sends user to normal channel view (#6890)
Этот коммит содержится в:
коммит произвёл
Saturnino Abril
родитель
f1cf1b5f7a
Коммит
1e7022ff6d
@@ -14,6 +14,8 @@ import {sendDesktopNotification} from 'actions/notification_actions.jsx';
|
|||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
const ActionTypes = Constants.ActionTypes;
|
const ActionTypes = Constants.ActionTypes;
|
||||||
|
|
||||||
|
import {browserHistory} from 'react-router/es6';
|
||||||
|
|
||||||
// Redux actions
|
// Redux actions
|
||||||
import store from 'stores/redux_store.jsx';
|
import store from 'stores/redux_store.jsx';
|
||||||
const dispatch = store.dispatch;
|
const dispatch = store.dispatch;
|
||||||
@@ -236,6 +238,12 @@ export function deletePost(channelId, post, success) {
|
|||||||
data: post
|
data: post
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const {focusedPostId} = getState().views.channel;
|
||||||
|
const channel = getState().entities.channels.channels[post.channel_id];
|
||||||
|
if (post.id === focusedPostId && channel) {
|
||||||
|
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + channel.name);
|
||||||
|
}
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
success();
|
success();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,8 +62,20 @@ function loadingPosts(state = {}, action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function focusedPostId(state = '', action) {
|
||||||
|
switch (action.type) {
|
||||||
|
case ActionTypes.RECEIVED_FOCUSED_POST:
|
||||||
|
return action.data;
|
||||||
|
case ChannelTypes.SELECT_CHANNEL:
|
||||||
|
return '';
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default combineReducers({
|
export default combineReducers({
|
||||||
postVisibility,
|
postVisibility,
|
||||||
lastChannelViewTime,
|
lastChannelViewTime,
|
||||||
loadingPosts
|
loadingPosts,
|
||||||
|
focusedPostId
|
||||||
});
|
});
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user