Fix delete & redraft of pending posts (#37839)

This commit is contained in:
Claire 2026-02-13 11:32:16 +01:00 committed by GitHub
parent 83182f9e13
commit ab9aa25cd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View File

@ -109,7 +109,7 @@ export function fetchStatusFail(id, error, skipLoading, parentQuotePostId) {
};
}
export function redraft(status, raw_text) {
export function redraft(status, raw_text, quoted_status_id = null) {
return (dispatch, getState) => {
const maxOptions = getState().server.getIn(['server', 'configuration', 'polls', 'max_options']);
@ -117,6 +117,7 @@ export function redraft(status, raw_text) {
type: REDRAFT,
status,
raw_text,
quoted_status_id,
maxOptions,
});
};
@ -169,7 +170,7 @@ export function deleteStatus(id, withRedraft = false) {
dispatch(importFetchedAccount(response.data.account));
if (withRedraft) {
dispatch(redraft(status, response.data.text));
dispatch(redraft(status, response.data.text, response.data.quote?.quoted_status?.id));
ensureComposeIsVisible(getState);
} else {
dispatch(showAlert({ message: messages.deleteSuccess }));

View File

@ -532,7 +532,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'], null));
map.set('quoted_status_id', action.quoted_status_id);
// 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');

View File

@ -13,7 +13,7 @@ class REST::BaseQuoteSerializer < ActiveModel::Serializer
end
def quoted_status
object.quoted_status if object.accepted? && object.quoted_status.present? && !object.quoted_status&.reblog? && status_filter.filter_state_for_quote != 'unauthorized'
object.quoted_status if (object.accepted? || instance_options[:source_requested]) && object.quoted_status.present? && !object.quoted_status&.reblog? && status_filter.filter_state_for_quote != 'unauthorized'
end
private