Merge commit '40242fafee83cf9a6bcb2d0ac1e228827969402f' into glitch-soc/merge-upstream
This commit is contained in:
commit
6abe6cdef5
46 files changed
+441
-58
No files matched your search
@@ -1,7 +1,10 @@
|
||||
import { defineMessages } from 'react-intl';
|
||||
|
||||
import { browserHistory } from 'mastodon/components/router';
|
||||
|
||||
import api from '../api';
|
||||
|
||||
import { showAlert } from './alerts';
|
||||
import { ensureComposeIsVisible, setComposeToStatus } from './compose';
|
||||
import { importFetchedStatus, importFetchedAccount } from './importer';
|
||||
import { fetchContext } from './statuses_typed';
|
||||
@@ -40,6 +43,10 @@ export const STATUS_TRANSLATE_SUCCESS = 'STATUS_TRANSLATE_SUCCESS';
|
||||
export const STATUS_TRANSLATE_FAIL = 'STATUS_TRANSLATE_FAIL';
|
||||
export const STATUS_TRANSLATE_UNDO = 'STATUS_TRANSLATE_UNDO';
|
||||
|
||||
const messages = defineMessages({
|
||||
deleteSuccess: { id: 'status.delete.success', defaultMessage: 'Post deleted' },
|
||||
});
|
||||
|
||||
export function fetchStatusRequest(id, skipLoading) {
|
||||
return {
|
||||
type: STATUS_FETCH_REQUEST,
|
||||
@@ -154,7 +161,7 @@ export function deleteStatus(id, withRedraft = false) {
|
||||
|
||||
dispatch(deleteStatusRequest(id));
|
||||
|
||||
api().delete(`/api/v1/statuses/${id}`, { params: { delete_media: !withRedraft } }).then(response => {
|
||||
return api().delete(`/api/v1/statuses/${id}`, { params: { delete_media: !withRedraft } }).then(response => {
|
||||
dispatch(deleteStatusSuccess(id));
|
||||
dispatch(deleteFromTimelines(id));
|
||||
dispatch(importFetchedAccount(response.data.account));
|
||||
@@ -162,9 +169,14 @@ export function deleteStatus(id, withRedraft = false) {
|
||||
if (withRedraft) {
|
||||
dispatch(redraft(status, response.data.text));
|
||||
ensureComposeIsVisible(getState);
|
||||
} else {
|
||||
dispatch(showAlert({ message: messages.deleteSuccess }));
|
||||
}
|
||||
|
||||
return response;
|
||||
}).catch(error => {
|
||||
dispatch(deleteStatusFail(id, error));
|
||||
throw error;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user