*/
class Delegation extends BaseModule
{
- public static function post(array $parameters = [])
+ public function post()
{
if (!local_user()) {
return;
// NOTREACHED
}
- public static function content(array $parameters = [])
+ public function content(): string
{
if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
$identities[$key]['selected'] = ($identity['nickname'] === DI::app()->getLoggedInUserNickname());
- $condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], Notification\Type::INTRO, Notification\Type::MAIL];
+ $condition = ["`msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", Notification\Type::INTRO, Notification\Type::MAIL];
$params = ['distinct' => true, 'expression' => 'parent'];
- $notifications = DBA::count('notify', $condition, $params);
+ $notifications = DI::notify()->countForUser($identity['uid'], $condition, $params);
$params = ['distinct' => true, 'expression' => 'convid'];
$notifications += DBA::count('mail', ['uid' => $identity['uid'], 'seen' => false], $params);
- $notifications += DBA::count('intro', ['blocked' => false, 'ignore' => false, 'uid' => $identity['uid']]);
+ $notifications += DI::intro()->countActiveForUser($identity['uid']);
$identities[$key]['notifications'] = $notifications;
}