]> git.mxchange.org Git - friendica.git/blobdiff - include/api.php
Improvements:
[friendica.git] / include / api.php
index 4a55c2b919ffd89e5517a4e0fd0a385581cc7f8e..0729c2a0f89c88712bd4a3e329c3c44596a25d7a 100644 (file)
@@ -23,6 +23,7 @@ use Friendica\Model\Contact;
 use Friendica\Model\Group;
 use Friendica\Model\Item;
 use Friendica\Model\Mail;
+use Friendica\Model\Notification;
 use Friendica\Model\Photo;
 use Friendica\Model\Profile;
 use Friendica\Model\User;
@@ -5906,7 +5907,7 @@ function api_friendica_notification($type)
                throw new BadRequestException("Invalid argument count");
        }
 
-       $notifications = DI::notification()->select([], ['order' => ['seen' => 'ASC', 'date' => 'DESC'], 'limit' => 50]);
+       $notifications = DI::notification()->select(['uid' => api_user()], ['order' => ['seen' => 'ASC', 'date' => 'DESC'], 'limit' => 50]);
 
        if ($type == "xml") {
                $xmlnotes = false;
@@ -5957,8 +5958,7 @@ function api_friendica_notification_seen($type)
                $notification = DI::notification()->getByID($id);
                $notification->setSeen();
 
-               if ($notification->otype == 'item') {
-                       // would be really better with an ItemsManager and $im->getByID() :-P
+               if ($notification->otype === Notification::OTYPE_ITEM) {
                        $item = Item::selectFirstForUser(api_user(), [], ['id' => $notification->iid, 'uid' => api_user()]);
                        if (DBA::isResult($item)) {
                                // we found the item, return it to the user