Remove text requirement when media attached from statuses (fixes #381)

Ports cfa9b6e13a to glitchsoc
This commit is contained in:
Thibaut Girka
2018-03-12 18:39:07 +01:00
parent a0724cd742
commit 841ef606a9
4 changed files with 19 additions and 7 deletions

View File

@ -102,8 +102,9 @@ export function mentionCompose(account, router) {
export function submitCompose() {
return function (dispatch, getState) {
let status = getState().getIn(['compose', 'text'], '');
let media = getState().getIn(['compose', 'media_attachments']);
if (!status || !status.length) {
if ((!status || !status.length) && media.size === 0) {
return;
}
@ -114,7 +115,7 @@ export function submitCompose() {
api(getState).post('/api/v1/statuses', {
status,
in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
media_ids: getState().getIn(['compose', 'media_attachments']).map(item => item.get('id')),
media_ids: media.map(item => item.get('id')),
sensitive: getState().getIn(['compose', 'sensitive']),
spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''),
visibility: getState().getIn(['compose', 'privacy']),