logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe
commit: 5296d41372cc6c25aedcdf44ce8b866b57e3b04b
parent: 531f150dd31ffc11b6f67145f4245b20457544aa
Author: Shpuld Shpludson <shp@cock.li>
Date:   Sat,  9 Feb 2019 06:56:46 +0000

Merge branch 'fix/js-error-in-tag-page' into 'develop'

Fixed JS error in tag page

See merge request pleroma/pleroma-fe!543

Diffstat:

Msrc/components/public_and_external_timeline/public_and_external_timeline.js2+-
Msrc/components/public_and_external_timeline/public_and_external_timeline.vue2+-
Msrc/components/public_timeline/public_timeline.js2+-
Msrc/components/tag_timeline/tag_timeline.js4++--
Msrc/components/user_profile/user_profile.js10+++++-----
Msrc/modules/api.js19+++++--------------
Msrc/modules/users.js2+-
7 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/src/components/public_and_external_timeline/public_and_external_timeline.js b/src/components/public_and_external_timeline/public_and_external_timeline.js @@ -7,7 +7,7 @@ const PublicAndExternalTimeline = { timeline () { return this.$store.state.statuses.timelines.publicAndExternal } }, created () { - this.$store.dispatch('startFetching', 'publicAndExternal') + this.$store.dispatch('startFetching', { timeline: 'publicAndExternal' }) }, destroyed () { this.$store.dispatch('stopFetching', 'publicAndExternal') diff --git a/src/components/public_and_external_timeline/public_and_external_timeline.vue b/src/components/public_and_external_timeline/public_and_external_timeline.vue @@ -1,5 +1,5 @@ <template> - <Timeline :title="$t('nav.twkn')"v-bind:timeline="timeline" v-bind:timeline-name="'publicAndExternal'"/> + <Timeline :title="$t('nav.twkn')" v-bind:timeline="timeline" v-bind:timeline-name="'publicAndExternal'"/> </template> <script src="./public_and_external_timeline.js"></script> diff --git a/src/components/public_timeline/public_timeline.js b/src/components/public_timeline/public_timeline.js @@ -7,7 +7,7 @@ const PublicTimeline = { timeline () { return this.$store.state.statuses.timelines.public } }, created () { - this.$store.dispatch('startFetching', 'public') + this.$store.dispatch('startFetching', { timeline: 'public' }) }, destroyed () { this.$store.dispatch('stopFetching', 'public') diff --git a/src/components/tag_timeline/tag_timeline.js b/src/components/tag_timeline/tag_timeline.js @@ -3,7 +3,7 @@ import Timeline from '../timeline/timeline.vue' const TagTimeline = { created () { this.$store.commit('clearTimeline', { timeline: 'tag' }) - this.$store.dispatch('startFetching', { 'tag': this.tag }) + this.$store.dispatch('startFetching', { timeline: 'tag', tag: this.tag }) }, components: { Timeline @@ -15,7 +15,7 @@ const TagTimeline = { watch: { tag () { this.$store.commit('clearTimeline', { timeline: 'tag' }) - this.$store.dispatch('startFetching', { 'tag': this.tag }) + this.$store.dispatch('startFetching', { timeline: 'tag', tag: this.tag }) } }, destroyed () { diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js @@ -8,8 +8,8 @@ const UserProfile = { this.$store.commit('clearTimeline', { timeline: 'user' }) this.$store.commit('clearTimeline', { timeline: 'favorites' }) this.$store.commit('clearTimeline', { timeline: 'media' }) - this.$store.dispatch('startFetching', ['user', this.fetchBy]) - this.$store.dispatch('startFetching', ['media', this.fetchBy]) + this.$store.dispatch('startFetching', { timeline: 'user', userId: this.fetchBy }) + this.$store.dispatch('startFetching', { timeline: 'media', userId: this.fetchBy }) this.startFetchFavorites() if (!this.user.id) { this.$store.dispatch('fetchUser', this.fetchBy) @@ -69,12 +69,12 @@ const UserProfile = { methods: { startFetchFavorites () { if (this.isUs) { - this.$store.dispatch('startFetching', ['favorites', this.fetchBy]) + this.$store.dispatch('startFetching', { timeline: 'favorites', userId: this.fetchBy }) } }, startUp () { - this.$store.dispatch('startFetching', ['user', this.fetchBy]) - this.$store.dispatch('startFetching', ['media', this.fetchBy]) + this.$store.dispatch('startFetching', { timeline: 'user', userId: this.fetchBy }) + this.$store.dispatch('startFetching', { timeline: 'media', userId: this.fetchBy }) this.startFetchFavorites() }, diff --git a/src/modules/api.js b/src/modules/api.js @@ -1,5 +1,4 @@ import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js' -import {isArray} from 'lodash' import { Socket } from 'phoenix' const api = { @@ -34,20 +33,12 @@ const api = { } }, actions: { - startFetching (store, timeline) { - let userId = false - - // This is for user timelines - if (isArray(timeline)) { - userId = timeline[1] - timeline = timeline[0] - } - + startFetching (store, {timeline = 'friends', tag = false, userId = false}) { // Don't start fetching if we already are. - if (!store.state.fetchers[timeline]) { - const fetcher = store.state.backendInteractor.startFetching({timeline, store, userId}) - store.commit('addFetcher', {timeline, fetcher}) - } + if (store.state.fetchers[timeline]) return + + const fetcher = store.state.backendInteractor.startFetching({ timeline, store, userId, tag }) + store.commit('addFetcher', { timeline, fetcher }) }, stopFetching (store, timeline) { const fetcher = store.state.fetchers[timeline] diff --git a/src/modules/users.js b/src/modules/users.js @@ -271,7 +271,7 @@ const users = { } // Start getting fresh posts. - store.dispatch('startFetching', 'friends') + store.dispatch('startFetching', { timeline: 'friends' }) // Get user mutes and follower info store.rootState.api.backendInteractor.fetchMutes().then((mutedUsers) => {