diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-02-11 21:40:01 +0100 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-02-12 15:11:58 +0100 |
commit | 6235175b6dba4ab416db60a21559a69db2defa83 (patch) | |
tree | ce479c4e32aefe6c7730cfe7ec158cfb1f70f3d9 /lib | |
parent | d2d7e37b7bf00ea7929da02459e4abb8640d064a (diff) | |
download | nextcloud-server-6235175b6dba4ab416db60a21559a69db2defa83.tar.gz nextcloud-server-6235175b6dba4ab416db60a21559a69db2defa83.zip |
Make TAG_FAVORITE public
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Tags.php | 19 | ||||
-rw-r--r-- | lib/public/ITags.php | 4 |
2 files changed, 13 insertions, 10 deletions
diff --git a/lib/private/Tags.php b/lib/private/Tags.php index 0aa37161eb2..fe24391a1a5 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -48,8 +48,9 @@ use OC\Tagging\Tag; use OC\Tagging\TagMapper; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\ILogger; +use OCP\ITags; -class Tags implements \OCP\ITags { +class Tags implements ITags { /** * Tags @@ -112,8 +113,6 @@ class Tags implements \OCP\ITags { const TAG_TABLE = '*PREFIX*vcategory'; const RELATION_TABLE = '*PREFIX*vcategory_to_object'; - const TAG_FAVORITE = '_$!<Favorite>!$_'; - /** * Constructor. * @@ -186,7 +185,7 @@ class Tags implements \OCP\ITags { $tagMap = array(); foreach($this->tags as $tag) { - if($tag->getName() !== self::TAG_FAVORITE) { + if($tag->getName() !== ITags::TAG_FAVORITE) { $tagMap[] = $this->tagMap($tag); } } @@ -624,12 +623,12 @@ class Tags implements \OCP\ITags { * @return array|false An array of object ids. */ public function getFavorites() { - if(!$this->userHasTag(self::TAG_FAVORITE, $this->user)) { + if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { return []; } try { - return $this->getIdsForTag(self::TAG_FAVORITE); + return $this->getIdsForTag(ITags::TAG_FAVORITE); } catch(\Exception $e) { \OC::$server->getLogger()->logException($e, [ 'message' => __METHOD__, @@ -647,10 +646,10 @@ class Tags implements \OCP\ITags { * @return boolean */ public function addToFavorites($objid) { - if(!$this->userHasTag(self::TAG_FAVORITE, $this->user)) { - $this->add(self::TAG_FAVORITE); + if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) { + $this->add(ITags::TAG_FAVORITE); } - return $this->tagAs($objid, self::TAG_FAVORITE); + return $this->tagAs($objid, ITags::TAG_FAVORITE); } /** @@ -660,7 +659,7 @@ class Tags implements \OCP\ITags { * @return boolean */ public function removeFromFavorites($objid) { - return $this->unTag($objid, self::TAG_FAVORITE); + return $this->unTag($objid, ITags::TAG_FAVORITE); } /** diff --git a/lib/public/ITags.php b/lib/public/ITags.php index 27b274f4dd6..35469f4f804 100644 --- a/lib/public/ITags.php +++ b/lib/public/ITags.php @@ -53,6 +53,10 @@ use OC\Tags; */ interface ITags { + /** + * @since 19.0.0 + */ + public const TAG_FAVORITE = '_$!<Favorite>!$_'; /** * Check if any tags are saved for this type and user. |