diff --git a/client/css/post-upload.styl b/client/css/post-upload.styl index aa36e0a..3836293 100644 --- a/client/css/post-upload.styl +++ b/client/css/post-upload.styl @@ -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 diff --git a/client/html/post_upload.tpl b/client/html/post_upload.tpl index f1ed88f..6374fe8 100644 --- a/client/html/post_upload.tpl +++ b/client/html/post_upload.tpl @@ -13,6 +13,14 @@ }) %> + + <%= ctx.makeCheckbox({ + text: 'Always upload similar', + name: 'always-upload-similar', + checked: false, + }) %> + + diff --git a/client/js/controllers/post_upload_controller.js b/client/js/controllers/post_upload_controller.js index cfebb0a..83ec271 100644 --- a/client/js/controllers/post_upload_controller.js +++ b/client/js/controllers/post_upload_controller.js @@ -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." diff --git a/client/js/views/post_upload_view.js b/client/js/views/post_upload_view.js index 7daf4fb..49aab7f 100644 --- a/client/js/views/post_upload_view.js +++ b/client/js/views/post_upload_view.js @@ -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]"); }