diff --git a/EVENTS.txt b/EVENTS.txt index 65e2c3ce03..fd2bdb9d56 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -1077,4 +1077,12 @@ StartShowPageTitle: when beginning to show the page title

- $action: action being shown EndShowPageTitle: when done showing the page title

-- $action: action being shown \ No newline at end of file +- $action: action being shown + +StartDeleteOwnNotice: when a user starts to delete their own notice +- $user: the user doing the delete +- $notice: the notice being deleted + +EndDeleteOwnNotice: when a user has deleted their own notice +- $user: the user doing the delete +- $notice: the notice being deleted diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php index 0dfeb48122..485eae66ea 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 f8010a814a..68c43040b0 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();