Skip to content

Commit

Permalink
NavigationController: Fix action unshare()
Browse files Browse the repository at this point in the history
refs #5600
  • Loading branch information
Johannes Meyer committed Sep 18, 2015
1 parent 19ebdcf commit bef5eed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
27 changes: 13 additions & 14 deletions application/controllers/NavigationController.php
Expand Up @@ -277,26 +277,25 @@ public function unshareAction()
'onSuccess' => function ($form) use ($navigationConfigForm) {
try {
$navigationConfigForm->unshare($form->getValue('name'));
if ($navigationConfigForm->save()) {
Notification::success(sprintf(
t('Navigation item "%s" has been unshared'),
$form->getValue('name')
));
} else {
// TODO: It failed obviously to write one of the configs, so we're leaving the user in
// a inconsistent state. Luckily, it's nothing lost but possibly duplicated...
Notification::error(sprintf(
t('Failed to unshare navigation item "%s"'),
$form->getValue('name')
));
}
} catch (NotFoundError $e) {
throw $e;
} catch (Exception $e) {
Notification::error($e->getMessage());
}

if ($navigationConfigForm->save()) {
Notification::success(sprintf(
t('Navigation item "%s" has been unshared'),
$form->getValue('name')
));
} else {
// TODO: It failed obviously to write one of the configs, so we're leaving the user in
// a inconsistent state. Luckily, it's nothing lost but possibly duplicated...
Notification::error(sprintf(
t('Failed to unshare navigation item "%s"'),
$form->getValue('name')
));
}

$redirect = $form->getValue('redirect');
if (! empty($redirect)) {
$form->setRedirectUrl(htmlspecialchars_decode($redirect));
Expand Down
4 changes: 2 additions & 2 deletions application/views/scripts/navigation/shared.phtml
Expand Up @@ -38,8 +38,8 @@
'block',
sprintf(
$this->translate(
'This is a child of the navigation item %s. You can'
. ' only unshare this item by unsharing its parent'
'This is a child of the navigation item %1$s. You can'
. ' only unshare this item by unsharing %1$s'
),
$item->parent
)
Expand Down

0 comments on commit bef5eed

Please sign in to comment.