]> git.mxchange.org Git - friendica.git/commitdiff
Fix ignore notification
authornupplaPhil <admin@philipp.info>
Tue, 28 Jan 2020 21:41:38 +0000 (22:41 +0100)
committernupplaPhil <admin@philipp.info>
Tue, 28 Jan 2020 21:47:15 +0000 (22:47 +0100)
src/Module/BaseNotifications.php
src/Module/Notifications/Notification.php
static/routes.config.php
view/templates/notifications/intros.tpl
view/templates/notifications/suggestions.tpl
view/theme/frio/templates/notifications/intros.tpl

index 9a67bb5667461df278c6ae3816e1df1f6fb0d348..4deb2a24cca5e81e0f38bc1452e956647e623b4d 100644 (file)
@@ -75,30 +75,6 @@ abstract class BaseNotifications extends BaseModule
                self::$showAll      = ($_REQUEST['show'] ?? '') === 'all';
        }
 
-       public static function post(array $parameters = [])
-       {
-               $request_id = DI::args()->get(1);
-
-               if ($request_id === 'all') {
-                       return;
-               }
-
-               if ($request_id) {
-                       $intro = DI::intro()->selectFirst(['id' => $request_id, 'uid' => local_user()]);
-
-                       switch ($_POST['submit']) {
-                               case DI::l10n()->t('Discard'):
-                                       $intro->discard();
-                                       break;
-                               case DI::l10n()->t('Ignore'):
-                                       $intro->ignore();
-                                       break;
-                       }
-
-                       DI::baseUrl()->redirect('notifications/intros');
-               }
-       }
-
        public static function rawContent(array $parameters = [])
        {
                // If the last argument of the query is NOT json, return
index 9b252562cc162d54a56404eb0cfb96995582ded0..20530e81aef866b3f6f432837f753bcc4139af3d 100644 (file)
@@ -19,6 +19,26 @@ class Notification extends BaseModule
                }
        }
 
+       public static function post(array $parameters = [])
+       {
+               $request_id = $parameters['id'] ?? false;
+
+               if (DI::args()->get(1) == 'action' && $request_id) {
+                       $intro = DI::intro()->selectFirst(['id' => $request_id, 'uid' => local_user()]);
+
+                       switch ($_POST['submit']) {
+                               case DI::l10n()->t('Discard'):
+                                       $intro->discard();
+                                       break;
+                               case DI::l10n()->t('Ignore'):
+                                       $intro->ignore();
+                                       break;
+                       }
+
+                       DI::baseUrl()->redirect('notifications/intros');
+               }
+       }
+
        public static function rawContent(array $parameters = [])
        {
                // @TODO: Replace with parameter from router
index c081dba66a1c0687467d021cfa27702bdc16f63c..2dd6da1bf4306cc5f784e5cdf32c59208a893ef8 100644 (file)
@@ -184,9 +184,10 @@ return [
        ],
 
        '/notification'         => [
-               '[/]'            => [Module\Notifications\Notification::class, [R::GET]],
-               '/view/{id:\d+}' => [Module\Notifications\Notification::class, [R::GET]],
-               '/mark/all'      => [Module\Notifications\Notification::class, [R::GET]],
+               '[/]'               => [Module\Notifications\Notification::class, [R::GET]],
+               '/view/{id:\d+}'    => [Module\Notifications\Notification::class, [R::GET]],
+               '/mark/all'         => [Module\Notifications\Notification::class, [R::GET]],
+               '/action/{id:\d+}'  => [Module\Notifications\Notification::class, [        R::POST]],
        ],
        '/objects/{guid}' => [Module\Objects::class, [R::GET]],
 
index 808f155b9dc59da33bc8f7de64a0d5fbc1331e1d..4ad96c7274b825a8d7b01a2b39b1c156896a7e51 100644 (file)
@@ -12,7 +12,7 @@
 <div class="intro-knowyou">{{$lbl_knowyou}} {{$knowyou}}</div>
 <div class="intro-note" id="intro-note-{{$contact_id}}">{{$note}}</div>
 <div class="intro-wrapper-end" id="intro-wrapper-end-{{$contact_id}}"></div>
-<form class="intro-form" action="notifications/{{$intro_id}}" method="post">
+<form class="intro-form" action="notification/action/{{$intro_id}}" method="post">
 <input class="intro-submit-ignore" type="submit" name="submit" value="{{$ignore}}" />
 {{if $discard}}<input class="intro-submit-discard" type="submit" name="submit" value="{{$discard}}" />{{/if}}
 </form>
index d7bb7b6019dd1a2e953688a6ed6088464ffbf0b3..ac5c2e9c2a7393d2154d9436cb4c792c7c5a999e 100644 (file)
@@ -8,7 +8,7 @@
 <a class="intro-url-link" href="{{$url}}" ><img class="intro-photo lframe" src="{{$photo}}" width="175" height="175" title="{{$fullname}}" alt="{{$fullname}}" /></a>
 <div class="intro-note" >{{$note}}</div>
 <div class="intro-wrapper-end"></div>
-<form class="intro-form" action="notifications/{{$intro_id}}" method="post">
+<form class="intro-form" action="notification/action/{{$intro_id}}" method="post">
 <input class="intro-submit-ignore" type="submit" name="submit" value="{{$ignore}}" />
 <input class="intro-submit-discard" type="submit" name="submit" value="{{$discard}}" />
 </form>
index 4bab6fa964b5bb582764b5dc665745856d3e9441..879920af364b272d28235272e3389b0be3dadc78 100644 (file)
@@ -13,7 +13,7 @@
                <div class="intro-actions pull-right nav-pills preferences">
                        <button class="btn-link intro-action-link" onclick="addElmToModal('#intro-approve-wrapper-{{$intro_id}}');" aria-label="{{$approve}}" title="{{$approve}}" data-toggle="tooltip"><i class="fa fa-check" aria-hidden="true"></i></button>
 
-                       <form class="intro-form" action="notifications/{{$intro_id}}" method="post">
+                       <form class="intro-form" action="notification/action/{{$intro_id}}" method="post">
                                <button class="btn-link intro-submit-ignore intro-action-link" type="submit" name="submit" value="{{$ignore}}" aria-label="{{$ignore}}" title="{{$ignore}}" data-toggle="tooltip"><i class="fa fa-ban" aria-hidden="true"></i></button>
                                {{if $discard}}<button class="btn-link intro-submit-discard intro-action-link" type="submit" name="submit" value="{{$discard}}" aria-label="{{$discard}}" title="{{$discard}}" data-toggle="tooltip"><i class="fa fa-trash-o" aria-hidden="true"></i></button>{{/if}}
                        </form>
@@ -73,7 +73,7 @@
        {{* On mobile touch devices we use buttons for approve, ingnore && discard to have a better UX *}}
        {{if $APP->is_mobile}}
        <div class="intro-action-buttons">
-               <form class="intro-form pull-left" action="notifications/{{$intro_id}}" method="post">
+               <form class="intro-form pull-left" action="notification/action/{{$intro_id}}" method="post">
                        <button class="btn btn-small btn-default intro-submit-ignore" type="submit" name="submit" value="{{$ignore}}">{{$ignore}}</button>
                        {{if $discard}}<button class="btn btn-small btn-default intro-submit-discard" type="submit" name="submit" value="{{$discard}}">{{$discard}}</button>&nbsp;{{/if}}
                </form>