about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-10-20 13:08:13 +0200
committerThibG <thib@sitedethib.com>2018-10-20 17:06:21 +0200
commite4c3ea1809cc81ee0c2617957f93d095bf174d19 (patch)
tree3cc912eb97daffd9317720eba3f87ed9e05e0af0
parent13c3fa8d36c049395fd817056f378829f81edeb3 (diff)
Force sensitive content flag when posting a toot with a CW
Indeed, when the “Always enable the Content Warning field” setting is enabled,
sending a content-less toot with a CW would move the CW to the toot's content
and leave the toot not marked as sensitive.
-rw-r--r--app/javascript/flavours/glitch/actions/compose.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js
index fb311fc0a..58f2b3786 100644
--- a/app/javascript/flavours/glitch/actions/compose.js
+++ b/app/javascript/flavours/glitch/actions/compose.js
@@ -120,6 +120,7 @@ export function submitCompose() {
   return function (dispatch, getState) {
     let status = getState().getIn(['compose', 'text'], '');
     let media  = getState().getIn(['compose', 'media_attachments']);
+    let spoilerText = getState().getIn(['compose', 'spoiler_text'], '');
 
     if ((!status || !status.length) && media.size === 0) {
       return;
@@ -133,8 +134,8 @@ export function submitCompose() {
       status,
       in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
       media_ids: media.map(item => item.get('id')),
-      sensitive: getState().getIn(['compose', 'sensitive']),
-      spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''),
+      sensitive: getState().getIn(['compose', 'sensitive']) || spoilerText.length > 0,
+      spoiler_text: spoilerText,
       visibility: getState().getIn(['compose', 'privacy']),
     }, {
       headers: {