]> git.mxchange.org Git - friendica.git/blobdiff - src/Factory/Notification/Notification.php
Merge pull request #1 from friendica/develop
[friendica.git] / src / Factory / Notification / Notification.php
index 399e6b0e7ad490dd5c567eebe83bbdad0dfbe7ba..ba36b0cef41cdfb54c28cecdb771d34a319d323f 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/**
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Factory\Notification;
 
@@ -76,11 +95,11 @@ class Notification extends BaseFactory
                        $item['author-avatar'] = $item['contact-avatar'];
                }
 
-               $item['label'] = (($item['id'] == $item['parent']) ? 'post' : 'comment');
+               $item['label'] = (($item['gravity'] == GRAVITY_PARENT) ? 'post' : 'comment');
                $item['link']  = $this->baseUrl->get(true) . '/display/' . $item['parent-guid'];
-               $item['image'] = Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO);
+               $item['image'] = $item['author-avatar'];
                $item['url']   = $item['author-link'];
-               $item['text']  = (($item['id'] == $item['parent'])
+               $item['text']  = (($item['gravity'] == GRAVITY_PARENT)
                        ? $this->l10n->t("%s created a new post", $item['author-name'])
                        : $this->l10n->t("%s commented on %s's post", $item['author-name'], $item['parent-author-name']));
                $item['when']  = DateTimeFormat::local($item['created'], 'r');
@@ -106,7 +125,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'like',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s liked %s's post", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
@@ -117,7 +136,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'dislike',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s disliked %s's post", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
@@ -128,7 +147,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'attend',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s is attending %s's event", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
@@ -139,7 +158,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'attendno',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s is not attending %s's event", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
@@ -150,7 +169,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'attendmaybe',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s may attending %s's event", $item['author-name'], $item['parent-author-name']),
                                        'when'  => $item['when'],
@@ -177,7 +196,7 @@ class Notification extends BaseFactory
                                return new \Friendica\Object\Notification\Notification([
                                        'label' => 'friend',
                                        'link'  => $this->baseUrl->get(true) . '/display/' . $item['parent-guid'],
-                                       'image' => Proxy::proxifyUrl($item['author-avatar'], false, Proxy::SIZE_MICRO),
+                                       'image' => $item['author-avatar'],
                                        'url'   => $item['author-link'],
                                        'text'  => $this->l10n->t("%s is now friends with %s", $item['author-name'], $item['fname']),
                                        'when'  => $item['when'],
@@ -253,7 +272,7 @@ class Notification extends BaseFactory
                }
 
                $fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
-                       'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
+                       'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'gravity'];
                $params = ['order' => ['received' => true], 'limit' => [$start, $limit]];
 
                $formattedNotifications = [];
@@ -294,7 +313,7 @@ class Notification extends BaseFactory
                }
 
                $fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
-                       'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
+                       'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'gravity'];
                $params = ['order' => ['received' => true], 'limit' => [$start, $limit]];
 
                $formattedNotifications = [];
@@ -331,7 +350,7 @@ class Notification extends BaseFactory
                }
 
                $fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
-                       'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
+                       'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'gravity'];
                $params = ['order' => ['received' => true], 'limit' => [$start, $limit]];
 
                $formattedNotifications = [];