diff options
| author | Vivian Lim <vivlim@pm.me> | 2018-06-28 21:39:25 -0700 |
|---|---|---|
| committer | Vivian Lim <vvnl@pm.me> | 2018-06-28 23:39:55 -0700 |
| commit | b0cf050797702d6a7cc921c71b27cecb5ce234c6 (patch) | |
| tree | f979935b07ac3d53b5cd441aab3416c4ea1a89a6 /src | |
| parent | ab86e87e85afa3db390503821165cece64c39a3a (diff) | |
Add configuration option to enable click-through content warnings
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/status/status.js | 7 | ||||
| -rw-r--r-- | src/components/status/status.vue | 10 | ||||
| -rw-r--r-- | src/main.js | 4 |
3 files changed, 14 insertions, 7 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 @@ <div v-if="status.summary" @click.prevent="linkClicked" class="status-content media-body"> <div class="contentWarningLabel"> <span v-html="status.summary"></span> - <button v-if="showingContentWarningContent" @click.prevent="toggleContentWarningContent">Hide</button> - <button v-else @click.prevent="toggleContentWarningContent">Show</button> + <span v-if="clickThroughContentWarningsEnabled"> + <button v-if="showingContentWarningContent" @click.prevent="toggleContentWarningContent">Hide</button> + <button v-else @click.prevent="toggleContentWarningContent">Show</button> + </span> </div> - <div v-if="showingContentWarningContent" v-html="status.content" class="contentWarnedContent"></div> + <div v-if="showingContentWarningContent || !clickThroughContentWarningsEnabled" v-html="status.content" class="contentWarnedContent"></div> <div v-else class="hiddenContent" @click.prevent="toggleContentWarningContent">Click to view this post.<span v-if="status.attachments && status.attachments.length > 0"> (has attachments)</span></div> </div> <div v-else @click.prevent="linkClicked" class="status-content media-body" v-html="status.statusnet_html"></div> <a v-if="showingTall" href="#" class="tall-status-unhider" @click.prevent="toggleShowTall">Show less</a> </div> - <div v-if='status.attachments && (!status.summary || showingContentWarningContent)' class='attachments media-body'> + <div v-if='status.attachments && (!status.summary || showingContentWarningContent || !clickThroughContentWarningsEnabled)' class='attachments media-body'> <attachment :size="attachmentSize" :status-id="status.id" :nsfw="status.nsfw" :attachment="attachment" v-for="attachment in status.attachments" :key="attachment.id"> </attachment> </div> 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') } |
