aboutsummaryrefslogtreecommitdiff
path: root/src/components/status/status.js
diff options
context:
space:
mode:
authorscarlett <nia@netbsd.org>2018-08-24 20:04:26 +0100
committerscarlett <nia@netbsd.org>2018-08-24 20:04:26 +0100
commit296ab5430147f01107131046dcd428085bef9020 (patch)
treef3e32f60a8d8c3d68b64eab71926dfdfbec207a0 /src/components/status/status.js
parent14db3f279daed82011bdcc2bbad21450c08a4487 (diff)
Add settings for changing the visibility of replies in the timeline.
Diffstat (limited to 'src/components/status/status.js')
-rw-r--r--src/components/status/status.js42
1 files changed, 42 insertions, 0 deletions
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(/<p|<br/).length + this.status.text.length / 80
return lengthScore > 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