commit: 60b413d02c4be5b3f24ff984e43090620d9a59e1
parent: 7ec02445cc9115b35f399b5c98bdcad00c6da5f4
Author: Shpuld Shpludson <shp@cock.li>
Date: Fri, 5 Jul 2019 13:28:15 +0000
Merge branch '602' into 'develop'
Fix mixed profiles bug on user profile page
Closes #586
See merge request pleroma/pleroma-fe!865
Diffstat:
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
@@ -86,7 +86,7 @@ const Timeline = {
if (this.newStatusCount === 0) return
if (this.timeline.flushMarker !== 0) {
- this.$store.commit('clearTimeline', { timeline: this.timelineName })
+ this.$store.commit('clearTimeline', { timeline: this.timelineName, excludeUserId: true })
this.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 })
this.fetchOlderStatuses()
} else {
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
@@ -31,6 +31,8 @@ const UserProfile = {
}
},
created () {
+ // Make sure that timelines used in this page are empty
+ this.cleanUp()
const routeParams = this.$route.params
this.load(routeParams.name || routeParams.id)
},
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
@@ -395,8 +395,9 @@ export const mutations = {
state[key] = value
})
},
- clearTimeline (state, { timeline }) {
- state.timelines[timeline] = emptyTl(state.timelines[timeline].userId)
+ clearTimeline (state, { timeline, excludeUserId = false }) {
+ const userId = excludeUserId ? state.timelines[timeline].userId : undefined
+ state.timelines[timeline] = emptyTl(userId)
},
clearNotifications (state) {
state.notifications = emptyNotifications()
diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js
@@ -258,11 +258,11 @@ describe('Statuses module', () => {
})
describe('clearTimeline', () => {
- it('keeps userId when clearing user timeline', () => {
+ it('keeps userId when clearing user timeline when excludeUserId param is true', () => {
const state = defaultState()
state.timelines.user.userId = 123
- mutations.clearTimeline(state, { timeline: 'user' })
+ mutations.clearTimeline(state, { timeline: 'user', excludeUserId: true })
expect(state.timelines.user.userId).to.eql(123)
})