fix console errors

This commit is contained in:
Henry Jameson 2021-06-08 17:04:57 +03:00
parent a3b8e7ad99
commit 963f1679e0
4 changed files with 25 additions and 10 deletions

View file

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

View file

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

View file

@ -139,7 +139,10 @@ const Status = {
return this.generateUserProfileLink(this.status.user.id, this.status.user.screen_name) return this.generateUserProfileLink(this.status.user.id, this.status.user.screen_name)
}, },
replyProfileLink () { 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 }, retweet () { return !!this.statusoid.retweeted_status },
retweeterUser () { return this.statusoid.user }, retweeterUser () { return this.statusoid.user },

View file

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