Prticipation is now a view as well

This commit is contained in:
Michael 2020-04-24 17:55:49 +00:00
parent 749c2ce4ab
commit 89dcab774d
2 changed files with 18 additions and 17 deletions

View file

@ -259,27 +259,13 @@ class Diaspora
*/
public static function participantsForThread($thread, array $contacts)
{
$r = DBA::p("SELECT `contact`.`batch`, `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`network`, `contact`.`protocol`,
`fcontact`.`batch` AS `fbatch`, `fcontact`.`network` AS `fnetwork` FROM `participation`
INNER JOIN `contact` ON `contact`.`id` = `participation`.`cid`
INNER JOIN `fcontact` ON `fcontact`.`id` = `participation`.`fid`
WHERE `participation`.`iid` = ? AND NOT `contact`.`archive`", $thread);
while ($contact = DBA::fetch($r)) {
if (!empty($contact['fnetwork'])) {
$contact['network'] = $contact['fnetwork'];
}
unset($contact['fnetwork']);
$participation = DBA::select('participation-view', [], ['iid' => $thread]);
while ($contact = DBA::fetch($participation)) {
if (empty($contact['protocol'])) {
$contact['protocol'] = $contact['network'];
}
if (empty($contact['batch']) && !empty($contact['fbatch'])) {
$contact['batch'] = $contact['fbatch'];
}
unset($contact['fbatch']);
$exists = false;
foreach ($contacts as $entry) {
if ($entry['batch'] == $contact['batch']) {
@ -291,7 +277,8 @@ class Diaspora
$contacts[] = $contact;
}
}
DBA::close($r);
DBA::close($participation);
return $contacts;
}