Fix delete & redraft of pending posts (#37839)
This commit is contained in:
parent
83182f9e13
commit
ab9aa25cd3
@ -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) => {
|
return (dispatch, getState) => {
|
||||||
const maxOptions = getState().server.getIn(['server', 'configuration', 'polls', 'max_options']);
|
const maxOptions = getState().server.getIn(['server', 'configuration', 'polls', 'max_options']);
|
||||||
|
|
||||||
@ -117,6 +117,7 @@ export function redraft(status, raw_text) {
|
|||||||
type: REDRAFT,
|
type: REDRAFT,
|
||||||
status,
|
status,
|
||||||
raw_text,
|
raw_text,
|
||||||
|
quoted_status_id,
|
||||||
maxOptions,
|
maxOptions,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -169,7 +170,7 @@ export function deleteStatus(id, withRedraft = false) {
|
|||||||
dispatch(importFetchedAccount(response.data.account));
|
dispatch(importFetchedAccount(response.data.account));
|
||||||
|
|
||||||
if (withRedraft) {
|
if (withRedraft) {
|
||||||
dispatch(redraft(status, response.data.text));
|
dispatch(redraft(status, response.data.text, response.data.quote?.quoted_status?.id));
|
||||||
ensureComposeIsVisible(getState);
|
ensureComposeIsVisible(getState);
|
||||||
} else {
|
} else {
|
||||||
dispatch(showAlert({ message: messages.deleteSuccess }));
|
dispatch(showAlert({ message: messages.deleteSuccess }));
|
||||||
|
|||||||
@ -532,7 +532,7 @@ export const composeReducer = (state = initialState, action) => {
|
|||||||
map.set('sensitive', action.status.get('sensitive'));
|
map.set('sensitive', action.status.get('sensitive'));
|
||||||
map.set('language', action.status.get('language'));
|
map.set('language', action.status.get('language'));
|
||||||
map.set('id', null);
|
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
|
// 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');
|
map.set('quote_policy', action.status.getIn(['quote_approval', 'automatic', 0]) || 'nobody');
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ class REST::BaseQuoteSerializer < ActiveModel::Serializer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def quoted_status
|
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
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user