[Glitch] Change paste-link-to-quote loading state from generic loading bar to compose placeholder

Port cfdd9396c0 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Claire
2025-11-04 20:20:39 +01:00
parent 2d958cb909
commit cdad6ee0c9
5 changed files with 99 additions and 13 deletions

View File

@@ -6,6 +6,8 @@ import {
quoteCompose,
quoteComposeCancel,
setComposeQuotePolicy,
pasteLinkCompose,
cancelPasteLinkCompose,
} from '@/flavours/glitch/actions/compose_typed';
import { timelineDelete } from 'flavours/glitch/actions/timelines_typed';
@@ -119,6 +121,7 @@ const initialState = ImmutableMap({
quoted_status_id: null,
quote_policy: 'public',
default_quote_policy: 'public', // Set in hydration.
fetching_link: null,
});
const initialPoll = ImmutableMap({
@@ -426,6 +429,12 @@ export const composeReducer = (state = initialState, action) => {
return state.set('quoted_status_id', null);
} else if (setComposeQuotePolicy.match(action)) {
return state.set('quote_policy', action.payload);
} else if (pasteLinkCompose.pending.match(action)) {
return state.set('fetching_link', action.meta.requestId);
} else if (pasteLinkCompose.fulfilled.match(action) || pasteLinkCompose.rejected.match(action)) {
return action.meta.requestId === state.get('fetching_link') ? state.set('fetching_link', null) : state;
} else if (cancelPasteLinkCompose.match(action)) {
return state.set('fetching_link', null);
}
switch(action.type) {