]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add a hook for when someone deletes their own notice
authorEvan Prodromou <evan@status.net>
Wed, 8 Sep 2010 20:37:12 +0000 (16:37 -0400)
committerEvan Prodromou <evan@status.net>
Wed, 8 Sep 2010 20:37:12 +0000 (16:37 -0400)
EVENTS.txt
actions/apistatusesdestroy.php
actions/deletenotice.php

index 65e2c3ce0385de7c153e739e06597a9a6d676e83..fd2bdb9d566dffe123d8ad6a12cd72d480aeaec8 100644 (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
\ 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
index 0dfeb48122df5e8efa43992e5408f26d411aa59e..485eae66eab0c304c0816f828159bc137b029917 100644 (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(
index f8010a814a330f57ae5da3e82b73d16566da017b..68c43040b0a30e85923fbbf180c9e35521b72a37 100644 (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();