diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-01-18 11:33:23 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-01-18 11:39:26 +0100 |
commit | a39acb2518f272df8a601af72c13eabe2719dcb8 (patch) | |
tree | fb8bda9de5bea9d73553c3d54610eb211d7de6fb /application/bookmark | |
parent | 3fb29fdda04ca86e04422d49b86cf646d53c4f9d (diff) | |
download | Shaarli-a39acb2518f272df8a601af72c13eabe2719dcb8.tar.gz Shaarli-a39acb2518f272df8a601af72c13eabe2719dcb8.tar.zst Shaarli-a39acb2518f272df8a601af72c13eabe2719dcb8.zip |
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
Diffstat (limited to 'application/bookmark')
-rw-r--r-- | application/bookmark/BookmarkFileService.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/application/bookmark/BookmarkFileService.php b/application/bookmark/BookmarkFileService.php index a56cc92b..9c59e139 100644 --- a/application/bookmark/BookmarkFileService.php +++ b/application/bookmark/BookmarkFileService.php | |||
@@ -8,6 +8,7 @@ use Exception; | |||
8 | use Shaarli\Bookmark\Exception\BookmarkNotFoundException; | 8 | use Shaarli\Bookmark\Exception\BookmarkNotFoundException; |
9 | use Shaarli\Bookmark\Exception\EmptyDataStoreException; | 9 | use Shaarli\Bookmark\Exception\EmptyDataStoreException; |
10 | use Shaarli\Config\ConfigManager; | 10 | use Shaarli\Config\ConfigManager; |
11 | use Shaarli\Formatter\BookmarkMarkdownFormatter; | ||
11 | use Shaarli\History; | 12 | use Shaarli\History; |
12 | use Shaarli\Legacy\LegacyLinkDB; | 13 | use Shaarli\Legacy\LegacyLinkDB; |
13 | use Shaarli\Legacy\LegacyUpdater; | 14 | use Shaarli\Legacy\LegacyUpdater; |
@@ -130,7 +131,7 @@ class BookmarkFileService implements BookmarkServiceInterface | |||
130 | } | 131 | } |
131 | 132 | ||
132 | if ($visibility === null) { | 133 | if ($visibility === null) { |
133 | $visibility = $this->isLoggedIn ? 'all' : 'public'; | 134 | $visibility = $this->isLoggedIn ? BookmarkFilter::$ALL : BookmarkFilter::$PUBLIC; |
134 | } | 135 | } |
135 | 136 | ||
136 | $bookmark = $this->bookmarks[$id]; | 137 | $bookmark = $this->bookmarks[$id]; |
@@ -287,9 +288,13 @@ class BookmarkFileService implements BookmarkServiceInterface | |||
287 | $caseMapping = []; | 288 | $caseMapping = []; |
288 | foreach ($bookmarks as $bookmark) { | 289 | foreach ($bookmarks as $bookmark) { |
289 | foreach ($bookmark->getTags() as $tag) { | 290 | foreach ($bookmark->getTags() as $tag) { |
290 | if (empty($tag) || (! $this->isLoggedIn && startsWith($tag, '.'))) { | 291 | if (empty($tag) |
292 | || (! $this->isLoggedIn && startsWith($tag, '.')) | ||
293 | || $tag === BookmarkMarkdownFormatter::NO_MD_TAG | ||
294 | ) { | ||
291 | continue; | 295 | continue; |
292 | } | 296 | } |
297 | |||
293 | // The first case found will be displayed. | 298 | // The first case found will be displayed. |
294 | if (!isset($caseMapping[strtolower($tag)])) { | 299 | if (!isset($caseMapping[strtolower($tag)])) { |
295 | $caseMapping[strtolower($tag)] = $tag; | 300 | $caseMapping[strtolower($tag)] = $tag; |