Fix posts in thread (#1572)

* Fix posts in thread

* include postsInThread in initial state
This commit is contained in:
Elias Nahum 2018-04-05 23:13:07 +03:00 committed by GitHub
parent 369a4e4892
commit 78d223b611
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View file

@ -40,6 +40,7 @@ const state = {
posts: {
posts: {},
postsInChannel: {},
postsInThread: {},
selectedPostId: '',
currentFocusedPostId: '',
},

View file

@ -105,11 +105,6 @@ function resetStateForNewVersion(action) {
i18n = payload.views.i18n;
}
let fetchCache = initialState.views.fetchCache;
if (payload.views.fetchCache) {
fetchCache = payload.views.fetchCache;
}
let lastTeamId = initialState.views.team.lastTeamId;
if (payload.views.team && payload.views.team.lastTeamId) {
lastTeamId = payload.views.team.lastTeamId;
@ -147,7 +142,6 @@ function resetStateForNewVersion(action) {
drafts: channelDrafts,
},
i18n,
fetchCache,
team: {
lastTeamId,
lastChannelForTeam,
@ -190,6 +184,7 @@ function cleanupState(action, keepCurrent = false) {
posts: {
posts: {},
postsInChannel: {},
postsInThread: {},
reactions: {},
openGraph: payload.entities.posts.openGraph,
selectedPostId: payload.entities.posts.selectedPostId,
@ -262,6 +257,11 @@ function cleanupState(action, keepCurrent = false) {
nextEntitites.files.files[fileId] = payload.entities.files.files[fileId];
});
}
const postsInThread = payload.entities.posts.postsInThread[postId];
if (postsInThread) {
nextEntitites.posts.postsInThread[postId] = postsInThread;
}
} else {
// If the post is not in the store we need to remove it from the postsInChannel
const channelIds = Object.keys(nextEntitites.posts.postsInChannel);

View file

@ -4637,7 +4637,7 @@ map-visit@^1.0.0:
mattermost-redux@mattermost/mattermost-redux:
version "1.2.0"
resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/6725f81174fe4c8514f5217a3f05b6b0368f2642"
resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/10d691f386e1dbb7669ae549bbe81b855ef4c505"
dependencies:
deep-equal "1.0.1"
form-data "2.3.1"