From 296ab5430147f01107131046dcd428085bef9020 Mon Sep 17 00:00:00 2001 From: scarlett Date: Fri, 24 Aug 2018 20:04:26 +0100 Subject: Add settings for changing the visibility of replies in the timeline. --- src/components/status/status.js | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/components/status/status.js') diff --git a/src/components/status/status.js b/src/components/status/status.js index 9670f69d..a6cb6b6f 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -105,6 +105,48 @@ const Status = { const lengthScore = this.status.statusnet_html.split(/ 20 }, + isReply () { + if (this.status.in_reply_to_status_id) { + return true + } + // For private replies where we can't see the OP, in_reply_to_status_id will be null. + // So instead, check that the post starts with a @mention. + if (this.status.visibility === 'private') { + var textBody = this.status.text + if (this.status.summary !== null) { + textBody = textBody.substring(this.status.summary.length, textBody.length) + } + return textBody.startsWith('@') + } + return false + }, + hideReply () { + if (this.$store.state.config.replyVisibility === 'all') { + return false + } + if (this.inlineExpanded || this.expanded || !this.isReply) { + return false + } + if (this.status.user.id === this.$store.state.users.currentUser.id) { + return false + } + if (this.status.activity_type === 'repeat') { + return false + } + var checkFollowing = this.$store.state.config.replyVisibility === 'following' + for (var i = 0; i < this.status.attentions.length; ++i) { + if (this.status.user.id === this.status.attentions[i].id) { + continue + } + if (checkFollowing && this.status.attentions[i].following) { + return false + } + if (this.status.attentions[i].id === this.$store.state.users.currentUser.id) { + return false + } + } + return this.status.attentions.length > 0 + }, hideSubjectStatus () { if (this.tallStatus && !this.$store.state.config.collapseMessageWithSubject) { return false -- cgit v1.2.3-70-g09d2 From 50b3bd22e6fd35f85768eb0c2b1dd8576cd4ee64 Mon Sep 17 00:00:00 2001 From: scarlett Date: Fri, 24 Aug 2018 20:08:49 +0100 Subject: Remove old implementation of isReply. --- src/components/status/status.js | 1 - 1 file changed, 1 deletion(-) (limited to 'src/components/status/status.js') diff --git a/src/components/status/status.js b/src/components/status/status.js index a6cb6b6f..4881a5f3 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -83,7 +83,6 @@ const Status = { return hits }, muted () { return !this.unmuted && (this.status.user.muted || this.muteWordHits.length > 0) }, - isReply () { return !!this.status.in_reply_to_status_id }, isFocused () { // retweet or root of an expanded conversation if (this.focused) { -- cgit v1.2.3-70-g09d2 From 60b115320fcf8dc8f7895d5b518802122b4793df Mon Sep 17 00:00:00 2001 From: scarlett Date: Fri, 24 Aug 2018 20:19:22 +0100 Subject: Fix indentation --- src/components/status/status.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/status/status.js') diff --git a/src/components/status/status.js b/src/components/status/status.js index 4881a5f3..3f49da53 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -113,7 +113,7 @@ const Status = { if (this.status.visibility === 'private') { var textBody = this.status.text if (this.status.summary !== null) { - textBody = textBody.substring(this.status.summary.length, textBody.length) + textBody = textBody.substring(this.status.summary.length, textBody.length) } return textBody.startsWith('@') } -- cgit v1.2.3-70-g09d2 From da9629486679345689ab75a0c663c16887e524f6 Mon Sep 17 00:00:00 2001 From: scarlett Date: Fri, 24 Aug 2018 21:46:45 +0100 Subject: Don't hide replies when inConversation. --- src/components/status/status.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/status/status.js') diff --git a/src/components/status/status.js b/src/components/status/status.js index 3f49da53..11b8feba 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -123,7 +123,7 @@ const Status = { if (this.$store.state.config.replyVisibility === 'all') { return false } - if (this.inlineExpanded || this.expanded || !this.isReply) { + if (this.inlineExpanded || this.expanded || this.inConversation || !this.isReply) { return false } if (this.status.user.id === this.$store.state.users.currentUser.id) { -- cgit v1.2.3-70-g09d2