]> git.mxchange.org Git - friendica.git/commitdiff
correct notice redirect
authorPhilipp Holzer <admin+github@philipp.info>
Sat, 18 May 2019 18:37:37 +0000 (20:37 +0200)
committerPhilipp Holzer <admin+github@philipp.info>
Sun, 19 May 2019 00:53:35 +0000 (02:53 +0200)
src/Model/ItemUser.php [deleted file]
src/Module/GnuSocial/Notice.php

diff --git a/src/Model/ItemUser.php b/src/Model/ItemUser.php
deleted file mode 100644 (file)
index c157150..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-namespace Friendica\Model;
-
-use Exception;
-use Friendica\Database\DBA;
-
-/**
- * Model for user specific operations of items
- */
-class ItemUser
-{
-       /**
-        * Returns fields of the user for an item
-        *
-        * @param int   $id     The item id
-        * @param array $fields The fields, which should get returned
-        *
-        * @return array|bool
-        * @throws Exception In case of a DB-failure
-        */
-       public static function getUserForItemId($id, array $fields = [])
-       {
-               $item = DBA::selectFirst('item', ['uid'], ['id' => $id]);
-               if (empty($item)) {
-                       return false;
-               }
-
-               $user = DBA::selectFirst('user', $fields, ['uid' => $item['uid']]);
-               if (!empty($user)) {
-                       return $user;
-               } else {
-                       return false;
-               }
-       }
-}
index a364fa79f08ca68d4ae3877e2175380ddcb252a5..5df28a1f0da87fa6d0b8696cd4193f29eb4e7ec8 100644 (file)
@@ -4,6 +4,8 @@ namespace Friendica\Module\GnuSocial;
 
 use Friendica\BaseModule;
 use Friendica\Core\L10n;
+use Friendica\Database\DBA;
+use Friendica\Model\Item;
 use Friendica\Model\ItemUser;
 use Friendica\Network\HTTPException;
 
@@ -23,12 +25,12 @@ class Notice extends BaseModule
                        throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
                }
 
-               $user = ItemUser::getUserForItemId($id, ['nickname']);
+               $item = DBA::selectFirst('item', ['guid'], ['id' => $id]);
 
-               if (empty($user)) {
+               if (empty($item )) {
                        throw new HTTPException\NotFoundException(L10n::t('Item not found.'));
                } else {
-                       $a->internalRedirect('display/' . $user['nickname'] . '/' . $id);
+                       $a->internalRedirect('display/' . $item['guid']);
                }
        }
 }