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.')); 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 // 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]]); $is_public = Item::exists(['id' => $item_id, 'private' => [Item::PUBLIC, Item::UNLISTED]]);
if ($is_public) { if ($is_public) {

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

View file

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

File diff suppressed because it is too large Load diff