aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/bookmark
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-01-18 11:33:23 +0100
committerArthurHoaro <arthur@hoa.ro>2020-01-18 11:39:26 +0100
commita39acb2518f272df8a601af72c13eabe2719dcb8 (patch)
treefb8bda9de5bea9d73553c3d54610eb211d7de6fb /application/bookmark
parent3fb29fdda04ca86e04422d49b86cf646d53c4f9d (diff)
downloadShaarli-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.php9
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;
8use Shaarli\Bookmark\Exception\BookmarkNotFoundException; 8use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
9use Shaarli\Bookmark\Exception\EmptyDataStoreException; 9use Shaarli\Bookmark\Exception\EmptyDataStoreException;
10use Shaarli\Config\ConfigManager; 10use Shaarli\Config\ConfigManager;
11use Shaarli\Formatter\BookmarkMarkdownFormatter;
11use Shaarli\History; 12use Shaarli\History;
12use Shaarli\Legacy\LegacyLinkDB; 13use Shaarli\Legacy\LegacyLinkDB;
13use Shaarli\Legacy\LegacyUpdater; 14use 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;