Commit 255e96d3 authored by Evan Prodromou's avatar Evan Prodromou

add a hook for when someone deletes their own notice

parent e40ed1fd
......@@ -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
\ 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
......@@ -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(
......
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment