forked from GNUsocial/gnu-social
Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
* '1.0.x' of gitorious.org:statusnet/mainline: fix scope for replies to group-private notices Direct events to users or groups
This commit is contained in:
commit
984869e5fb
@ -342,6 +342,12 @@ class Notice extends Memcached_DataObject
|
||||
$notice->uri = $uri;
|
||||
$notice->url = $url;
|
||||
|
||||
// Get the groups here so we can figure out replies and such
|
||||
|
||||
if (!isset($groups)) {
|
||||
$groups = self::groupsFromText($notice->content, $profile);
|
||||
}
|
||||
|
||||
$reply = null;
|
||||
|
||||
// Handle repeat case
|
||||
@ -394,6 +400,20 @@ class Notice extends Memcached_DataObject
|
||||
|
||||
$notice->reply_to = $reply->id;
|
||||
$notice->conversation = $reply->conversation;
|
||||
|
||||
// If the original is private to a group, and notice has no group specified,
|
||||
// make it to the same group(s)
|
||||
|
||||
if (empty($groups) && ($reply->scope | Notice::GROUP_SCOPE)) {
|
||||
$groups = array();
|
||||
$replyGroups = $reply->getGroups();
|
||||
foreach ($replyGroups as $group) {
|
||||
if ($profile->isMember($group)) {
|
||||
$groups[] = $group->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scope set below
|
||||
}
|
||||
}
|
||||
@ -444,10 +464,6 @@ class Notice extends Memcached_DataObject
|
||||
|
||||
// Force the scope for private groups
|
||||
|
||||
if (!isset($groups)) {
|
||||
$groups = self::groupsFromText($notice->content, $profile);
|
||||
}
|
||||
|
||||
foreach ($groups as $groupId) {
|
||||
$group = User_group::staticGet('id', $groupId);
|
||||
if (!empty($group)) {
|
||||
|
@ -147,6 +147,13 @@ class EventForm extends Form
|
||||
_m('Description of the event.'));
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$toWidget = new ToSelector($this->out,
|
||||
common_current_user(),
|
||||
null);
|
||||
$toWidget->show();
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
$this->out->elementEnd('fieldset');
|
||||
}
|
||||
|
@ -190,6 +190,12 @@ class NeweventAction extends Action
|
||||
throw new ClientException(_m('Event must have an end time.'));
|
||||
}
|
||||
|
||||
$options = array();
|
||||
|
||||
// Does the heavy-lifting for getting "To:" information
|
||||
|
||||
ToSelector::fillOptions($this, $options);
|
||||
|
||||
$profile = $this->user->getProfile();
|
||||
|
||||
$saved = Happening::saveNew($profile,
|
||||
@ -198,7 +204,8 @@ class NeweventAction extends Action
|
||||
$this->title,
|
||||
$this->location,
|
||||
$this->description,
|
||||
$this->url);
|
||||
$this->url,
|
||||
$options);
|
||||
|
||||
$event = Happening::fromNotice($saved);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user