From 0d34cd24abc0329aae7d408b3bab3d692caaa045 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 24 Jan 2009 19:38:40 +0100 Subject: Update notice deletion Changed the errors in notice deletion so it now works. Also, consistently delete records from related tables that refer to the notice. --- actions/deletenotice.php | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) (limited to 'actions/deletenotice.php') diff --git a/actions/deletenotice.php b/actions/deletenotice.php index d8bc5d0e0..d4b8e50e5 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -111,15 +111,8 @@ class DeletenoticeAction extends DeleteAction $this->elementStart('p'); $this->element('span', array('id' => 'confirmation_text'), _('Are you sure you want to delete this notice?')); - - $this->element('input', array('id' => 'submit_no', - 'name' => 'submit', - 'type' => 'submit', - 'value' => _('No'))); - $this->element('input', array('id' => 'submit_yes', - 'name' => 'submit', - 'type' => 'submit', - 'value' => _('Yes'))); + $this->submit('yes', _('Yes')); + $this->submit('no', _('No')); $this->elementEnd('p'); $this->elementEnd('form'); } @@ -135,31 +128,18 @@ class DeletenoticeAction extends DeleteAction return; } - $url = common_get_returnto(); - $confirmed = $this->trimmed('submit'); - - if ($confirmed == _('Yes')) { - - $replies = new Reply; - $replies->get('notice_id', $this->notice->id); - - common_dequeue_notice($this->notice); - - if (common_config('memcached', 'enabled')) { - $notice->blowSubsCache(); - } - - $replies->delete(); + if ($this->arg('yes')) { $this->notice->delete(); + } - } else { + $url = common_get_returnto(); - if ($url) { - common_set_returnto(null); - } else { - $url = common_local_url('public'); - } + if ($url) { + common_set_returnto(null); + } else { + $url = common_local_url('public'); } + common_redirect($url); } } -- cgit v1.2.3-54-g00ecf