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/formatter/BookmarkMarkdownFormatter.php | |
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/formatter/BookmarkMarkdownFormatter.php')
-rw-r--r-- | application/formatter/BookmarkMarkdownFormatter.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/application/formatter/BookmarkMarkdownFormatter.php b/application/formatter/BookmarkMarkdownFormatter.php index 7797bfbf..077e5312 100644 --- a/application/formatter/BookmarkMarkdownFormatter.php +++ b/application/formatter/BookmarkMarkdownFormatter.php | |||
@@ -36,10 +36,12 @@ class BookmarkMarkdownFormatter extends BookmarkDefaultFormatter | |||
36 | * LinkMarkdownFormatter constructor. | 36 | * LinkMarkdownFormatter constructor. |
37 | * | 37 | * |
38 | * @param ConfigManager $conf instance | 38 | * @param ConfigManager $conf instance |
39 | * @param bool $isLoggedIn | ||
39 | */ | 40 | */ |
40 | public function __construct(ConfigManager $conf) | 41 | public function __construct(ConfigManager $conf, bool $isLoggedIn) |
41 | { | 42 | { |
42 | parent::__construct($conf); | 43 | parent::__construct($conf, $isLoggedIn); |
44 | |||
43 | $this->parsedown = new \Parsedown(); | 45 | $this->parsedown = new \Parsedown(); |
44 | $this->escape = $conf->get('security.markdown_escape', true); | 46 | $this->escape = $conf->get('security.markdown_escape', true); |
45 | $this->allowedProtocols = $conf->get('security.allowed_protocols', []); | 47 | $this->allowedProtocols = $conf->get('security.allowed_protocols', []); |
@@ -79,7 +81,7 @@ class BookmarkMarkdownFormatter extends BookmarkDefaultFormatter | |||
79 | protected function formatTagList($bookmark) | 81 | protected function formatTagList($bookmark) |
80 | { | 82 | { |
81 | $out = parent::formatTagList($bookmark); | 83 | $out = parent::formatTagList($bookmark); |
82 | if (($pos = array_search(self::NO_MD_TAG, $out)) !== false) { | 84 | if ($this->isLoggedIn === false && ($pos = array_search(self::NO_MD_TAG, $out)) !== false) { |
83 | unset($out[$pos]); | 85 | unset($out[$pos]); |
84 | return array_values($out); | 86 | return array_values($out); |
85 | } | 87 | } |