summaryrefslogtreecommitdiffstats
path: root/lib/Db
diff options
context:
space:
mode:
authorMarco Nassabain <marco.nassabain@hotmail.com>2021-02-18 23:18:04 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 22:31:21 +0200
commit237363e087c629f8902828575908d3c54e5aa348 (patch)
tree44bd1918eef3a0e8df5ba83f84cf9354f85afedc /lib/Db
parent89d7293e845ee7bcc9b55910c1a0bb30b3c6e5ad (diff)
💡 Added comments to ItemMapper share fncts
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
Diffstat (limited to 'lib/Db')
-rw-r--r--lib/Db/ItemMapper.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Db/ItemMapper.php b/lib/Db/ItemMapper.php
index 01365d866..036ebf1be 100644
--- a/lib/Db/ItemMapper.php
+++ b/lib/Db/ItemMapper.php
@@ -36,6 +36,12 @@ class ItemMapper extends NewsMapper
parent::__construct($db, $time, Item::class);
}
+ /**
+ * Constructs the SQL query
+ *
+ * A user can access an item if it's in his feeds and is not shared
+ * XOR it's not in his feeds but is shared with him
+ */
private function makeSelectQuery(
$prependTo = '',
$oldestFirst = false,
@@ -572,6 +578,16 @@ class ItemMapper extends NewsMapper
return (int)$result['size'];
}
+ /**
+ * @param int $itemId id of the item to share
+ * @param string $shareWithId user the item is being shared with
+ * @param string $userId user who's sharing the article, article owner
+ *
+ * Sharing by copying - the item is duplicated, and the 'sharedBy' and
+ * 'sharedWith' fields are filled accordingly.
+ * We copy the 'feedId', because the article will still be owned by
+ * $userId, and it'll be stored in his feed
+ */
public function shareItem($itemId, $shareWithId, $userId)
{
// find existing item and copy it