$title = $request->getParam('title');
$description = $request->getParam('description');
$tags = $request->getParam('tags');
- $private = filter_var($request->getParam('private'), FILTER_VALIDATE_BOOLEAN);
+ if ($request->getParam('private') !== null) {
+ $private = filter_var($request->getParam('private'), FILTER_VALIDATE_BOOLEAN);
+ } else {
+ $private = $this->container->conf->get('privacy.default_private_links', false);
+ }
// If this is an HTTP(S) link, we try go get the page to extract
// the title (otherwise we will to straight to the edit form.)
e.preventDefault();
toggleBulkCreationVisibility(bulkCreationButton, bulkCreationForm);
});
+
+ // Force to send falsy value if the checkbox is not checked.
+ const privateButton = bulkCreationForm.querySelector('input[type="checkbox"][name="private"]');
+ const privateHiddenButton = bulkCreationForm.querySelector('input[type="hidden"][name="private"]');
+ privateButton.addEventListener('click', () => {
+ privateHiddenButton.disabled = !privateHiddenButton.disabled;
+ });
+ privateHiddenButton.disabled = privateButton.checked;
}
})();
</div>
<div>
- <input type="checkbox" name="private"
- {if="$default_private_links"} checked="checked"{/if}>
+ <input type="hidden" name="private" value="0">
+ <input type="checkbox" name="private" {if="$default_private_links"} checked="checked"{/if}>
<label for="lf_private">{'Private'|t}</label>
</div>
</div>
<div>
<input type="checkbox" name="lf_private" id="lf_private"
- {if="($link_is_new && $default_private_links || $link.private == true)"}
+ {if="$link.private === true"}
checked="checked"
{/if}>
<label for="lf_private">{'Private'|t}</label>