mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-14 16:28:59 +00:00
[Glitch] Update Redux to handle quote posts
Port 8ee4b3f906 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
|
||||
|
||||
import { changeUploadCompose } from 'flavours/glitch/actions/compose_typed';
|
||||
import {
|
||||
changeUploadCompose,
|
||||
quoteComposeByStatus,
|
||||
quoteComposeCancel,
|
||||
setQuotePolicy,
|
||||
} from 'flavours/glitch/actions/compose_typed';
|
||||
import { timelineDelete } from 'flavours/glitch/actions/timelines_typed';
|
||||
|
||||
import {
|
||||
@@ -109,6 +114,11 @@ const initialState = ImmutableMap({
|
||||
adaptiveStroke: true,
|
||||
smoothing: false,
|
||||
}),
|
||||
|
||||
// Quotes
|
||||
quoted_status_id: null,
|
||||
quote_policy: 'public',
|
||||
default_quote_policy: 'public', // Set in hydration.
|
||||
});
|
||||
|
||||
const initialPoll = ImmutableMap({
|
||||
@@ -169,6 +179,8 @@ function clearAll(state) {
|
||||
map.set('progress', 0);
|
||||
map.set('poll', null);
|
||||
map.set('idempotencyKey', uuid());
|
||||
map.set('quoted_status_id', null);
|
||||
map.set('quote_policy', state.get('default_quote_policy'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -393,6 +405,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)) {
|
||||
const status = action.payload;
|
||||
if (status.getIn(['quote_approval', 'current_user']) === 'automatic') {
|
||||
return state.set('quoted_status_id', status.get('id'));
|
||||
}
|
||||
} else if (quoteComposeCancel.match(action)) {
|
||||
return state.set('quoted_status_id', null);
|
||||
} else if (setQuotePolicy.match(action)) {
|
||||
return state.set('quote_policy', action.payload);
|
||||
}
|
||||
|
||||
switch(action.type) {
|
||||
|
||||
Reference in New Issue
Block a user