Merge pull request #4564 from annando/avoid-duplicate

Avoid SQL errors due to duplicate entries in the "participation" table
This commit is contained in:
Hypolite Petovan 2018-03-08 18:22:18 -05:00 committed by GitHub
commit 3ecc53b448
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2211,7 +2211,10 @@ class Diaspora
}
logger('Received participation for ID: '.$item['id'].' - Contact: '.$contact_id.' - Server: '.$server, LOGGER_DEBUG);
dba::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
if (!dba::exists('participation', ['iid' => $item['id'], 'server' => $server])) {
dba::insert('participation', ['iid' => $item['id'], 'cid' => $contact_id, 'fid' => $person['id'], 'server' => $server]);
}
// Send all existing comments and likes to the requesting server
$comments = dba::p("SELECT `item`.`id`, `item`.`verb`, `contact`.`self`