Merge branch '602' into 'develop'

Fix mixed profiles bug on user profile page

Closes #586

See merge request pleroma/pleroma-fe!865
This commit is contained in:
Shpuld Shpludson 2019-07-05 13:28:15 +00:00
commit 60b413d02c
4 changed files with 8 additions and 5 deletions

View File

@ -86,7 +86,7 @@ const Timeline = {
if (this.newStatusCount === 0) return if (this.newStatusCount === 0) return
if (this.timeline.flushMarker !== 0) { 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.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 })
this.fetchOlderStatuses() this.fetchOlderStatuses()
} else { } else {

View File

@ -31,6 +31,8 @@ const UserProfile = {
} }
}, },
created () { created () {
// Make sure that timelines used in this page are empty
this.cleanUp()
const routeParams = this.$route.params const routeParams = this.$route.params
this.load(routeParams.name || routeParams.id) this.load(routeParams.name || routeParams.id)
}, },

View File

@ -395,8 +395,9 @@ export const mutations = {
state[key] = value state[key] = value
}) })
}, },
clearTimeline (state, { timeline }) { clearTimeline (state, { timeline, excludeUserId = false }) {
state.timelines[timeline] = emptyTl(state.timelines[timeline].userId) const userId = excludeUserId ? state.timelines[timeline].userId : undefined
state.timelines[timeline] = emptyTl(userId)
}, },
clearNotifications (state) { clearNotifications (state) {
state.notifications = emptyNotifications() state.notifications = emptyNotifications()

View File

@ -258,11 +258,11 @@ describe('Statuses module', () => {
}) })
describe('clearTimeline', () => { describe('clearTimeline', () => {
it('keeps userId when clearing user timeline', () => { it('keeps userId when clearing user timeline when excludeUserId param is true', () => {
const state = defaultState() const state = defaultState()
state.timelines.user.userId = 123 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) expect(state.timelines.user.userId).to.eql(123)
}) })