Group registration requests in a single line for users without detailed_notif

This commit is contained in:
Hypolite Petovan 2020-11-09 09:33:59 -05:00
parent 8357d94800
commit 2055ee872c

View file

@ -289,16 +289,30 @@ function ping_init(App $a)
} }
if (DBA::isResult($regs)) { if (DBA::isResult($regs)) {
foreach ($regs as $reg) { if (count($regs) <= 1 || DI::pConfig()->get(local_user(), 'system', 'detailed_notif')) {
foreach ($regs as $reg) {
$notif = [
'id' => 0,
'href' => DI::baseUrl() . '/admin/users/pending',
'name' => $reg['name'],
'url' => $reg['url'],
'photo' => $reg['micro'],
'date' => $reg['created'],
'seen' => false,
'message' => DI::l10n()->t('{0} requested registration'),
];
$notifs[] = $notif;
}
} else {
$notif = [ $notif = [
'id' => 0, 'id' => 0,
'href' => DI::baseUrl() . '/admin/users/pending', 'href' => DI::baseUrl() . '/admin/users/pending',
'name' => $reg['name'], 'name' => $regs[0]['name'],
'url' => $reg['url'], 'url' => $regs[0]['url'],
'photo' => $reg['micro'], 'photo' => $regs[0]['micro'],
'date' => $reg['created'], 'date' => $regs[0]['created'],
'seen' => false, 'seen' => false,
'message' => DI::l10n()->t('{0} requested registration'), 'message' => DI::l10n()->t('{0} and %d others requested registration', count($regs) - 1),
]; ];
$notifs[] = $notif; $notifs[] = $notif;
} }