]> git.mxchange.org Git - friendica.git/blobdiff - include/api.php
Merge pull request #8350 from nupplaphil/bug/8342_not_link
[friendica.git] / include / api.php
index 6f5120691cffe56f9e9ea9de52c763635d40b2cc..eb02a6bfa8d353d241c77cba4189e2a1656f9a63 100644 (file)
@@ -1,5 +1,22 @@
 <?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/>.
+ *
  * Friendica implementation of statusnet/twitter API
  *
  * @file include/api.php
@@ -8,7 +25,6 @@
 
 use Friendica\App;
 use Friendica\Content\ContactSelector;
-use Friendica\Content\Feature;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
 use Friendica\Core\Hook;
@@ -25,7 +41,6 @@ use Friendica\Model\Item;
 use Friendica\Model\Mail;
 use Friendica\Model\Notify;
 use Friendica\Model\Photo;
-use Friendica\Model\Profile;
 use Friendica\Model\User;
 use Friendica\Model\UserItem;
 use Friendica\Network\FKOAuth1;
@@ -5903,10 +5918,10 @@ function api_friendica_notification_seen($type)
        $id = (!empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0);
 
        try {
-               $notify = DI::notify()->getByID($id);
+               $notify = DI::notify()->getByID($id, api_user());
                DI::notify()->setSeen(true, $notify);
 
-               if ($notify->otype === Notify::OTYPE_ITEM) {
+               if ($notify->otype === Notify\ObjectType::ITEM) {
                        $item = Item::selectFirstForUser(api_user(), [], ['id' => $notify->iid, 'uid' => api_user()]);
                        if (DBA::isResult($item)) {
                                // we found the item, return it to the user