mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-11-17 11:34:03 +01:00
Hide tag menu for unauthenticated users (#1176)
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
<section aria-labelledby="tags-heading">
|
<section aria-labelledby="tags-heading">
|
||||||
<div class="section-header no-wrap">
|
<div class="section-header no-wrap">
|
||||||
<h2 id="tags-heading">Tags</h2>
|
<h2 id="tags-heading">Tags</h2>
|
||||||
|
{% if user.is_authenticated %}
|
||||||
<div ld-dropdown class="dropdown dropdown-right ml-auto">
|
<div ld-dropdown class="dropdown dropdown-right ml-auto">
|
||||||
<button class="btn btn-noborder dropdown-toggle" aria-label="Tabs menu">
|
<button class="btn btn-noborder dropdown-toggle" aria-label="Tags menu">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none"
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none"
|
||||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div id="tag-cloud-container">
|
<div id="tag-cloud-container">
|
||||||
{% include 'bookmarks/tag_cloud.html' %}
|
{% include 'bookmarks/tag_cloud.html' %}
|
||||||
|
|||||||
@@ -660,3 +660,21 @@ class BookmarkSharedViewTestCase(
|
|||||||
feed = soup.select_one('head link[type="application/rss+xml"]')
|
feed = soup.select_one('head link[type="application/rss+xml"]')
|
||||||
self.assertIsNotNone(feed)
|
self.assertIsNotNone(feed)
|
||||||
self.assertEqual(feed.attrs["href"], reverse("linkding:feeds.public_shared"))
|
self.assertEqual(feed.attrs["href"], reverse("linkding:feeds.public_shared"))
|
||||||
|
|
||||||
|
def test_tag_menu_visible_for_authenticated_user(self):
|
||||||
|
self.authenticate()
|
||||||
|
|
||||||
|
response = self.client.get(reverse("linkding:bookmarks.shared"))
|
||||||
|
html = response.content.decode()
|
||||||
|
|
||||||
|
soup = self.make_soup(html)
|
||||||
|
tag_menu = soup.find(attrs={"aria-label": "Tags menu"})
|
||||||
|
self.assertIsNotNone(tag_menu)
|
||||||
|
|
||||||
|
def test_tag_menu_not_visible_for_unauthenticated_user(self):
|
||||||
|
response = self.client.get(reverse("linkding:bookmarks.shared"))
|
||||||
|
html = response.content.decode()
|
||||||
|
|
||||||
|
soup = self.make_soup(html)
|
||||||
|
tag_menu = soup.find(attrs={"aria-label": "Tags menu"})
|
||||||
|
self.assertIsNone(tag_menu)
|
||||||
|
|||||||
Reference in New Issue
Block a user