From 7b397b14521b34f96acfa7508dba811a1274209d Mon Sep 17 00:00:00 2001 From: Zac Anger Date: Mon, 17 Apr 2017 12:30:38 -0600 Subject: [PATCH] Return early from submit if no text. (#1962) --- app/assets/javascripts/components/actions/compose.jsx | 6 +++++- app/assets/javascripts/components/locales/no.jsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/components/actions/compose.jsx b/app/assets/javascripts/components/actions/compose.jsx index 88e91c356f7..de75ddabe8e 100644 --- a/app/assets/javascripts/components/actions/compose.jsx +++ b/app/assets/javascripts/components/actions/compose.jsx @@ -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']), diff --git a/app/assets/javascripts/components/locales/no.jsx b/app/assets/javascripts/components/locales/no.jsx index 43715fb5ca8..c89c5ede646 100644 --- a/app/assets/javascripts/components/locales/no.jsx +++ b/app/assets/javascripts/components/locales/no.jsx @@ -33,7 +33,7 @@ const no = { "empty_column.community": "Den lokale tidslinjen er tom. Skriv noe offentlig for å få snøballen til å rulle!", "empty_column.hashtag": "Det er ingenting i denne hashtagen ennå.", "empty_column.home.public_timeline": "en offentlig tidslinje", - "empty_column.home": "Du har ikke fulgt noen ennå. Besøk {publlic} eller bruk søk for å komme i gang og møte andre brukere.", + "empty_column.home": "Du har ikke fulgt noen ennå. Besøk {publlic} eller bruk søk for å komme i gang og møte andre brukere.", "empty_column.notifications": "Du har ingen varsler ennå. Kommuniser med andre for å begynne samtalen.", "empty_column.public": "Det er ingenting her! Skriv noe offentlig, eller følg brukere manuelt fra andre instanser for å fylle den opp", "follow_request.authorize": "Autorisér",