Fix redraft: don't set compose id
This commit is contained in:
parent
fa1259ff27
commit
6bdc9b4d2f
3 changed files with 7 additions and 4 deletions
|
@ -98,7 +98,7 @@ export const ensureComposeIsVisible = (getState, routerHistory) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setComposeToStatus(status, rawText, spoilerText, contentType) {
|
export function setComposeToStatus(status, rawText, spoilerText, contentType, withRedraft) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const { instance } = getState();
|
const { instance } = getState();
|
||||||
const { explicitAddressing } = getFeatures(instance);
|
const { explicitAddressing } = getFeatures(instance);
|
||||||
|
@ -111,6 +111,7 @@ export function setComposeToStatus(status, rawText, spoilerText, contentType) {
|
||||||
spoilerText,
|
spoilerText,
|
||||||
contentType,
|
contentType,
|
||||||
v: parseVersion(instance.version),
|
v: parseVersion(instance.version),
|
||||||
|
withRedraft,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ export const editStatus = (id) => (dispatch, getState) => {
|
||||||
|
|
||||||
api(getState).get(`/api/v1/statuses/${id}/source`).then(response => {
|
api(getState).get(`/api/v1/statuses/${id}/source`).then(response => {
|
||||||
dispatch({ type: STATUS_FETCH_SOURCE_SUCCESS });
|
dispatch({ type: STATUS_FETCH_SOURCE_SUCCESS });
|
||||||
dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text));
|
dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text, false));
|
||||||
dispatch(openModal('COMPOSE'));
|
dispatch(openModal('COMPOSE'));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({ type: STATUS_FETCH_SOURCE_FAIL, error });
|
dispatch({ type: STATUS_FETCH_SOURCE_FAIL, error });
|
||||||
|
@ -139,7 +139,7 @@ export function deleteStatus(id, routerHistory, withRedraft = false) {
|
||||||
dispatch(deleteFromTimelines(id));
|
dispatch(deleteFromTimelines(id));
|
||||||
|
|
||||||
if (withRedraft) {
|
if (withRedraft) {
|
||||||
dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text, response.data.pleroma?.content_type));
|
dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text, response.data.pleroma?.content_type, withRedraft));
|
||||||
dispatch(openModal('COMPOSE'));
|
dispatch(openModal('COMPOSE'));
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
|
@ -429,7 +429,9 @@ export default function compose(state = initialState, action) {
|
||||||
}));
|
}));
|
||||||
case COMPOSE_SET_STATUS:
|
case COMPOSE_SET_STATUS:
|
||||||
return state.withMutations(map => {
|
return state.withMutations(map => {
|
||||||
map.set('id', action.status.get('id'));
|
if (!action.withRedraft) {
|
||||||
|
map.set('id', action.status.get('id'));
|
||||||
|
}
|
||||||
map.set('text', action.rawText || unescapeHTML(expandMentions(action.status)));
|
map.set('text', action.rawText || unescapeHTML(expandMentions(action.status)));
|
||||||
map.set('to', action.explicitAddressing ? getExplicitMentions(action.status.get('account', 'id'), action.status) : ImmutableOrderedSet());
|
map.set('to', action.explicitAddressing ? getExplicitMentions(action.status.get('account', 'id'), action.status) : ImmutableOrderedSet());
|
||||||
map.set('in_reply_to', action.status.get('in_reply_to_id'));
|
map.set('in_reply_to', action.status.get('in_reply_to_id'));
|
||||||
|
|
Loading…
Reference in a new issue