aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_profile/user_profile.js
diff options
context:
space:
mode:
authorHJ <30-hj@users.noreply.git.pleroma.social>2022-12-23 13:31:18 +0000
committerHJ <30-hj@users.noreply.git.pleroma.social>2022-12-23 13:31:18 +0000
commit3a507ba9b2fde594950a09c9d7934d54561a187c (patch)
tree450f241149cae93c602819db824cef0d39842979 /src/components/user_profile/user_profile.js
parentb13d8f7e6339e877a38a28008630dc8ec64abcdf (diff)
parent25e628efe265db583797fe1c10fdcab2f0d9cc9d (diff)
Merge branch 'develop' into 'master'
Update stable - 2.5.0 release See merge request pleroma/pleroma-fe!1711
Diffstat (limited to 'src/components/user_profile/user_profile.js')
-rw-r--r--src/components/user_profile/user_profile.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index 7a475609..08adaeab 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -3,7 +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 TabSwitcher from 'src/components/tab_switcher/tab_switcher.js'
+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'
import withLoadMore from '../../hocs/with_load_more/with_load_more'
@@ -39,15 +39,16 @@ const UserProfile = {
return {
error: false,
userId: null,
- tab: defaultTabKey
+ tab: defaultTabKey,
+ footerRef: null
}
},
created () {
const routeParams = this.$route.params
- this.load(routeParams.name || routeParams.id)
+ this.load({ name: routeParams.name, id: routeParams.id })
this.tab = get(this.$route, 'query.tab', defaultTabKey)
},
- destroyed () {
+ unmounted () {
this.stopFetching()
},
computed: {
@@ -78,6 +79,9 @@ const UserProfile = {
}
},
methods: {
+ setFooterRef (el) {
+ this.footerRef = el
+ },
load (userNameOrId) {
const startFetchingTimeline = (timeline, userId) => {
// Clear timeline only if load another user's profile
@@ -102,12 +106,17 @@ const UserProfile = {
this.userId = null
this.error = false
+ const maybeId = userNameOrId.id
+ const maybeName = userNameOrId.name
+
// Check if user data is already loaded in store
- const user = this.$store.getters.findUser(userNameOrId)
+ const user = maybeId ? this.$store.getters.findUser(maybeId) : this.$store.getters.findUserByName(maybeName)
if (user) {
loadById(user.id)
} else {
- this.$store.dispatch('fetchUser', userNameOrId)
+ (maybeId
+ ? this.$store.dispatch('fetchUser', maybeId)
+ : this.$store.dispatch('fetchUserByName', maybeName))
.then(({ id }) => loadById(id))
.catch((reason) => {
const errorMessage = get(reason, 'error.error')
@@ -146,12 +155,12 @@ const UserProfile = {
watch: {
'$route.params.id': function (newVal) {
if (newVal) {
- this.switchUser(newVal)
+ this.switchUser({ id: newVal })
}
},
'$route.params.name': function (newVal) {
if (newVal) {
- this.switchUser(newVal)
+ this.switchUser({ name: newVal })
}
},
'$route.query': function (newVal) {