Merge pull request #9509 from MrPetovan/task/5616-clear-notifications-display

Set thread notifications as seen in mod/display
This commit is contained in:
Michael Vogel 2020-11-09 21:01:36 +01:00 committed by GitHub
commit 0031b4e18c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7975 additions and 7875 deletions

View File

@ -238,6 +238,10 @@ function display_content(App $a, $update = false, $update_uid = 0)
throw new HTTPException\NotFoundException(DI::l10n()->t('The requested item doesn\'t exist or has been deleted.'));
}
if (!DI::pConfig()->get(local_user(), 'system', 'detailed_notif')) {
DBA::update('notify', ['seen' => true], ['parent' => $item['parent'], 'uid' => local_user()]);
}
// We are displaying an "alternate" link if that post was public. See issue 2864
$is_public = Item::exists(['id' => $item_id, 'private' => [Item::PUBLIC, Item::UNLISTED]]);
if ($is_public) {

View File

@ -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;
}

View File

@ -108,7 +108,13 @@ class Notification extends BaseModule
if ($request_id) {
$notify = DI::notify()->getByID($request_id, local_user());
DI::notify()->setSeen(true, $notify);
if (DI::pConfig()->get(local_user(), 'system', 'detailed_notif')) {
$notify->seen = true;
DI::notify()->update($notify);
} else {
DI::notify()->setSeen(true, $notify);
}
if (!empty($notify->link)) {
System::externalRedirect($notify->link);

File diff suppressed because it is too large Load Diff