fix console errors

This commit is contained in:
Henry Jameson 2021-06-08 17:04:57 +03:00 committed by Sam Therapy
parent 20eb910e61
commit c1457c2390
Signed by: sam
GPG key ID: 4D8B07C18F31ACBD
4 changed files with 25 additions and 10 deletions

View file

@ -6,13 +6,20 @@ const MentionLink = {
name: 'MentionLink',
props: {
url: {
required: true,
type: String
},
content: {
required: true,
type: String
},
userId: {
required: false,
type: String
},
userScreenName: {
required: false,
type: String
},
firstMention: {
required: false,
type: Boolean,
@ -21,29 +28,32 @@ const MentionLink = {
},
methods: {
onClick () {
const link = generateProfileLink(this.user.id, this.user.screen_name)
const link = generateProfileLink(
this.userId || this.user.id,
this.userScreenName || this.user.screen_name
)
this.$router.push(link)
}
},
computed: {
user () {
return this.$store.getters.findUserByUrl(this.url)
return this.url && this.$store.getters.findUserByUrl(this.url)
},
isYou () {
// FIXME why user !== currentUser???
return this.user.screen_name === this.currentUser.screen_name
return this.user && this.user.screen_name === this.currentUser.screen_name
},
userName () {
return this.userNameFullUi.split('@')[0]
return this.user && this.userNameFullUi.split('@')[0]
},
userNameFull () {
return this.user.screen_name
return this.user && this.user.screen_name
},
userNameFullUi () {
return this.user.screen_name_ui
return this.user && this.user.screen_name_ui
},
highlight () {
return this.mergedConfig.highlight[this.user.screen_name]
return this.user && this.mergedConfig.highlight[this.user.screen_name]
},
highlightType () {
return this.highlight && ('-' + this.highlight.type)

View file

@ -6,7 +6,7 @@ const MentionsLine = {
props: {
attentions: {
required: true,
type: Object
type: Array
}
},
data: () => ({ expanded: false }),

View file

@ -139,7 +139,10 @@ const Status = {
return this.generateUserProfileLink(this.status.user.id, this.status.user.screen_name)
},
replyProfileLink () {
return this.$store.getters.findUser(this.status.in_reply_to_user_id).statusnet_profile_url
if (this.isReply) {
const user = this.$store.getters.findUser(this.status.in_reply_to_user_id)
return user && user.statusnet_profile_url
}
},
retweet () { return !!this.statusoid.retweeted_status },
retweeterUser () { return this.statusoid.user },

View file

@ -262,6 +262,8 @@
class="mention-link"
:content="replyToName"
:url="replyProfileLink"
:userId="status.in_reply_to_user_id"
:userScreenName="status.in_reply_to_screen_name"
:first-mention="false"
/>
<span