From 2055ee872c3f14c69f4ffa2443c427fcd5d8db94 Mon Sep 17 00:00:00 2001
From: Hypolite Petovan <hypolite@mrpetovan.com>
Date: Mon, 9 Nov 2020 09:33:59 -0500
Subject: [PATCH] Group registration requests in a single line for users
 without detailed_notif

---
 mod/ping.php | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/mod/ping.php b/mod/ping.php
index 5e6c478f7d..8e00ae31f1 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -289,16 +289,30 @@ function ping_init(App $a)
 		}
 
 		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 = [
 					'id'      => 0,
 					'href'    => DI::baseUrl() . '/admin/users/pending',
-					'name'    => $reg['name'],
-					'url'     => $reg['url'],
-					'photo'   => $reg['micro'],
-					'date'    => $reg['created'],
+					'name'    => $regs[0]['name'],
+					'url'     => $regs[0]['url'],
+					'photo'   => $regs[0]['micro'],
+					'date'    => $regs[0]['created'],
 					'seen'    => false,
-					'message' => DI::l10n()->t('{0} requested registration'),
+					'message' => DI::l10n()->t('{0} and %d others requested registration', count($regs) - 1),
 				];
 				$notifs[] = $notif;
 			}
-- 
2.39.5