]> git.mxchange.org Git - friendica.git/commitdiff
Add System::jsonExit()
authornupplaPhil <admin@philipp.info>
Tue, 28 Jan 2020 22:36:28 +0000 (23:36 +0100)
committernupplaPhil <admin@philipp.info>
Tue, 28 Jan 2020 22:36:28 +0000 (23:36 +0100)
src/Module/Notifications/Notification.php

index b8d0e47f01d15cc7b37489920116d4cb838c63a7..6df58374eccc2973d8ca3fc9b4060cd6a6c5c1c9 100644 (file)
@@ -46,14 +46,11 @@ class Notification extends BaseModule
                        try {
                                $success = DI::notify()->setAllSeen();
                        }catch (\Exception $e) {
+                               DI::logger()->warning('set all seen failed.', ['exception' => $e]);
                                $success = false;
                        }
 
-                       header('Content-type: application/json; charset=utf-8');
-                       echo json_encode([
-                               'result' => ($success) ? 'success' : 'fail',
-                       ]);
-                       exit();
+                       System::jsonExit(['result' => (($success) ? 'success' : 'fail')]);
                }
        }
 
@@ -83,7 +80,6 @@ class Notification extends BaseModule
                        DI::baseUrl()->redirect();
                }
 
-               // @TODO: Replace with parameter from router
                DI::baseUrl()->redirect('notifications/system');
        }
 }