+
+ // Check for a private one
+
+ $repeat = Notice::staticGet('id', $repeat_of);
+
+ if (empty($repeat)) {
+ // TRANS: Client exception thrown in notice when trying to repeat a missing or deleted notice.
+ throw new ClientException(_('Cannot repeat; original notice is missing or deleted.'));
+ }
+
+ if ($profile->id == $repeat->profile_id) {
+ // TRANS: Client error displayed when trying to repeat an own notice.
+ throw new ClientException(_('You cannot repeat your own notice.'));
+ }
+
+ if ($repeat->scope != Notice::SITE_SCOPE &&
+ $repeat->scope != Notice::PUBLIC_SCOPE) {
+ // TRANS: Client error displayed when trying to repeat a non-public notice.
+ throw new ClientException(_('Cannot repeat a private notice.'), 403);
+ }
+
+ if (!$repeat->inScope($profile)) {
+ // The generic checks above should cover this, but let's be sure!
+ // TRANS: Client error displayed when trying to repeat a notice you cannot access.
+ throw new ClientException(_('Cannot repeat a notice you cannot read.'), 403);
+ }
+
+ if ($profile->hasRepeated($repeat->id)) {
+ // TRANS: Client error displayed when trying to repeat an already repeated notice.
+ throw new ClientException(_('You already repeated that notice.'));
+ }
+