diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index 9ea8c2a7..1c457099 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -3,6 +3,7 @@ import UserCard from '../user_card/user_card.vue'
import FollowCard from '../follow_card/follow_card.vue'
import Timeline from '../timeline/timeline.vue'
import Conversation from '../conversation/conversation.vue'
+import Checkbox from 'src/components/checkbox/checkbox.vue'
import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
import RichContent from 'src/components/rich_content/rich_content.jsx'
import List from '../list/list.vue'
@@ -55,7 +56,12 @@ const UserProfile = {
followsTab: 'users',
footerRef: null,
note: null,
- noteLoading: false
+ noteLoading: false,
+ showPinned: true,
+ filterParams: {
+ showReplies: false,
+ showRepeats: true,
+ }
}
},
created () {
@@ -70,10 +76,22 @@ const UserProfile = {
},
computed: {
timeline () {
- return this.$store.state.statuses.timelines.user
+ const { user, pinned } = this.$store.state.statuses.timelines
+ if (!this.showPinned) {
+ return user
+ }
+ return {
+ ...user,
+ statuses: [...pinned.statuses, ...user.statuses],
+ visibleStatuses: [...pinned.visibleStatuses, ...user.visibleStatuses],
+ statusesObject: {
+ ...pinned.statusesObject,
+ ...user.statusesObject,
+ }
+ }
},
- replies () {
- return this.$store.state.statuses.timelines.replies
+ hasPinned () {
+ return !!(this.user.pinnedStatusIds || []).length
},
favorites () {
return this.$store.state.statuses.timelines.favorites
@@ -118,16 +136,27 @@ const UserProfile = {
if (this.isUs) timelineTabMap['favorites'] = 'favorites'
const timeline = timelineTabMap[nextTab]
+ const fetchArgs = { timeline: timeline, userId: this.userId }
+ if (timeline === 'user') {
+ const params = []
+ if (!this.filterParams.showReplies) {
+ params.push(['exclude_replies', 1])
+ }
+ if (!this.filterParams.showRepeats) {
+ params.push(['exclude_reblogs', 1])
+ }
+ fetchArgs.params = params
+ }
if (timeline) {
this.stopFetching()
- this.$store.dispatch('startFetchingTimeline', { timeline: timeline, userId: this.userId })
+ this.$store.dispatch('startFetchingTimeline', fetchArgs)
}
},
load (userNameOrId) {
const loadById = (userId) => {
this.userId = userId
- const timelines = ['user', 'favorites', 'replies', 'media']
+ const timelines = ['pinned', 'user', 'favorites', 'media']
timelines.forEach((timeline) => {
this.$store.commit('clearTimeline', { timeline: timeline })
})
@@ -165,7 +194,6 @@ const UserProfile = {
},
stopFetching () {
this.$store.dispatch('stopFetchingTimeline', 'user')
- this.$store.dispatch('stopFetchingTimeline', 'replies')
this.$store.dispatch('stopFetchingTimeline', 'favorites')
this.$store.dispatch('stopFetchingTimeline', 'media')
},
@@ -198,6 +226,15 @@ const UserProfile = {
}, 1500)
},
watch: {
+ filterParams: {
+ handler () {
+ // Clear the user timeline if previously fetched posts may not be relevant anymore
+ this.$store.dispatch('stopFetchingTimeline', 'user')
+ this.$store.commit('clearTimeline', { timeline: 'user', excludeUserId: true })
+ this.onRouteChange(null, this.tab)
+ },
+ deep: true
+ },
'$route.params.id': function (newVal) {
if (isUserPage(this.$route) && newVal) {
this.switchUser(newVal)
@@ -215,16 +252,17 @@ const UserProfile = {
}
},
components: {
+ Checkbox,
+ Conversation,
+ FollowCard,
FollowedTagCard,
- UserCard,
- Timeline,
+ FollowedTagList,
FollowerList,
FriendList,
- FollowCard,
- TabSwitcher,
- Conversation,
RichContent,
- FollowedTagList
+ TabSwitcher,
+ Timeline,
+ UserCard
}
}
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index 5465778a..c6779112 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -75,31 +75,26 @@
:render-only-focused="true"
:on-switch="onTabSwitch"
>
-