Merge pull request #7608 from annando/issue-7285

Issue 7285: Perform duplicate check for item URI also with AP
This commit is contained in:
Tobias Diekershoff 2019-09-10 07:56:56 +02:00 committed by GitHub
commit 75e2b7d297
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1398,9 +1398,9 @@ class Item extends BaseObject
* via OStatus (maybe Diasporsa as well) * via OStatus (maybe Diasporsa as well)
*/ */
if (empty($item['network']) || in_array($item['network'], Protocol::FEDERATED)) { if (empty($item['network']) || in_array($item['network'], Protocol::FEDERATED)) {
$condition = ["`uri` = ? AND `uid` = ? AND `network` IN (?, ?, ?)", $condition = ["`uri` = ? AND `uid` = ? AND `network` IN (?, ?, ?, ?)",
trim($item['uri']), $item['uid'], trim($item['uri']), $item['uid'],
Protocol::DIASPORA, Protocol::DFRN, Protocol::OSTATUS]; Protocol::ACTIVITYPUB, Protocol::DIASPORA, Protocol::DFRN, Protocol::OSTATUS];
$existing = self::selectFirst(['id', 'network'], $condition); $existing = self::selectFirst(['id', 'network'], $condition);
if (DBA::isResult($existing)) { if (DBA::isResult($existing)) {
// We only log the entries with a different user id than 0. Otherwise we would have too many false positives // We only log the entries with a different user id than 0. Otherwise we would have too many false positives