Avoid SQL errors due to duplicate entries in the "participation" table

This commit is contained in:
Michael 2018-03-08 21:04:11 +00:00
parent 480fde7ca8
commit f23596421d

View file

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