- if (!empty($notice->reply_to)) {
- $reply = Notice::staticGet('id', $notice->reply_to);
- if (!$reply->inScope($profile)) {
- // TRANS: Client error displayed when trying to reply to a notice a the target has no access to.
- // TRANS: %1$s is a user nickname, %2$d is a notice ID (number).
- throw new ClientException(sprintf(_('%1$s has no access to notice %2$d.'),
- $profile->nickname, $reply->id), 403);
+ $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