]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Use raw content if available on Delete & Redraft
authorThibG <thib@sitedethib.com>
Sat, 11 May 2019 04:46:43 +0000 (06:46 +0200)
committerThibaut Girka <thib@sitedethib.com>
Sat, 11 May 2019 19:46:23 +0000 (21:46 +0200)
Port front-end changes from 6d44f2441bf2aa14d11e481d9d2cfe82a74d81ed to glitch-soc

app/javascript/flavours/glitch/actions/statuses.js
app/javascript/flavours/glitch/reducers/compose.js

index 4eabc4be0b9b4ca01ce00025c97e4aa17ba25f24..550fe510fc3a76c185383f6ba137b60c550129ae 100644 (file)
@@ -71,10 +71,11 @@ export function fetchStatusFail(id, error, skipLoading) {
   };
 };
 
-export function redraft(status) {
+export function redraft(status, raw_text) {
   return {
     type: REDRAFT,
     status,
+    raw_text,
   };
 };
 
@@ -88,12 +89,12 @@ export function deleteStatus(id, router, withRedraft = false) {
 
     dispatch(deleteStatusRequest(id));
 
-    api(getState).delete(`/api/v1/statuses/${id}`).then(() => {
+    api(getState).delete(`/api/v1/statuses/${id}`).then(response => {
       dispatch(deleteStatusSuccess(id));
       dispatch(deleteFromTimelines(id));
 
       if (withRedraft) {
-        dispatch(redraft(status));
+        dispatch(redraft(status, response.data.text));
 
         if (!getState().getIn(['compose', 'mounted'])) {
           router.push('/statuses/new');
index 009e1fee7d52fd3f493af5ce65a6d97877c67c75..bc1785a480de2b1db41b24029962de65a287039e 100644 (file)
@@ -426,7 +426,7 @@ export default function compose(state = initialState, action) {
     return state.mergeIn(['doodle'], action.options);
   case REDRAFT:
     return state.withMutations(map => {
-      map.set('text', unescapeHTML(expandMentions(action.status)));
+      map.set('text', action.raw_text || unescapeHTML(expandMentions(action.status)));
       map.set('in_reply_to', action.status.get('in_reply_to_id'));
       map.set('privacy', action.status.get('visibility'));
       map.set('media_attachments', action.status.get('media_attachments'));