]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add StartNoticeSaveWeb and EndNoticeSaveWeb to hook web-based UI for notices
authorEvan Prodromou <evan@status.net>
Fri, 13 Aug 2010 18:21:07 +0000 (11:21 -0700)
committerEvan Prodromou <evan@status.net>
Fri, 13 Aug 2010 18:21:07 +0000 (11:21 -0700)
EVENTS.txt
actions/newnotice.php

index 7784e7d42e6801cae55268d9ca9489ff2feea942..f34fcc3da02e3f938afaedf6118688c0fd5a2633 100644 (file)
@@ -1045,3 +1045,14 @@ StartActivityEnd: before the closing </entry> in a notice activity entry (last c
 EndActivityEnd: after the closing </entry> in a notice activity entry
 - &$notice: notice being output
 - &$xs: XMLStringer for output
+
+StartNoticeSaveWeb: before saving a notice through the Web interface
+- $action: action being executed (instance of NewNoticeAction)
+- &$authorId: integer ID of the author
+- &$text: text of the notice
+- &$options: additional options (location, replies, etc.)
+
+EndNoticeSaveWeb: after saving a notice through the Web interface
+- $action: action being executed (instance of NewNoticeAction)
+- $notice: notice that was saved
+
index 748d104ff9391de95bd017d1014dc2eb311a5e23..ca6355cbffdc64faccee35ae39407458d44451f0 100644 (file)
@@ -203,10 +203,18 @@ class NewnoticeAction extends Action
             $options = array_merge($options, $locOptions);
         }
 
-        $notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
+        $author_id = $user->id;
+        $text      = $content_shortened;
 
-        if (isset($upload)) {
-            $upload->attachToNotice($notice);
+        if (Event::handle('StartNoticeSaveWeb', array($this, &$author_id, &$text, &$options))) {
+
+            $notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
+
+            if (isset($upload)) {
+                $upload->attachToNotice($notice);
+            }
+
+            Event::handle('EndNoticeSaveWeb', array($this, $notice));
         }
 
         if ($this->boolean('ajax')) {