forked from GNUsocial/gnu-social
fix scope for replies to group-private notices
This commit is contained in:
parent
a9856e6550
commit
797cd9ccd4
@ -342,6 +342,12 @@ class Notice extends Memcached_DataObject
|
|||||||
$notice->uri = $uri;
|
$notice->uri = $uri;
|
||||||
$notice->url = $url;
|
$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;
|
$reply = null;
|
||||||
|
|
||||||
// Handle repeat case
|
// Handle repeat case
|
||||||
@ -394,6 +400,20 @@ class Notice extends Memcached_DataObject
|
|||||||
|
|
||||||
$notice->reply_to = $reply->id;
|
$notice->reply_to = $reply->id;
|
||||||
$notice->conversation = $reply->conversation;
|
$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
|
// Scope set below
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -444,10 +464,6 @@ class Notice extends Memcached_DataObject
|
|||||||
|
|
||||||
// Force the scope for private groups
|
// Force the scope for private groups
|
||||||
|
|
||||||
if (!isset($groups)) {
|
|
||||||
$groups = self::groupsFromText($notice->content, $profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($groups as $groupId) {
|
foreach ($groups as $groupId) {
|
||||||
$group = User_group::staticGet('id', $groupId);
|
$group = User_group::staticGet('id', $groupId);
|
||||||
if (!empty($group)) {
|
if (!empty($group)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user