Merge branch 'mastoapi/user-stuff' into shigusegubu
* mastoapi/user-stuff: fix user-card avatar falling into permament failed state fix flake id users not fetching correctly fix console error
This commit is contained in:
commit
23c22c7cbd
3 changed files with 21 additions and 7 deletions
|
@ -23,6 +23,11 @@ const UserAvatar = {
|
||||||
imageLoadError () {
|
imageLoadError () {
|
||||||
this.showPlaceholder = true
|
this.showPlaceholder = true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
src () {
|
||||||
|
this.showPlaceholder = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,8 @@ const UserProfile = {
|
||||||
},
|
},
|
||||||
userInStore () {
|
userInStore () {
|
||||||
const routeParams = this.$route.params
|
const routeParams = this.$route.params
|
||||||
return this.$store.getters.findUser(routeParams.name || routeParams.id)
|
// This needs fetchedUserId so that computed will be refreshed when user is fetched
|
||||||
|
return this.$store.getters.findUser(this.fetchedUserId || routeParams.name || routeParams.id)
|
||||||
},
|
},
|
||||||
user () {
|
user () {
|
||||||
if (this.timeline.statuses[0]) {
|
if (this.timeline.statuses[0]) {
|
||||||
|
|
|
@ -94,11 +94,12 @@ export const mutations = {
|
||||||
updateUserRelationship (state, relationships) {
|
updateUserRelationship (state, relationships) {
|
||||||
relationships.forEach((relationship) => {
|
relationships.forEach((relationship) => {
|
||||||
const user = state.usersObject[relationship.id]
|
const user = state.usersObject[relationship.id]
|
||||||
|
if (user) {
|
||||||
user.follows_you = relationship.followed_by
|
user.follows_you = relationship.followed_by
|
||||||
user.following = relationship.following
|
user.following = relationship.following
|
||||||
user.muted = relationship.muting
|
user.muted = relationship.muting
|
||||||
user.statusnet_blocking = relationship.blocking
|
user.statusnet_blocking = relationship.blocking
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
saveBlocks (state, blockIds) {
|
saveBlocks (state, blockIds) {
|
||||||
|
@ -132,7 +133,14 @@ export const mutations = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getters = {
|
export const getters = {
|
||||||
findUser: state => query => state.usersObject[typeof query === 'string' ? query.toLowerCase() : query]
|
findUser: state => query => {
|
||||||
|
const result = state.usersObject[query]
|
||||||
|
// In case it's a screen_name, we can try searching case-insensitive
|
||||||
|
if (!result && typeof query === 'string') {
|
||||||
|
return state.usersObject[query.toLowerCase()]
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultState = {
|
export const defaultState = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue