From a39acb2518f272df8a601af72c13eabe2719dcb8 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 18 Jan 2020 11:33:23 +0100 Subject: Fix an issue with private tags and fix nomarkdown tag The new bookmark service wasn't handling private tags properly. nomarkdown tag is now shown only for logged in user in bookmarks, and hidden for everyone in tag clouds/lists. Fixes #726 --- tests/formatter/BookmarkDefaultFormatterTest.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'tests/formatter/BookmarkDefaultFormatterTest.php') diff --git a/tests/formatter/BookmarkDefaultFormatterTest.php b/tests/formatter/BookmarkDefaultFormatterTest.php index fe42a208..382a560e 100644 --- a/tests/formatter/BookmarkDefaultFormatterTest.php +++ b/tests/formatter/BookmarkDefaultFormatterTest.php @@ -29,7 +29,7 @@ class BookmarkDefaultFormatterTest extends TestCase { copy('tests/utils/config/configJson.json.php', self::$testConf .'.json.php'); $this->conf = new ConfigManager(self::$testConf); - $this->formatter = new BookmarkDefaultFormatter($this->conf); + $this->formatter = new BookmarkDefaultFormatter($this->conf, true); } /** @@ -153,4 +153,25 @@ class BookmarkDefaultFormatterTest extends TestCase $link['description'] ); } + + /** + * Make sure that private tags are properly filtered out when the user is logged out. + */ + public function testFormatTagListRemovePrivate(): void + { + $this->formatter = new BookmarkDefaultFormatter($this->conf, false); + + $bookmark = new Bookmark(); + $bookmark->setId($id = 11); + $bookmark->setTags($tags = ['bookmark', '.private', 'othertag']); + + $link = $this->formatter->format($bookmark); + + unset($tags[1]); + $tags = array_values($tags); + + $this->assertSame(11, $link['id']); + $this->assertSame($tags, $link['taglist']); + $this->assertSame(implode(' ', $tags), $link['tags']); + } } -- cgit v1.2.3