]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/newnotice.php
Notice from web now saves context->attention too! ;)
[quix0rs-gnu-social.git] / actions / newnotice.php
index 4a864b25c3c926e2b2964c4892484096d69fb58e..f874e6f9cb3b268c1bc6fc5b9e847e0878e058d7 100644 (file)
@@ -145,8 +145,6 @@ class NewnoticeAction extends FormAction
             // simply no attached media to the new notice
         }
 
-        $content = $this->scoped->shortenLinks($content);
-
         // Reject notice if it is too long (without the HTML)
         // This is done after MediaFile::fromUpload etc. just to act the same as the ApiStatusesUpdateAction
         if (Notice::contentTooLong($content)) {
@@ -158,13 +156,6 @@ class NewnoticeAction extends FormAction
                                               Notice::maxContent()));
         }
 
-        $actobj = new ActivityObject();
-        $actobj->type = ActivityObject::NOTE;
-        $actobj->content = common_render_content($content, $this->scoped, $parent);
-
-        $act->objects[] = $actobj;
-
-
         $act->context = new ActivityContext();
 
         if ($parent instanceof Notice) {
@@ -191,15 +182,21 @@ class NewnoticeAction extends FormAction
             $act->context->location = Location::fromOptions($locOptions);
         }
 
-        $author_id = $this->scoped->id;
-        $text      = $content;
+        $content = $this->scoped->shortenLinks($content);
+
+        // FIXME: Make sure NoticeTitle plugin gets a change to add the title to our activityobject!
+        if (Event::handle('StartNoticeSaveWeb', array($this, $this->scoped, &$content, &$options))) {
 
-        // Does the heavy-lifting for getting "To:" information
+            // FIXME: We should be able to get the attentions from common_render_content!
+            // and maybe even directly save whether they're local or not!
+            $act->context->attention = common_find_attentions($content, $this->scoped, $parent);
 
-        ToSelector::fillOptions($this, $options);
+            $actobj = new ActivityObject();
+            $actobj->type = ActivityObject::NOTE;
+            $actobj->content = common_render_content($content, $this->scoped, $parent);
 
-        // FIXME: Make sure NoticeTitle plugin gets a change to add the title to our activityobject!
-        if (Event::handle('StartNoticeSaveWeb', array($this, &$author_id, &$text, &$options))) {
+            // Finally add the activity object to our activity
+            $act->objects[] = $actobj;
 
             $this->stored = Notice::saveActivity($act, $this->scoped, $options);