diff options
| author | lambda <pleromagit@rogerbraun.net> | 2018-12-03 10:11:32 +0000 |
|---|---|---|
| committer | lambda <pleromagit@rogerbraun.net> | 2018-12-03 10:11:32 +0000 |
| commit | b33aa46d6eeca055d961e56e5adef5cfd1b92dfa (patch) | |
| tree | 354056482a9f518029d55c61dc1432ede3ae125b /src/modules/statuses.js | |
| parent | e15b9bddbb23e36632982296a7c9ec01fd2bb7c7 (diff) | |
| parent | ccb1682379fda5b34506cb0a04df2ce38eaad6ad (diff) | |
Merge branch 'fix-user-profile-glitches' into 'develop'
User timeline improvements
Closes #186 and #120
See merge request pleroma/pleroma-fe!390
Diffstat (limited to 'src/modules/statuses.js')
| -rw-r--r-- | src/modules/statuses.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 2c3d2550..93c0c878 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -16,6 +16,7 @@ const emptyTl = () => ({ followers: [], friends: [], viewing: 'statuses', + userId: 0, flushMarker: 0 }) @@ -132,7 +133,7 @@ const sortTimeline = (timeline) => { return timeline } -const addNewStatuses = (state, { statuses, showImmediately = false, timeline, user = {}, noIdUpdate = false }) => { +const addNewStatuses = (state, { statuses, showImmediately = false, timeline, user = {}, noIdUpdate = false, userId }) => { // Sanity check if (!isArray(statuses)) { return false @@ -149,6 +150,13 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us timelineObject.maxId = maxNew } + // This makes sure that user timeline won't get data meant for other + // user. I.e. opening different user profiles makes request which could + // return data late after user already viewing different user profile + if (timeline === 'user' && timelineObject.userId !== userId) { + return + } + const addStatus = (status, showImmediately, addToTimeline = true) => { const result = mergeOrAdd(allStatuses, allStatusesObject, status) status = result.item @@ -418,8 +426,8 @@ export const mutations = { const statuses = { state: defaultState, actions: { - addNewStatuses ({ rootState, commit }, { statuses, showImmediately = false, timeline = false, noIdUpdate = false }) { - commit('addNewStatuses', { statuses, showImmediately, timeline, noIdUpdate, user: rootState.users.currentUser }) + addNewStatuses ({ rootState, commit }, { statuses, showImmediately = false, timeline = false, noIdUpdate = false, userId }) { + commit('addNewStatuses', { statuses, showImmediately, timeline, noIdUpdate, user: rootState.users.currentUser, userId }) }, addNewNotifications ({ rootState, commit, dispatch }, { notifications, older }) { commit('addNewNotifications', { visibleNotificationTypes: visibleNotificationTypes(rootState), dispatch, notifications, older }) |
