Merge "notification" routes

This commit is contained in:
nupplaPhil 2020-01-28 23:21:24 +01:00
parent dd8d9d7c70
commit c2b8c65104
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
8 changed files with 16 additions and 15 deletions

View file

@ -23,7 +23,7 @@ class Notification extends BaseModule
{
$request_id = $parameters['id'] ?? false;
if (DI::args()->get(1) == 'action' && $request_id) {
if ($request_id) {
$intro = DI::intro()->selectFirst(['id' => $request_id, 'uid' => local_user()]);
switch ($_POST['submit']) {
@ -65,10 +65,11 @@ class Notification extends BaseModule
*/
public static function content(array $parameters = [])
{
// @TODO: Replace with parameter from router
if (DI::args()->getArgc() > 2 && DI::args()->get(1) === 'view' && intval(DI::args()->get(2))) {
$request_id = $parameters['id'] ?? false;
if ($request_id) {
try {
$notification = DI::notify()->getByID(DI::args()->get(2));
$notification = DI::notify()->getByID($request_id);
$notification->setSeen();
if (!empty($notification->link)) {
@ -86,3 +87,4 @@ class Notification extends BaseModule
DI::baseUrl()->redirect('notifications/system');
}
}