- $notice = Notice::staticGet('uri', $context->replyToID);
- if (empty($notice)) {
- // TRANS: Client exception.
- throw new ClientException(_m('In reply to unknown notice.'));
- }
- if ($notice->profile_id != $this->user->id &&
- !in_array($this->user->id, $notice->getReplies())) {
- // TRANS: Client exception.
- throw new ClientException(_m('In reply to a notice not by this user and not mentioning this user.'));
- }
- } else if (!empty($context->attention)) {
- if (!in_array($this->user->uri, $context->attention) &&
- !in_array(common_profile_url($this->user->nickname), $context->attention)) {
- common_log(LOG_ERR, "{$this->user->uri} not in attention list (".implode(',', $context->attention).")");
- // TRANS: Client exception.
- throw new ClientException('To the attention of user(s), not including this one.');
- }
+ $notice = Notice::getKV('uri', $context->replyToID);
+ }
+
+ if ($notice instanceof Notice &&
+ ($notice->profile_id == $this->target->id ||
+ array_key_exists($this->target->id, $notice->getReplies())))
+ {
+ // In reply to a notice either from or mentioning this user.
+ } elseif (!empty($context->attention) &&
+ array_key_exists($this->target->getUri(), $context->attention)) {
+ // To the attention of this user.