Option to always upload similar posts instead of confirming every time
This commit is contained in:
parent
f4ca435657
commit
516b3a51a7
4 changed files with 23 additions and 4 deletions
|
@ -13,8 +13,10 @@ $cancel-button-color = tomato
|
|||
|
||||
&.inactive input[type=submit],
|
||||
&.inactive .skip-duplicates
|
||||
&.inactive .always-upload-similar
|
||||
&.uploading input[type=submit],
|
||||
&.uploading .skip-duplicates,
|
||||
&.uploading .always-upload-similar
|
||||
&:not(.uploading) .cancel
|
||||
display: none
|
||||
|
||||
|
@ -39,6 +41,9 @@ $cancel-button-color = tomato
|
|||
.skip-duplicates
|
||||
margin-left: 1em
|
||||
|
||||
.always-upload-similar
|
||||
margin-left: 1em
|
||||
|
||||
form>.messages
|
||||
margin-top: 1em
|
||||
|
||||
|
|
|
@ -13,6 +13,14 @@
|
|||
}) %>
|
||||
</span>
|
||||
|
||||
<span class='always-upload-similar'>
|
||||
<%= ctx.makeCheckbox({
|
||||
text: 'Always upload similar',
|
||||
name: 'always-upload-similar',
|
||||
checked: false,
|
||||
}) %>
|
||||
</span>
|
||||
|
||||
<input type='button' value='Cancel' class='cancel'/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -63,7 +63,8 @@ class PostUploadController {
|
|||
promise.then(() =>
|
||||
this._uploadSinglePost(
|
||||
uploadable,
|
||||
e.detail.skipDuplicates
|
||||
e.detail.skipDuplicates,
|
||||
e.detail.alwaysUploadSimilar
|
||||
)
|
||||
.catch((error) => {
|
||||
anyFailures = true;
|
||||
|
@ -84,7 +85,7 @@ class PostUploadController {
|
|||
} else {
|
||||
this._view.showError(
|
||||
error.message,
|
||||
error.uploadable
|
||||
uploadable
|
||||
);
|
||||
}
|
||||
})
|
||||
|
@ -106,7 +107,7 @@ class PostUploadController {
|
|||
);
|
||||
}
|
||||
|
||||
_uploadSinglePost(uploadable, skipDuplicates) {
|
||||
_uploadSinglePost(uploadable, skipDuplicates, alwaysUploadSimilar) {
|
||||
progress.start();
|
||||
let reverseSearchPromise = Promise.resolve();
|
||||
if (!uploadable.lookalikesConfirmed) {
|
||||
|
@ -135,7 +136,7 @@ class PostUploadController {
|
|||
}
|
||||
|
||||
// notify about similar posts
|
||||
if (searchResult.similarPosts.length) {
|
||||
if (searchResult.similarPosts.length && !alwaysUploadSimilar) {
|
||||
let error = new Error(
|
||||
`Found ${searchResult.similarPosts.length} similar ` +
|
||||
"posts.\nYou can resume or discard this upload."
|
||||
|
|
|
@ -350,6 +350,7 @@ class PostUploadView extends events.EventTarget {
|
|||
detail: {
|
||||
uploadables: this._uploadables,
|
||||
skipDuplicates: this._skipDuplicatesCheckboxNode.checked,
|
||||
alwaysUploadSimilar: this._alwaysUploadSimilarCheckboxNode.checked,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
@ -413,6 +414,10 @@ class PostUploadView extends events.EventTarget {
|
|||
return this._hostNode.querySelector("form [name=skip-duplicates]");
|
||||
}
|
||||
|
||||
get _alwaysUploadSimilarCheckboxNode() {
|
||||
return this._hostNode.querySelector("form [name=always-upload-similar]");
|
||||
}
|
||||
|
||||
get _submitButtonNode() {
|
||||
return this._hostNode.querySelector("form [type=submit]");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue