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

View file

@ -108,7 +108,13 @@ class Notification extends BaseModule
if ($request_id) {
$notify = DI::notify()->getByID($request_id, local_user());
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