Commit 0ac71c2b authored by mmn's avatar mmn

Duplicate URI means we have it already, I assume

parent 83c112e2
......@@ -780,7 +780,9 @@ class Notice extends Managed_DataObject
$stored->uri = $uri;
if ($stored->find()) {
common_debug('cannot create duplicate Notice URI: '.$stored->uri);
throw new Exception('Notice URI already exists');
// I _assume_ saving a Notice with a colliding URI means we're really trying to
// save the same notice again...
throw new AlreadyFulfilledException('Notice URI already exists');
}
}
......
......@@ -88,7 +88,11 @@ class GroupsalmonAction extends SalmonAction
}
}
$this->saveNotice();
try {
$this->saveNotice();
} catch AlreadyFulfilledException($e) {
return;
}
}
/**
......
......@@ -95,13 +95,11 @@ class UsersalmonAction extends SalmonAction
throw new ClientException(_m('Not to anyone in reply to anything.'));
}
$existing = Notice::getKV('uri', $this->activity->objects[0]->id);
if ($existing instanceof Notice) {
common_log(LOG_ERR, "Not saving notice with duplicate URI '".$existing->getUri()."' (seems it already exists).");
try {
$this->saveNotice();
} catch AlreadyFulfilledException($e) {
return;
}
$this->saveNotice();
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment