add a hook for when someone deletes their own notice
This commit is contained in:
parent
e40ed1fd56
commit
255e96d3b5
10
EVENTS.txt
10
EVENTS.txt
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user