]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Use ToSelector choice again.
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 17 Feb 2016 22:44:15 +0000 (23:44 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 17 Feb 2016 22:44:15 +0000 (23:44 +0100)
actions/newnotice.php
lib/toselector.php

index 298361d6003a614a2be287ffbdd9c2bc66fe3672..6ee209206110ccbfcca611837a08e2e2f82aee1b 100644 (file)
@@ -190,6 +190,9 @@ class NewnoticeAction extends FormAction
             // and maybe even directly save whether they're local or not!
             $act->context->attention = common_get_attentions($content, $this->scoped, $parent);
 
+            // $options gets filled with possible scoping settings
+            ToSelector::fillActivity($this, $act, $options);
+
             $actobj = new ActivityObject();
             $actobj->type = ActivityObject::NOTE;
             $actobj->content = common_render_content($content, $this->scoped, $parent);
index aed38e1cf6f1f833108d74c6db689dbd74724e68..85747b70e9724885ab89027ed3916e8d6edc7895 100644 (file)
@@ -136,6 +136,26 @@ class ToSelector extends Widget
         $this->out->elementEnd('span');
     }
 
+    static function fillActivity(Action $action, Activity $act, array &$options)
+    {
+        if (!$act->context instanceof ActivityContext) {
+            $act->context = new ActivityContext();
+        }
+        self::fillOptions($action, $options);
+        if (isset($options['groups'])) {
+            foreach ($options['groups'] as $group_id) {
+                $group = User_group::getByID($group_id);
+                $act->context->attention[$group->getUri()] = $group->getObjectType();
+            }
+        }
+        if (isset($options['replies'])) {
+            foreach ($options['replies'] as $profile_uri) {
+                $profile = Profile::fromUri($profile_uri);
+                $act->context->attention[$profile->getUri()] = $profile->getObjectType();
+            }
+        }
+    }
+
     static function fillOptions($action, &$options)
     {
         // XXX: make arg name selectable