Return early from submit if no text. (#1962)

th-downstream
Zac Anger 8 years ago committed by Eugen
parent 7abb3b1b2e
commit 137be0dfc0

@ -73,9 +73,13 @@ export function mentionCompose(account, router) {
export function submitCompose() {
return function (dispatch, getState) {
const status = emojione.shortnameToUnicode(getState().getIn(['compose', 'text'], ''));
if (!status || !status.length) {
return;
}
dispatch(submitComposeRequest());
api(getState).post('/api/v1/statuses', {
status: emojione.shortnameToUnicode(getState().getIn(['compose', 'text'], '')),
status,
in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
media_ids: getState().getIn(['compose', 'media_attachments']).map(item => item.get('id')),
sensitive: getState().getIn(['compose', 'sensitive']),

Loading…
Cancel
Save