From 6b21ce2daa2ba28cc2aea92fc728fa812d5f8926 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 30 Jun 2019 11:09:54 +0200 Subject: [PATCH] [Glitch] When sending a toot, ensure a CW is only set if the CW field is visible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partial port of fa7866c9c815b9faa6296492fe8f9dd20650cda4 to glitch-soc It doesn't ensure the field isn't changed, just that it isn't submitted if the field isn't visible. Ensuring the field isn't changed would require reworking the “always show CW field” feature. --- app/javascript/flavours/glitch/actions/compose.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index 69cc6827f4..2312bae634 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -138,7 +138,8 @@ export function submitCompose(routerHistory) { return function (dispatch, getState) { let status = getState().getIn(['compose', 'text'], ''); let media = getState().getIn(['compose', 'media_attachments']); - let spoilerText = getState().getIn(['compose', 'spoiler_text'], ''); + const spoilers = getState().getIn(['compose', 'spoiler']) || getState().getIn(['local_settings', 'always_show_spoilers_field']); + let spoilerText = spoilers ? getState().getIn(['compose', 'spoiler_text'], '') : ''; if ((!status || !status.length) && media.size === 0) { return;