Allow default anonymous uploads

This commit is contained in:
Fabricio Winter 2022-12-30 13:15:25 -03:00
parent 9f569f76b1
commit b9ddf08c6c
3 changed files with 19 additions and 5 deletions

View file

@ -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

View file

@ -29,6 +29,14 @@
}) %>
</span>
<span class='upload-all-anonymous'>
<%= ctx.makeCheckbox({
text: 'Upload anonymously',
name: 'upload-all-anonymous',
checked: false,
}) %>
</span>
<%= ctx.makeTextInput({placeholder: 'Common tags', id: 'common-tags', name: 'common-tags', style: 'margin-top:1em;'}) %>
<input type='button' value='Cancel' class='cancel'/>

View file

@ -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]");
}