- // This is weird.
- $orig = clone($notice);
- $notice->profile_id = $user->id;
- $notice->update($orig);
- return;
+
+ common_log(LOG_INFO, "Notice {$sourceUri} already exists.");
+
+ if ($this->trusted) {
+
+ $profile = $notice->getProfile();
+
+ $uri = $profile->getUri();
+
+ if ($uri == $author->id) {
+ common_log(LOG_INFO, "Updating notice author from $author->id to $user->uri");
+ $orig = clone($notice);
+ $notice->profile_id = $user->id;
+ $notice->update($orig);
+ return;
+ } else {
+ throw new ClientException(sprintf(_("Already know about notice %s and ".
+ " it's got a different author %s."),
+ $sourceUri, $uri));
+ }
+ }