From: Mikael Nordfeldth Date: Wed, 17 Feb 2016 22:44:15 +0000 (+0100) Subject: Use ToSelector choice again. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=73dbc5ca1b203758693f73d6423fea71ef6b6fb6;hp=d9b649642d6e7cf365f1b62d65d2628b9cf049d9;p=quix0rs-gnu-social.git Use ToSelector choice again. --- diff --git a/actions/newnotice.php b/actions/newnotice.php index 298361d600..6ee2092061 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -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); diff --git a/lib/toselector.php b/lib/toselector.php index aed38e1cf6..85747b70e9 100644 --- a/lib/toselector.php +++ b/lib/toselector.php @@ -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