From 55fc31ea4d3ecde4693a346de51d6cf27e6d9e49 Mon Sep 17 00:00:00 2001 From: taehoon Date: Sun, 3 Feb 2019 12:39:49 -0500 Subject: Hide followers and followees tabs when they are disabled --- src/components/user_profile/user_profile.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components/user_profile') diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 6d5b00d1..e981f208 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -15,13 +15,13 @@ :timeline-name="'user'" :user-id="fetchBy" /> -
+
-
+
-- cgit v1.2.3-70-g09d2 From ea1d7f46b5743a1493a8cfaf7b64dcc240fc3769 Mon Sep 17 00:00:00 2001 From: taehoon Date: Sun, 3 Feb 2019 12:52:04 -0500 Subject: Always show my own followees/followers --- src/components/user_card_content/user_card_content.js | 6 ++++++ src/components/user_card_content/user_card_content.vue | 4 ++-- src/components/user_profile/user_profile.js | 6 ++++++ src/components/user_profile/user_profile.vue | 4 ++-- 4 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src/components/user_profile') diff --git a/src/components/user_card_content/user_card_content.js b/src/components/user_card_content/user_card_content.js index 6f6d04a7..d256fc5d 100644 --- a/src/components/user_card_content/user_card_content.js +++ b/src/components/user_card_content/user_card_content.js @@ -79,6 +79,12 @@ export default { set (color) { this.$store.dispatch('setHighlight', { user: this.user.screen_name, color }) } + }, + followeesCountVisible () { + return !this.isOtherUser || !this.user.hide_followings + }, + followersCountVisible () { + return !this.isOtherUser || !this.user.hide_followers } }, components: { diff --git a/src/components/user_card_content/user_card_content.vue b/src/components/user_card_content/user_card_content.vue index e80dc72b..7a087bdf 100644 --- a/src/components/user_card_content/user_card_content.vue +++ b/src/components/user_card_content/user_card_content.vue @@ -112,11 +112,11 @@
{{ $t('user_card.statuses') }}
{{user.statuses_count}}
-
+
{{ $t('user_card.followees') }}
{{user.friends_count}}
-
+
{{ $t('user_card.followers') }}
{{user.followers_count}}
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 7b0ab705..4039fd35 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -58,6 +58,12 @@ const UserProfile = { }, isExternal () { return this.$route.name === 'external-user-profile' + }, + followeesTabVisible () { + return this.isUs || !this.user.hide_followings + }, + followersTabVisible () { + return this.isUs || !this.user.hide_followers } }, methods: { diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index e981f208..11943660 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -15,13 +15,13 @@ :timeline-name="'user'" :user-id="fetchBy" /> -
+
-
+
-- cgit v1.2.3-70-g09d2 From 55da7dbfde84aa78ab54efe51b41d9f09646ed03 Mon Sep 17 00:00:00 2001 From: taehoon Date: Thu, 7 Feb 2019 10:53:36 -0500 Subject: Fix naming --- src/components/user_profile/user_profile.js | 4 ++-- src/components/user_profile/user_profile.vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/components/user_profile') diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 4039fd35..e50048fa 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -59,8 +59,8 @@ const UserProfile = { isExternal () { return this.$route.name === 'external-user-profile' }, - followeesTabVisible () { - return this.isUs || !this.user.hide_followings + followsTabVisible () { + return this.isUs || !this.user.hide_follows }, followersTabVisible () { return this.isUs || !this.user.hide_followers diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 11943660..9001ed00 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -15,7 +15,7 @@ :timeline-name="'user'" :user-id="fetchBy" /> -
+
-- cgit v1.2.3-70-g09d2 From 0dc7c45f324c246cc74c6ed55c006c67742c4139 Mon Sep 17 00:00:00 2001 From: Edijs Date: Thu, 7 Feb 2019 16:23:18 -0700 Subject: Code refactoring --- .../public_and_external_timeline.js | 2 +- src/components/public_timeline/public_timeline.js | 2 +- src/components/tag_timeline/tag_timeline.js | 4 ++-- src/components/user_profile/user_profile.js | 10 ++++----- src/modules/api.js | 25 +++++----------------- src/modules/users.js | 2 +- 6 files changed, 15 insertions(+), 30 deletions(-) (limited to 'src/components/user_profile') 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 index 0db6efae..d45677e0 100644 --- 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_timeline/public_timeline.js b/src/components/public_timeline/public_timeline.js index 9b866be8..64c951ac 100644 --- 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 index 43de4f49..41b09706 100644 --- 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 index 7b0ab705..8b5571bd 100644 --- 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) @@ -63,12 +63,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 index 95782e38..31cb55c6 100644 --- 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,26 +33,12 @@ const api = { } }, actions: { - startFetching (store, payload) { - let userId = false - let timeline = 'friends' - let tag = false - - if (isArray(payload)) { - // For user timelines - timeline = payload[0] - userId = payload[1] - } else if (payload.tag) { - // For tag timelines - timeline = 'tag' - tag = payload.tag - } - + 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, tag}) - 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 index ca2e0f31..4d56ec6f 100644 --- 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) => { -- cgit v1.2.3-70-g09d2 From b57b4c6e45ca612a890e594942e86faab5a946e0 Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 8 Feb 2019 05:31:06 -0500 Subject: #291 - disable empty tabs in user profile panel --- src/components/tab_switcher/tab_switcher.js | 2 +- src/components/user_profile/user_profile.vue | 7 +++++-- src/services/entity_normalizer/entity_normalizer.service.js | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/components/user_profile') diff --git a/src/components/tab_switcher/tab_switcher.js b/src/components/tab_switcher/tab_switcher.js index f9c3f927..423df258 100644 --- a/src/components/tab_switcher/tab_switcher.js +++ b/src/components/tab_switcher/tab_switcher.js @@ -37,7 +37,7 @@ export default Vue.component('tab-switcher', { return (
- +
) }) diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 9001ed00..7a1e6a18 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -9,19 +9,20 @@ -
+
-
+
@@ -29,6 +30,7 @@
{ output.locked = data.locked output.followers_count = data.followers_count output.statuses_count = data.statuses_count + output.favourites_count = data.favourites_count + output.media_count = data.media_count output.friends = [] output.followers = [] -- cgit v1.2.3-70-g09d2 From 34169e692f9d42104413b816b3f096d808360ce4 Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 8 Feb 2019 09:56:45 -0500 Subject: #291 - enable media/favorite tabs with prefetched data --- src/components/user_profile/user_profile.vue | 6 +++--- src/services/entity_normalizer/entity_normalizer.service.js | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/components/user_profile') diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 7a1e6a18..cfb4fa95 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -30,7 +30,7 @@
- +