X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Ftoselector.php;h=153d9001b54aef0882e291168083db9882d01638;hb=8b78e01d4c4b9512a7b74efa52fcaf37de0dc6f1;hp=bcbfe86ec96ca55c903cd4df874f7f6ff3f0b108;hpb=ad86eb78d3dc395b438d1543a36eca509f53e9d4;p=quix0rs-gnu-social.git diff --git a/lib/toselector.php b/lib/toselector.php index bcbfe86ec9..153d9001b5 100644 --- a/lib/toselector.php +++ b/lib/toselector.php @@ -87,14 +87,13 @@ class ToSelector extends Widget $choices['public:everyone'] = _m('SENDTO','Everyone'); $default = 'public:everyone'; } - // XXX: better name...? // TRANS: Option in drop-down of potential addressees. // TRANS: %s is a StatusNet sitename. - $choices['public:site'] = sprintf(_('My colleagues at %s'), common_config('site', 'name')); + $choices['public:site'] = sprintf(_('Everyone at %s'), common_config('site', 'name')); $groups = $this->user->getGroups(); - while ($groups->fetch()) { + while ($groups instanceof User_group && $groups->fetch()) { $value = 'group:'.$groups->id; if (($this->to instanceof User_group) && $this->to->id == $groups->id) { $default = $value; @@ -102,7 +101,16 @@ class ToSelector extends Widget $choices[$value] = $groups->getBestName(); } - // XXX: add users...? + // Add subscribed users to dropdown menu + $users = $this->user->getSubscribed(); + while ($users->fetch()) { + $value = 'profile:'.$users->id; + if ($this->user->streamNicknames()) { + $choices[$value] = $users->getNickname(); + } else { + $choices[$value] = $users->getBestName(); + } + } if ($this->to instanceof Profile) { $value = 'profile:'.$this->to->id; @@ -132,6 +140,10 @@ class ToSelector extends Widget $toArg = $action->trimmed('notice_to'); $private = $action->boolean('notice_private'); + if (empty($toArg)) { + return; + } + list($prefix, $value) = explode(':', $toArg); switch ($prefix) { case 'group': @@ -141,8 +153,8 @@ class ToSelector extends Widget } break; case 'profile': - $profile = Profile::staticGet('id', $value); - $options['replies'] = $profile->getUri(); + $profile = Profile::getKV('id', $value); + $options['replies'] = array($profile->getUri()); if ($private) { $options['scope'] = Notice::ADDRESSEE_SCOPE; }