Fix code style in Content\GroupManager

This commit is contained in:
Hypolite Petovan 2025-01-22 22:17:22 -05:00
parent 354e3adc04
commit 1794d58a5b

View file

@ -45,11 +45,11 @@ class GroupManager
$condition = [ $condition = [
'contact-type' => Contact::TYPE_COMMUNITY, 'contact-type' => Contact::TYPE_COMMUNITY,
'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB], 'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB],
'uid' => $uid, 'uid' => $uid,
'blocked' => false, 'blocked' => false,
'pending' => false, 'pending' => false,
'archive' => false, 'archive' => false,
]; ];
$condition = DBA::mergeConditions($condition, ["`platform` NOT IN (?, ?)", 'peertube', 'wordpress']); $condition = DBA::mergeConditions($condition, ["`platform` NOT IN (?, ?)", 'peertube', 'wordpress']);
@ -64,7 +64,7 @@ class GroupManager
$groupList = []; $groupList = [];
$fields = ['id', 'url', 'alias', 'name', 'micro', 'thumb', 'avatar', 'network', 'uid']; $fields = ['id', 'url', 'alias', 'name', 'micro', 'thumb', 'avatar', 'network', 'uid'];
$contacts = DBA::select('account-user-view', $fields, $condition, $params); $contacts = DBA::select('account-user-view', $fields, $condition, $params);
if (!$contacts) { if (!$contacts) {
return $groupList; return $groupList;
@ -72,10 +72,10 @@ class GroupManager
while ($contact = DBA::fetch($contacts)) { while ($contact = DBA::fetch($contacts)) {
$groupList[] = [ $groupList[] = [
'url' => $contact['url'], 'url' => $contact['url'],
'alias' => $contact['alias'], 'alias' => $contact['alias'],
'name' => $contact['name'], 'name' => $contact['name'],
'id' => $contact['id'], 'id' => $contact['id'],
'micro' => $contact['micro'], 'micro' => $contact['micro'],
'thumb' => $contact['thumb'], 'thumb' => $contact['thumb'],
]; ];
@ -101,7 +101,7 @@ class GroupManager
{ {
//sort by last updated item //sort by last updated item
$contacts = self::getList($uid, true, true, true); $contacts = self::getList($uid, true, true, true);
$total = count($contacts); $total = count($contacts);
$visibleGroups = 10; $visibleGroups = 10;
$id = 0; $id = 0;
@ -127,14 +127,14 @@ class GroupManager
return Renderer::replaceMacros( return Renderer::replaceMacros(
$tpl, $tpl,
[ [
'$title' => DI::l10n()->t('Groups'), '$title' => DI::l10n()->t('Groups'),
'$groups' => $entries, '$groups' => $entries,
'$link_desc' => DI::l10n()->t('External link to group'), '$link_desc' => DI::l10n()->t('External link to group'),
'$new_group_page' => 'register/', '$new_group_page' => 'register/',
'$total' => $total, '$total' => $total,
'$visible_groups' => $visibleGroups, '$visible_groups' => $visibleGroups,
'$showless' => DI::l10n()->t('show less'), '$showless' => DI::l10n()->t('show less'),
'$showmore' => DI::l10n()->t('show more'), '$showmore' => DI::l10n()->t('show more'),
'$create_new_group' => DI::l10n()->t('Create new group') '$create_new_group' => DI::l10n()->t('Create new group')
], ],
); );
@ -201,7 +201,11 @@ class GroupManager
AND NOT `contact`.`pending` AND NOT `contact`.`archive` AND NOT `contact`.`pending` AND NOT `contact`.`archive`
AND `contact`.`uid` = ? AND `contact`.`uid` = ?
GROUP BY `contact`.`id`", GROUP BY `contact`.`id`",
DI::userSession()->getLocalUserId(), Protocol::DFRN, Protocol::ACTIVITYPUB, Contact::TYPE_COMMUNITY, DI::userSession()->getLocalUserId() DI::userSession()->getLocalUserId(),
Protocol::DFRN,
Protocol::ACTIVITYPUB,
Contact::TYPE_COMMUNITY,
DI::userSession()->getLocalUserId()
); );
return DBA::toArray($stmtContacts); return DBA::toArray($stmtContacts);