add a hook for when someone deletes their own notice

This commit is contained in:
Evan Prodromou 2010-09-08 16:37:12 -04:00
parent e40ed1fd56
commit 255e96d3b5
3 changed files with 17 additions and 6 deletions

View File

@ -1077,4 +1077,12 @@ StartShowPageTitle: when beginning to show the page title <h1>
- $action: action being shown
EndShowPageTitle: when done showing the page title <h1>
- $action: action being shown
- $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

View File

@ -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(

View File

@ -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();