]> git.mxchange.org Git - friendica.git/commitdiff
Merge "notification" routes
authornupplaPhil <admin@philipp.info>
Tue, 28 Jan 2020 22:21:24 +0000 (23:21 +0100)
committernupplaPhil <admin@philipp.info>
Tue, 28 Jan 2020 22:21:24 +0000 (23:21 +0100)
include/enotify.php
mod/ping.php
src/Factory/Notification/Notification.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 7567613b4fb17cdbe651559c39029c0c7e24c82b..e21adc91ac64fe07dbcfc2e2aad7f6166f34dc56 100644 (file)
@@ -500,7 +500,7 @@ function notification($params)
 
                DI::notify()->update($notification);
 
-               $itemlink  = DI::baseUrl() . '/notification/view/' . $notification->id;
+               $itemlink  = DI::baseUrl() . '/notification/' . $notification->id;
                $notify_id = $notification->id;
        }
 
index dd57ba34d68eb3308fb3ca8847b038333410723b..70c580d3d31ff4f5c7385ee8125789d15334a2b3 100644 (file)
@@ -443,7 +443,7 @@ function ping_get_notifications($uid)
                                );
                        }
 
-                       $notification["href"] = DI::baseUrl() . "/notification/view/" . $notification["id"];
+                       $notification["href"] = DI::baseUrl() . "/notification/" . $notification["id"];
 
                        if ($notification["visible"]
                                && !$notification["deleted"]
index 2b179cca53845c4ee4a3523aa3c9f1bf43a807ce..399e6b0e7ad490dd5c567eebe83bbdad0dfbe7ba 100644 (file)
@@ -219,7 +219,7 @@ class Notification extends BaseFactory
                        foreach ($notifications as $notification) {
                                $formattedNotifications[] = new \Friendica\Object\Notification\Notification([
                                        'label' => 'notification',
-                                       'link'  => $this->baseUrl->get(true) . '/notification/view/' . $notification->id,
+                                       'link'  => $this->baseUrl->get(true) . '/notification/' . $notification->id,
                                        'image' => Proxy::proxifyUrl($notification->photo, false, Proxy::SIZE_MICRO),
                                        'url'   => $notification->url,
                                        'text'  => strip_tags(BBCode::convert($notification->msg)),
index 20530e81aef866b3f6f432837f753bcc4139af3d..b8d0e47f01d15cc7b37489920116d4cb838c63a7 100644 (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');
        }
 }
+
index 2dd6da1bf4306cc5f784e5cdf32c59208a893ef8..4aad69d8c7f5ec8e2162d973845f0c65d5cf6010 100644 (file)
@@ -184,10 +184,9 @@ 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]],
-               '/action/{id:\d+}'  => [Module\Notifications\Notification::class, [        R::POST]],
+               '[/]'       => [Module\Notifications\Notification::class, [R::GET]],
+               '/mark/all' => [Module\Notifications\Notification::class, [R::GET]],
+               '/{id:\d+}' => [Module\Notifications\Notification::class, [R::GET, R::POST]],
        ],
        '/objects/{guid}' => [Module\Objects::class, [R::GET]],
 
index 4ad96c7274b825a8d7b01a2b39b1c156896a7e51..b04c19c1844cd3f994e4f7810de64e40aec6d100 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="notification/action/{{$intro_id}}" method="post">
+<form class="intro-form" action="notification/{{$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 ac5c2e9c2a7393d2154d9436cb4c792c7c5a999e..d0c013ac5b37301e460386b89b94a1c53abb89f0 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="notification/action/{{$intro_id}}" method="post">
+<form class="intro-form" action="notification/{{$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 879920af364b272d28235272e3389b0be3dadc78..8f4fa62183dd643a5905e8589c5b5834a93dbc38 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="notification/action/{{$intro_id}}" method="post">
+                       <form class="intro-form" action="notification/{{$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="notification/action/{{$intro_id}}" method="post">
+               <form class="intro-form pull-left" action="notification/{{$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>