diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index d2c049f341..350ee6fbbe 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -179,7 +179,7 @@ export function directCompose(account, routerHistory) { }; } -export function submitCompose(routerHistory) { +export function submitCompose(routerHistory, overridePrivacy = null) { return function (dispatch, getState) { let status = getState().getIn(['compose', 'text'], ''); const media = getState().getIn(['compose', 'media_attachments']); @@ -228,7 +228,7 @@ export function submitCompose(routerHistory) { media_attributes, sensitive: getState().getIn(['compose', 'sensitive']) || (spoilerText.length > 0 && media.size !== 0), spoiler_text: spoilerText, - visibility: getState().getIn(['compose', 'privacy']), + visibility: overridePrivacy || getState().getIn(['compose', 'privacy']), poll: getState().getIn(['compose', 'poll'], null), language: getState().getIn(['compose', 'language']), }, diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx b/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx index 43e4a9d6cb..12873e2cc0 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx @@ -31,6 +31,7 @@ import { EditIndicator } from './edit_indicator'; import { NavigationBar } from './navigation_bar'; import { PollForm } from "./poll_form"; import { ReplyIndicator } from './reply_indicator'; +import { SecondaryPrivacyButton } from './secondary_privacy_button'; const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d'; @@ -50,6 +51,7 @@ class ComposeForm extends ImmutablePureComponent { spoiler: PropTypes.bool, spoilerAlwaysOn: PropTypes.bool, privacy: PropTypes.string, + sideArm: PropTypes.string, spoilerText: PropTypes.string, focusDate: PropTypes.instanceOf(Date), caretPosition: PropTypes.number, @@ -96,6 +98,10 @@ class ComposeForm extends ImmutablePureComponent { if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) { this.handleSubmit(); } + + if (e.keyCode === 13 && e.altKey) { + this.handleSecondarySubmit(); + } }; getFulltextForCharacterCounting = () => { @@ -110,7 +116,7 @@ class ComposeForm extends ImmutablePureComponent { return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (isOnlyWhitespace && !anyMedia)); }; - handleSubmit = (e) => { + handleSubmit = (e, overridePrivacy = null) => { if (this.props.text !== this.textareaRef.current.value) { // Something changed the text inside the textarea (e.g. browser extensions like Grammarly) // Update the state to match the current text @@ -121,13 +127,18 @@ class ComposeForm extends ImmutablePureComponent { return; } - this.props.onSubmit(this.props.history || null); + this.props.onSubmit(this.props.history || null, overridePrivacy); if (e) { e.preventDefault(); } }; + handleSecondarySubmit = () => { + const { sideArm } = this.props; + this.handleSubmit(null, sideArm === 'none' ? null : sideArm); + }; + onSuggestionsClearRequested = () => { this.props.onClearSuggestions(); }; @@ -303,6 +314,12 @@ class ComposeForm extends ImmutablePureComponent {