From e2b24a989450697a5498784badac663edc6a310a Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 8 Jun 2021 17:04:57 +0300 Subject: [PATCH 1/2] fix console errors --- src/components/mention_link/mention_link.js | 19 +++++++++++-------- src/components/mentions_line/mentions_line.js | 2 +- src/components/status/status.js | 5 ++++- src/components/status/status.vue | 1 + 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/components/mention_link/mention_link.js b/src/components/mention_link/mention_link.js index 8ad84a51b..69f7fff0f 100644 --- a/src/components/mention_link/mention_link.js +++ b/src/components/mention_link/mention_link.js @@ -6,13 +6,16 @@ const MentionLink = { name: 'MentionLink', props: { url: { - required: true, type: String }, content: { required: true, type: String }, + userId: { + required: false, + type: String + }, firstMention: { required: false, type: Boolean, @@ -21,29 +24,29 @@ const MentionLink = { }, methods: { onClick () { - const link = generateProfileLink(this.user.id, this.user.screen_name) + const link = generateProfileLink(this.userId || this.user.id, 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) diff --git a/src/components/mentions_line/mentions_line.js b/src/components/mentions_line/mentions_line.js index 6f3470582..4b20d8615 100644 --- a/src/components/mentions_line/mentions_line.js +++ b/src/components/mentions_line/mentions_line.js @@ -6,7 +6,7 @@ const MentionsLine = { props: { attentions: { required: true, - type: Object + type: Array } }, data: () => ({ expanded: false }), diff --git a/src/components/status/status.js b/src/components/status/status.js index 3954df000..eb0af0988 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -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 }, diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 969e2bc87..4c5b9235a 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -262,6 +262,7 @@ class="mention-link" :content="replyToName" :url="replyProfileLink" + :userId="status.in_reply_to_user_id" :first-mention="false" /> Date: Tue, 8 Jun 2021 17:05:20 +0300 Subject: [PATCH 2/2] fix repeats having wrong mentions --- src/components/status/status.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index eb0af0988..55efb2c0b 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -170,9 +170,9 @@ const Status = { return this.mergedConfig.mentionsOwnLine }, mentions () { - return this.statusoid.attentions.filter(attn => { + return this.status.attentions.filter(attn => { return attn.screen_name !== this.replyToName && - attn.screen_name !== this.statusoid.user.screen_name + attn.screen_name !== this.statuso.user.screen_name }) }, hasMentions () {