diff options
author | Marco Nassabain <marco.nassabain@hotmail.com> | 2021-02-24 22:37:29 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 22:31:21 +0200 |
commit | 83bdbc08a07574fff9be8a2ca07a87248cdb5bc1 (patch) | |
tree | 774fa6bb42345403e45b3cceca42847aeb72a2a9 | |
parent | c3cc70b15ef0748f987cdb1c31b578c2b1a8c3a4 (diff) |
✨ ItemMapperV2: include shared in functions
updated the following functions to include shared items:
- findAllFromUser
- newest
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
-rw-r--r-- | lib/Db/ItemMapperV2.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Db/ItemMapperV2.php b/lib/Db/ItemMapperV2.php index 64b640a11..1365121fe 100644 --- a/lib/Db/ItemMapperV2.php +++ b/lib/Db/ItemMapperV2.php @@ -57,9 +57,10 @@ class ItemMapperV2 extends NewsMapperV2 $builder->select('items.*') ->from($this->tableName, 'items') ->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id') - ->where('feeds.user_id = :user_id') + ->where('(feeds.user_id = :user_id AND items.shared_by = \'\') OR items.shared_with = :shared_with') ->andWhere('feeds.deleted_at = 0') - ->setParameter('user_id', $userId, IQueryBuilder::PARAM_STR); + ->setParameter('user_id', $userId, IQueryBuilder::PARAM_STR) + ->setParameter('shared_with', $userId, IQueryBuilder::PARAM_STR); foreach ($params as $key => $value) { $builder->andWhere("${key} = " . $builder->createNamedParameter($value)); @@ -301,8 +302,9 @@ class ItemMapperV2 extends NewsMapperV2 $builder->select('items.*') ->from($this->tableName, 'items') ->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id') - ->where('feeds.user_id = :userId') + ->where('(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith') ->setParameter('userId', $userId) + ->setParameter('sharedWith', $userId) ->orderBy('items.last_modified', 'DESC') ->addOrderBy('items.id', 'DESC') ->setMaxResults(1); |