From 255e96d3b5cd86a1e7b4f759e4ab3088b195f005 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 8 Sep 2010 16:37:12 -0400 Subject: add a hook for when someone deletes their own notice --- actions/apistatusesdestroy.php | 8 ++++---- actions/deletenotice.php | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'actions') diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php index 0dfeb4812..485eae66e 100644 --- a/actions/apistatusesdestroy.php +++ b/actions/apistatusesdestroy.php @@ -125,10 +125,10 @@ class ApiStatusesDestroyAction extends ApiAuthAction } if ($this->user->id == $this->notice->profile_id) { - $replies = new Reply; - $replies->get('notice_id', $this->notice_id); - $replies->delete(); - $this->notice->delete(); + if (Event::handle('StartDeleteOwnNotice', array($this->user, $this->notice))) { + $this->notice->delete(); + Event::handle('EndDeleteOwnNotice', array($this->user, $this->notice)); + } $this->showNotice(); } else { $this->clientError( diff --git a/actions/deletenotice.php b/actions/deletenotice.php index f8010a814..68c43040b 100644 --- a/actions/deletenotice.php +++ b/actions/deletenotice.php @@ -172,7 +172,10 @@ class DeletenoticeAction extends Action } if ($this->arg('yes')) { - $this->notice->delete(); + if (Event::handle('StartDeleteOwnNotice', array($this->user, $this->notice))) { + $this->notice->delete(); + Event::handle('EndDeleteOwnNotice', array($this->user, $this->notice)); + } } $url = common_get_returnto(); -- cgit v1.2.3-54-g00ecf