aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--application/front/controller/admin/ShaarePublishController.php6
-rw-r--r--assets/default/js/base.js8
-rw-r--r--tpl/default/addlink.html4
-rw-r--r--tpl/default/editlink.html2
4 files changed, 16 insertions, 4 deletions
diff --git a/application/front/controller/admin/ShaarePublishController.php b/application/front/controller/admin/ShaarePublishController.php
index 608f79cf..fd680ea0 100644
--- a/application/front/controller/admin/ShaarePublishController.php
+++ b/application/front/controller/admin/ShaarePublishController.php
@@ -169,7 +169,11 @@ class ShaarePublishController extends ShaarliAdminController
169 $title = $request->getParam('title'); 169 $title = $request->getParam('title');
170 $description = $request->getParam('description'); 170 $description = $request->getParam('description');
171 $tags = $request->getParam('tags'); 171 $tags = $request->getParam('tags');
172 $private = filter_var($request->getParam('private'), FILTER_VALIDATE_BOOLEAN); 172 if ($request->getParam('private') !== null) {
173 $private = filter_var($request->getParam('private'), FILTER_VALIDATE_BOOLEAN);
174 } else {
175 $private = $this->container->conf->get('privacy.default_private_links', false);
176 }
173 177
174 // If this is an HTTP(S) link, we try go get the page to extract 178 // If this is an HTTP(S) link, we try go get the page to extract
175 // the title (otherwise we will to straight to the edit form.) 179 // the title (otherwise we will to straight to the edit form.)
diff --git a/assets/default/js/base.js b/assets/default/js/base.js
index 9161b4fc..4163577d 100644
--- a/assets/default/js/base.js
+++ b/assets/default/js/base.js
@@ -654,5 +654,13 @@ function init(description) {
654 e.preventDefault(); 654 e.preventDefault();
655 toggleBulkCreationVisibility(bulkCreationButton, bulkCreationForm); 655 toggleBulkCreationVisibility(bulkCreationButton, bulkCreationForm);
656 }); 656 });
657
658 // Force to send falsy value if the checkbox is not checked.
659 const privateButton = bulkCreationForm.querySelector('input[type="checkbox"][name="private"]');
660 const privateHiddenButton = bulkCreationForm.querySelector('input[type="hidden"][name="private"]');
661 privateButton.addEventListener('click', () => {
662 privateHiddenButton.disabled = !privateHiddenButton.disabled;
663 });
664 privateHiddenButton.disabled = privateButton.checked;
657 } 665 }
658})(); 666})();
diff --git a/tpl/default/addlink.html b/tpl/default/addlink.html
index 7d4bc9e6..4aac7ff1 100644
--- a/tpl/default/addlink.html
+++ b/tpl/default/addlink.html
@@ -62,8 +62,8 @@
62 </div> 62 </div>
63 63
64 <div> 64 <div>
65 <input type="checkbox" name="private" 65 <input type="hidden" name="private" value="0">
66 {if="$default_private_links"} checked="checked"{/if}> 66 <input type="checkbox" name="private" {if="$default_private_links"} checked="checked"{/if}>
67 &nbsp; <label for="lf_private">{'Private'|t}</label> 67 &nbsp; <label for="lf_private">{'Private'|t}</label>
68 </div> 68 </div>
69 </div> 69 </div>
diff --git a/tpl/default/editlink.html b/tpl/default/editlink.html
index 980b2b8e..83e541fd 100644
--- a/tpl/default/editlink.html
+++ b/tpl/default/editlink.html
@@ -65,7 +65,7 @@
65 65
66 <div> 66 <div>
67 <input type="checkbox" name="lf_private" id="lf_private" 67 <input type="checkbox" name="lf_private" id="lf_private"
68 {if="($link_is_new && $default_private_links || $link.private == true)"} 68 {if="$link.private === true"}
69 checked="checked" 69 checked="checked"
70 {/if}> 70 {/if}>
71 &nbsp;<label for="lf_private">{'Private'|t}</label> 71 &nbsp;<label for="lf_private">{'Private'|t}</label>