Composer quote improvements (#35835)
Co-authored-by: Claire <claire.github-309c@sitedethib.com> Co-authored-by: diondiondion <mail@diondiondion.com>
This commit is contained in:
parent
e770303968
commit
f85f0eee1b
15 changed files with 371 additions and 96 deletions
|
|
@ -2,9 +2,9 @@ import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrde
|
|||
|
||||
import {
|
||||
changeUploadCompose,
|
||||
quoteComposeByStatus,
|
||||
quoteCompose,
|
||||
quoteComposeCancel,
|
||||
setQuotePolicy,
|
||||
setComposeQuotePolicy,
|
||||
} from 'mastodon/actions/compose_typed';
|
||||
import { timelineDelete } from 'mastodon/actions/timelines_typed';
|
||||
|
||||
|
|
@ -329,22 +329,15 @@ export const composeReducer = (state = initialState, action) => {
|
|||
return state.set('is_changing_upload', true);
|
||||
} else if (changeUploadCompose.rejected.match(action)) {
|
||||
return state.set('is_changing_upload', false);
|
||||
} else if (quoteComposeByStatus.match(action)) {
|
||||
} else if (quoteCompose.match(action)) {
|
||||
const status = action.payload;
|
||||
if (
|
||||
status.getIn(['quote_approval', 'current_user']) === 'automatic' &&
|
||||
state.get('media_attachments').size === 0 &&
|
||||
!state.get('is_uploading') &&
|
||||
!state.get('poll')
|
||||
) {
|
||||
return state
|
||||
.set('quoted_status_id', status.get('id'))
|
||||
.set('spoiler', status.get('sensitive'))
|
||||
.set('spoiler_text', status.get('spoiler_text'));
|
||||
}
|
||||
return state
|
||||
.set('quoted_status_id', status.get('id'))
|
||||
.set('spoiler', status.get('sensitive'))
|
||||
.set('spoiler_text', status.get('spoiler_text'));
|
||||
} else if (quoteComposeCancel.match(action)) {
|
||||
return state.set('quoted_status_id', null);
|
||||
} else if (setQuotePolicy.match(action)) {
|
||||
} else if (setComposeQuotePolicy.match(action)) {
|
||||
return state.set('quote_policy', action.payload);
|
||||
}
|
||||
|
||||
|
|
@ -520,6 +513,7 @@ export const composeReducer = (state = initialState, action) => {
|
|||
map.set('sensitive', action.status.get('sensitive'));
|
||||
map.set('language', action.status.get('language'));
|
||||
map.set('id', null);
|
||||
map.set('quoted_status_id', action.status.getIn(['quote', 'quoted_status']));
|
||||
// Mastodon-authored posts can be expected to have at most one automatic approval policy
|
||||
map.set('quote_policy', action.status.getIn(['quote_approval', 'automatic', 0]) || 'nobody');
|
||||
|
||||
|
|
@ -551,6 +545,7 @@ export const composeReducer = (state = initialState, action) => {
|
|||
map.set('idempotencyKey', uuid());
|
||||
map.set('sensitive', action.status.get('sensitive'));
|
||||
map.set('language', action.status.get('language'));
|
||||
map.set('quoted_status_id', action.status.getIn(['quote', 'quoted_status']));
|
||||
// Mastodon-authored posts can be expected to have at most one automatic approval policy
|
||||
map.set('quote_policy', action.status.getIn(['quote_approval', 'automatic', 0]) || 'nobody');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue