Add option to mark bookmarks as shared by default (#1170)

* Add option to mark bookmarks as shared by default

* add migration
This commit is contained in:
Sascha Ißbrücker
2025-08-22 20:05:56 +02:00
committed by GitHub
parent 723b843c13
commit 6c874afff2
7 changed files with 86 additions and 6 deletions

View File

@@ -281,3 +281,28 @@ class BookmarkNewViewTestCase(TestCase, BookmarkFactoryMixin):
'<input type="checkbox" name="unread" id="id_unread" checked="" aria-describedby="id_unread_help">',
html,
)
def test_should_not_check_shared_by_default(self):
self.user.profile.enable_sharing = True
self.user.profile.save()
response = self.client.get(reverse("linkding:bookmarks.new"))
html = response.content.decode()
self.assertInHTML(
'<input type="checkbox" name="shared" id="id_shared" aria-describedby="id_shared_help">',
html,
)
def test_should_check_shared_when_configured_in_profile(self):
self.user.profile.enable_sharing = True
self.user.profile.default_mark_shared = True
self.user.profile.save()
response = self.client.get(reverse("linkding:bookmarks.new"))
html = response.content.decode()
self.assertInHTML(
'<input type="checkbox" name="shared" id="id_shared" checked="" aria-describedby="id_shared_help">',
html,
)

View File

@@ -115,6 +115,7 @@ class SettingsGeneralViewTestCase(TestCase, BookmarkFactoryMixin):
"display_remove_bookmark_action": False,
"permanent_notes": True,
"default_mark_unread": True,
"default_mark_shared": True,
"custom_css": "body { background-color: #000; }",
"auto_tagging_rules": "example.com tag",
"items_per_page": "10",
@@ -188,6 +189,9 @@ class SettingsGeneralViewTestCase(TestCase, BookmarkFactoryMixin):
self.assertEqual(
self.user.profile.default_mark_unread, form_data["default_mark_unread"]
)
self.assertEqual(
self.user.profile.default_mark_shared, form_data["default_mark_shared"]
)
self.assertEqual(self.user.profile.custom_css, form_data["custom_css"])
self.assertEqual(
self.user.profile.auto_tagging_rules, form_data["auto_tagging_rules"]