mirror of
https://github.com/friendica/friendica
synced 2025-04-23 06:30:11 +00:00
ReWork Notification Model/Module/Object/Repository/Factory
- Introduce Repository for interaction with "notify" table - Introduce Factory for read-only notification objects (they're just loosely based on notification the table!) - Introduce Objects for type-safe usage at the presentation layer - Reworked Model, which is now fully based on the notify table, including generated fields (cache, ..)
This commit is contained in:
parent
230bb6dd53
commit
0850fb88dd
17 changed files with 1413 additions and 851 deletions
|
@ -23,7 +23,11 @@ class Notification extends BaseModule
|
|||
{
|
||||
// @TODO: Replace with parameter from router
|
||||
if (DI::args()->get(1) === 'mark' && DI::args()->get(2) === 'all') {
|
||||
$success = DI::notification()->setAllSeen();
|
||||
try {
|
||||
$success = DI::notification()->setAllSeen();
|
||||
}catch (\Exception $e) {
|
||||
$success = false;
|
||||
}
|
||||
|
||||
header('Content-type: application/json; charset=utf-8');
|
||||
echo json_encode([
|
||||
|
@ -43,14 +47,16 @@ class Notification extends BaseModule
|
|||
{
|
||||
// @TODO: Replace with parameter from router
|
||||
if (DI::args()->getArgc() > 2 && DI::args()->get(1) === 'view' && intval(DI::args()->get(2))) {
|
||||
$notificationManager = DI::notification();
|
||||
// @TODO: Replace with parameter from router
|
||||
$note = $notificationManager->getByID(DI::args()->get(2));
|
||||
if (!empty($note)) {
|
||||
$notificationManager->setSeen($note);
|
||||
if (!empty($note['link'])) {
|
||||
System::externalRedirect($note['link']);
|
||||
try {
|
||||
$notification = DI::notification()->getByID(DI::args()->get(2));
|
||||
$notification->setSeen();
|
||||
|
||||
if (!empty($notification->link)) {
|
||||
System::externalRedirect($notification->link);
|
||||
}
|
||||
|
||||
} catch (HTTPException\NotFoundException $e) {
|
||||
info(DI::l10n()->t('Invalid notification.'));
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue