From 0554cac113555b948cdad3d9f14ec6f548c93c01 Mon Sep 17 00:00:00 2001 From: Vivian Lim Date: Wed, 27 Jun 2018 22:43:22 -0700 Subject: [PATCH 1/6] Add click-to-show content warnings on posts --- src/components/status/status.js | 6 +++++- src/components/status/status.vue | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index 87ef90d8..9f88d38c 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -28,7 +28,8 @@ const Status = { userExpanded: false, preview: null, showPreview: false, - showingTall: false + showingTall: false, + showingContentWarningContent: false }), computed: { muteWords () { @@ -145,6 +146,9 @@ const Status = { toggleShowTall () { this.showingTall = !this.showingTall }, + toggleContentWarningContent () { + this.showingContentWarningContent = !this.showingContentWarningContent + }, replyEnter (id, event) { this.showPreview = true const targetId = Number(id) diff --git a/src/components/status/status.vue b/src/components/status/status.vue index f88c810d..cffa8e26 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -73,7 +73,16 @@
Show more -
+
+
+ + + +
+
+
Click to view this post.
+
+
Show less
@@ -488,4 +497,15 @@ a.unmute { } } +.hiddenContent { + margin: 8px; + padding: 32px; + background: var(--lightBg, $fallback--lightBg); + color: #CCCCCC; + border-radius: var(--panelRadius, $fallback--panelRadius); +} +.contentWarnedContent { + margin: 8px; +} + From b3e122d31f95c5a130ce7c41970984502798903c Mon Sep 17 00:00:00 2001 From: Vivian Lim Date: Wed, 27 Jun 2018 23:55:29 -0700 Subject: [PATCH 2/6] Carry forward content warnings in replies --- src/components/post_status_form/post_status_form.js | 6 ++++-- src/components/status/status.vue | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 4f4c6aca..4f6cee9c 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -24,7 +24,8 @@ const PostStatusForm = { 'replyTo', 'repliedUser', 'attentions', - 'messageScope' + 'messageScope', + 'parentSpoilerText' ], components: { MediaUpload @@ -50,7 +51,8 @@ const PostStatusForm = { newStatus: { status: statusText, files: [], - visibility: this.messageScope || 'public' + visibility: this.messageScope || 'public', + spoilerText: this.parentSpoilerText || null }, caret: 0 } diff --git a/src/components/status/status.vue b/src/components/status/status.vue index cffa8e26..09e6b54d 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -105,7 +105,13 @@
- +
From 65edcaf4b95964f94abbd9420fd11fc36490dbb1 Mon Sep 17 00:00:00 2001 From: Vivian Lim Date: Wed, 27 Jun 2018 23:55:57 -0700 Subject: [PATCH 3/6] Differentiate content warning block if it is on lightbg --- src/components/status/status.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 09e6b54d..5f6b987a 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -506,9 +506,11 @@ a.unmute { .hiddenContent { margin: 8px; padding: 32px; - background: var(--lightBg, $fallback--lightBg); - color: #CCCCCC; - border-radius: var(--panelRadius, $fallback--panelRadius); + background: var(--lightBg, $fallback--lightBg); + border-radius: var(--panelRadius, $fallback--panelRadius); +} +.status-el_focused * .hiddenContent { + background: var(--bg, $fallback--bg); } .contentWarnedContent { margin: 8px; From ab86e87e85afa3db390503821165cece64c39a3a Mon Sep 17 00:00:00 2001 From: Vivian Lim Date: Thu, 28 Jun 2018 20:29:39 -0700 Subject: [PATCH 4/6] Also hide attachments behind clickthrough. --- src/components/status/status.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 5f6b987a..77a7904e 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -80,13 +80,13 @@
-
Click to view this post.
+
Click to view this post. (has attachments)
Show less -
+
From b0cf050797702d6a7cc921c71b27cecb5ce234c6 Mon Sep 17 00:00:00 2001 From: Vivian Lim Date: Thu, 28 Jun 2018 21:39:25 -0700 Subject: [PATCH 5/6] Add configuration option to enable click-through content warnings --- src/components/status/status.js | 7 +++++-- src/components/status/status.vue | 10 ++++++---- src/main.js | 4 +++- static/config.json | 3 ++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index 9f88d38c..4e242701 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -29,7 +29,7 @@ const Status = { preview: null, showPreview: false, showingTall: false, - showingContentWarningContent: false + showingContentWarningContent: false }), computed: { muteWords () { @@ -93,7 +93,10 @@ const Status = { return 'small' } return 'normal' - } + }, + clickThroughContentWarningsEnabled () { + return this.$store.state.config.clickThroughContentWarningsEnabled + }, }, components: { Attachment, diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 77a7904e..2e33999a 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -76,17 +76,19 @@
- - + + + +
-
+
Click to view this post. (has attachments)
Show less
-
+
diff --git a/src/main.js b/src/main.js index bacd7f6d..01ee7f75 100644 --- a/src/main.js +++ b/src/main.js @@ -89,7 +89,7 @@ window.fetch('/api/statusnet/config.json') window.fetch('/static/config.json') .then((res) => res.json()) .then((data) => { - const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel, scopeOptionsEnabled} = data + const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel, scopeOptionsEnabled, clickThroughContentWarningsEnabled} = data store.dispatch('setOption', { name: 'theme', value: theme }) store.dispatch('setOption', { name: 'background', value: background }) store.dispatch('setOption', { name: 'logo', value: logo }) @@ -98,6 +98,8 @@ window.fetch('/static/config.json') store.dispatch('setOption', { name: 'whoToFollowLink', value: whoToFollowLink }) store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel }) store.dispatch('setOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled }) + store.dispatch('setOption', { name: 'clickThroughContentWarningsEnabled', value: clickThroughContentWarningsEnabled }) + if (data['chatDisabled']) { store.dispatch('disableChat') } diff --git a/static/config.json b/static/config.json index 4dacfebe..4fdddf29 100644 --- a/static/config.json +++ b/static/config.json @@ -11,5 +11,6 @@ "whoToFollowLink": "https://vinayaka.distsn.org/?{{host}}+{{user}}", "whoToFollowLinkDummy2": "https://followlink.osa-p.net/recommend.html", "showInstanceSpecificPanel": false, - "scopeOptionsEnabled": false + "scopeOptionsEnabled": true, + "clickThroughContentWarningsEnabled": true } From 158342fc394b7fded6e25b8cb40516ccaff6ac26 Mon Sep 17 00:00:00 2001 From: Vivian Lim Date: Fri, 29 Jun 2018 00:10:17 -0700 Subject: [PATCH 6/6] Fix lint warnings --- 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 4e242701..40786d94 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -29,7 +29,7 @@ const Status = { preview: null, showPreview: false, showingTall: false, - showingContentWarningContent: false + showingContentWarningContent: false }), computed: { muteWords () { @@ -96,7 +96,7 @@ const Status = { }, clickThroughContentWarningsEnabled () { return this.$store.state.config.clickThroughContentWarningsEnabled - }, + } }, components: { Attachment,