Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUGFIX: unify the response method for record deletions (os7212)

sessionMessage is an old way of returning responses - the consistent way
of doing this is now X-Status header, which then gets distrubuted via JS
in the CMS frontend.
  • Loading branch information...
commit 1f992c5e34bdba97847f300b165df783f7da6d63 1 parent de9005e
@mateusz mateusz authored
Showing with 10 additions and 14 deletions.
  1. +10 −14 code/controllers/CMSMain.php
View
24 code/controllers/CMSMain.php
@@ -888,17 +888,13 @@ public function deletefromlive($data, $form) {
$descRemoved = '';
}
- $form->sessionMessage(
- _t(
- 'CMSMain.REMOVED',
- 'Deleted \'{title}\'{additionalinfo} from live site',
- array('title' => $recordTitle, 'additionalinfo' => $descRemoved)
- ),
- 'good'
+ $this->response->addHeader(
+ 'X-Status',
+ sprintf(_t('CMSMain.REMOVED', 'Deleted \'%s\'%s from live site'), $recordTitle, $descRemoved)
);
-
+
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
- return $this->redirect(Controller::join_links($this->Link('show'), $recordID));
+ return $this->getResponseNegotiator()->respond($this->request);
}
/**
@@ -967,13 +963,13 @@ public function delete($data, $form) {
$recordID = $record->ID;
$record->delete();
- $form->sessionMessage(
- _t('CMSMain.REMOVEDPAGEFROMDRAFT',"Removed '{title}' from the draft site", array('title' => $record->Title)),
- 'good'
+ $this->response->addHeader(
+ 'X-Status',
+ sprintf(_t('CMSMain.REMOVEDPAGEFROMDRAFT',"Removed '%s' from the draft site"), $record->Title)
);
-
+
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
- return $this->redirect(Controller::join_links($this->Link('show'), $recordID));
+ return $this->getResponseNegotiator()->respond($this->request);
}
function publish($data, $form) {
Please sign in to comment.
Something went wrong with that request. Please try again.