From b9ddf08c6c6f1b05df0ac7919e34a663d47d9264 Mon Sep 17 00:00:00 2001 From: Fabricio Winter Date: Fri, 30 Dec 2022 13:15:25 -0300 Subject: [PATCH] Allow default anonymous uploads --- client/css/post-upload.styl | 3 +++ client/html/post_upload.tpl | 8 ++++++++ client/js/views/post_upload_view.js | 13 ++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/client/css/post-upload.styl b/client/css/post-upload.styl index f24c3c9e..a571d348 100644 --- a/client/css/post-upload.styl +++ b/client/css/post-upload.styl @@ -53,6 +53,9 @@ $cancel-button-color = tomato .pause-remain-on-error margin-left: 1em + .upload-all-anonymous + margin-left: 1em + form>.messages margin-top: 1em diff --git a/client/html/post_upload.tpl b/client/html/post_upload.tpl index 54a9871d..de5d32ee 100644 --- a/client/html/post_upload.tpl +++ b/client/html/post_upload.tpl @@ -29,6 +29,14 @@ }) %> + + <%= ctx.makeCheckbox({ + text: 'Upload anonymously', + name: 'upload-all-anonymous', + checked: false, + }) %> + + <%= ctx.makeTextInput({placeholder: 'Common tags', id: 'common-tags', name: 'common-tags', style: 'margin-top:1em;'}) %> diff --git a/client/js/views/post_upload_view.js b/client/js/views/post_upload_view.js index 7d0f55da..6927ac30 100644 --- a/client/js/views/post_upload_view.js +++ b/client/js/views/post_upload_view.js @@ -311,12 +311,11 @@ class PostUploadView extends events.EventTarget { uploadable.safety = safetyNode.value; } - const anonymousNode = rowNode.querySelector( - ".anonymous input:checked" - ); - if (anonymousNode) { - uploadable.anonymous = true; + let anonymous = this._uploadAllAnonymous?.checked; + if (!anonymous) { + anonymous = rowNode.querySelector(".anonymous input:checked"); } + uploadable.anonymous = anonymous; uploadable.tags = []; if (this._commonTagsInputNode) { @@ -458,6 +457,10 @@ class PostUploadView extends events.EventTarget { ); } + get _uploadAllAnonymous() { + return this._hostNode.querySelector("form [name=upload-all-anonymous]"); + } + get _submitButtonNode() { return this._hostNode.querySelector("form [type=submit]"); }