MM-10826 Show error when viewing permalink for locally deleted post (#1870)

* MM-10826 Show error when viewing permalink for locally deleted post

* Don't hide current user's deleted posts
This commit is contained in:
Harrison Healey 2018-07-04 08:44:33 -04:00 committed by Elias Nahum
parent 1b549d3a51
commit d9eb29a724
2 changed files with 6 additions and 7 deletions

View file

@ -6,6 +6,7 @@ import {connect} from 'react-redux';
import {getChannel as getChannelAction, joinChannel, markChannelAsRead, markChannelAsViewed} from 'mattermost-redux/actions/channels';
import {getPostsAfter, getPostsBefore, getPostThread, selectPost} from 'mattermost-redux/actions/posts';
import {Posts} from 'mattermost-redux/constants';
import {makeGetChannel, getMyChannelMemberships} from 'mattermost-redux/selectors/entities/channels';
import {makeGetPostIdsAroundPost, getPost} from 'mattermost-redux/selectors/entities/posts';
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
@ -29,11 +30,13 @@ function makeMapStateToProps() {
return function mapStateToProps(state) {
const {currentFocusedPostId} = state.entities.posts;
const post = getPost(state, currentFocusedPostId);
const channel = post ? getChannel(state, {id: post.channel_id}) : null;
let channel;
let postIds;
if (channel && channel.id) {
postIds = getPostIdsAroundPost(state, currentFocusedPostId, channel.id, {
if (post && post.delete_at === 0 && post.state !== Posts.POST_DELETED) {
channel = getChannel(state, {id: post.channel_id});
postIds = getPostIdsAroundPost(state, currentFocusedPostId, post.channel_id, {
postsBeforeCount: 10,
postsAfterCount: 10,
});

View file

@ -47,10 +47,6 @@ export function makePreparePostIdsForPostList() {
continue;
}
if (post.state === Posts.POST_DELETED && post.user_id === currentUser.id) {
continue;
}
// Filter out join/leave messages if necessary
if (shouldFilterJoinLeavePost(post, showJoinLeave, currentUser.username)) {
continue;