From c5e34de79a7fd9262893c99e223e767187694b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Mon, 24 Jan 2022 00:17:32 +0100 Subject: [PATCH] Do not use reblogIcon before initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/components/status_action_bar.js | 20 ++--- .../features/status/components/action_bar.js | 82 +++++++++---------- app/soapbox/reducers/compose.js | 10 +-- 3 files changed, 53 insertions(+), 59 deletions(-) diff --git a/app/soapbox/components/status_action_bar.js b/app/soapbox/components/status_action_bar.js index 005aa8b1a..16b8934cd 100644 --- a/app/soapbox/components/status_action_bar.js +++ b/app/soapbox/components/status_action_bar.js @@ -531,6 +531,16 @@ class StatusActionBar extends ImmutablePureComponent { '😩': messages.reactionWeary, }[meEmojiReact] || messages.favourite); + const menu = this._makeMenu(publicStatus); + let reblogIcon = require('feather-icons/dist/icons/repeat.svg'); + let replyTitle; + + if (status.get('visibility') === 'direct') { + reblogIcon = require('@tabler/icons/icons/mail.svg'); + } else if (status.get('visibility') === 'private') { + reblogIcon = require('@tabler/icons/icons/lock.svg'); + } + let reblogButton; if (me && features.quotePosts) { @@ -572,16 +582,6 @@ class StatusActionBar extends ImmutablePureComponent { ); } - const menu = this._makeMenu(publicStatus); - let reblogIcon = require('feather-icons/dist/icons/repeat.svg'); - let replyTitle; - - if (status.get('visibility') === 'direct') { - reblogIcon = require('@tabler/icons/icons/mail.svg'); - } else if (status.get('visibility') === 'private') { - reblogIcon = require('@tabler/icons/icons/lock.svg'); - } - if (status.get('in_reply_to_id', null) === null) { replyTitle = intl.formatMessage(messages.reply); } else { diff --git a/app/soapbox/features/status/components/action_bar.js b/app/soapbox/features/status/components/action_bar.js index 5b1f23d88..57fce8e22 100644 --- a/app/soapbox/features/status/components/action_bar.js +++ b/app/soapbox/features/status/components/action_bar.js @@ -330,47 +330,6 @@ class ActionBar extends React.PureComponent { '😩': messages.reactionWeary, }[meEmojiReact] || messages.favourite); - let reblogButton; - - if (me && features.quotePosts) { - const reblogMenu = [ - { - text: intl.formatMessage(status.get('reblogged') ? messages.cancel_reblog_private : messages.reblog), - action: this.handleReblogClick, - icon: require('@tabler/icons/icons/repeat.svg'), - }, - { - text: intl.formatMessage(messages.quotePost), - action: this.handleQuoteClick, - icon: require('@tabler/icons/icons/quote.svg'), - }, - ]; - - reblogButton = ( - - ); - } else { - reblogButton = ( - - ); - } - const menu = []; if (publicStatus) { @@ -538,6 +497,47 @@ class ActionBar extends React.PureComponent { const reblog_disabled = (status.get('visibility') === 'direct' || status.get('visibility') === 'private'); + let reblogButton; + + if (me && features.quotePosts) { + const reblogMenu = [ + { + text: intl.formatMessage(status.get('reblogged') ? messages.cancel_reblog_private : messages.reblog), + action: this.handleReblogClick, + icon: require('@tabler/icons/icons/repeat.svg'), + }, + { + text: intl.formatMessage(messages.quotePost), + action: this.handleQuoteClick, + icon: require('@tabler/icons/icons/quote.svg'), + }, + ]; + + reblogButton = ( + + ); + } else { + reblogButton = ( + + ); + } + return (
diff --git a/app/soapbox/reducers/compose.js b/app/soapbox/reducers/compose.js index e30caf874..c0ee4af0b 100644 --- a/app/soapbox/reducers/compose.js +++ b/app/soapbox/reducers/compose.js @@ -354,14 +354,8 @@ export default function compose(state = initialState, action) { map.set('caretPosition', null); map.set('idempotencyKey', uuid()); map.set('content_type', state.get('default_content_type')); - - if (action.status.get('spoiler_text', '').length > 0) { - map.set('spoiler', true); - map.set('spoiler_text', action.status.get('spoiler_text')); - } else { - map.set('spoiler', false); - map.set('spoiler_text', ''); - } + map.set('spoiler', false); + map.set('spoiler_text', ''); }); case COMPOSE_SUBMIT_REQUEST: return state.set('is_submitting', true);