We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

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> ...@@ -1077,4 +1077,12 @@ StartShowPageTitle: when beginning to show the page title <h1>
- $action: action being shown - $action: action being shown
EndShowPageTitle: when done showing the page title <h1> EndShowPageTitle: when done showing the page title <h1>
- $action: action being shown - $action: action being shown
\ No newline at end of file
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 ...@@ -125,10 +125,10 @@ class ApiStatusesDestroyAction extends ApiAuthAction
} }
if ($this->user->id == $this->notice->profile_id) { if ($this->user->id == $this->notice->profile_id) {
$replies = new Reply; if (Event::handle('StartDeleteOwnNotice', array($this->user, $this->notice))) {
$replies->get('notice_id', $this->notice_id); $this->notice->delete();
$replies->delete(); Event::handle('EndDeleteOwnNotice', array($this->user, $this->notice));
$this->notice->delete(); }
$this->showNotice(); $this->showNotice();
} else { } else {
$this->clientError( $this->clientError(
......
...@@ -172,7 +172,10 @@ class DeletenoticeAction extends Action ...@@ -172,7 +172,10 @@ class DeletenoticeAction extends Action
} }
if ($this->arg('yes')) { 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(); $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