Don't submit a new thread without a selected file. Fix #485.

This commit is contained in:
Nicolas Stepien 2012-05-19 14:01:53 +02:00
parent 605c09e4ec
commit d12c78ea39
2 changed files with 5 additions and 5 deletions

View File

@ -1951,7 +1951,8 @@
} }
QR.abort(); QR.abort();
reply = QR.replies[0]; reply = QR.replies[0];
if (!(reply.com || reply.file)) { threadID = g.THREAD_ID || $('select', QR.el).value;
if (!(threadID === 'new' && reply.file || threadID !== 'new' && (reply.com || reply.file))) {
err = 'No file selected.'; err = 'No file selected.';
} else { } else {
captchas = $.get('captchas', []); captchas = $.get('captchas', []);
@ -1980,7 +1981,6 @@
return; return;
} }
QR.cleanError(); QR.cleanError();
threadID = g.THREAD_ID || $('select', QR.el).value;
QR.cooldown.auto = QR.replies.length > 1; QR.cooldown.auto = QR.replies.length > 1;
if (Conf['Auto Hide QR'] && !QR.cooldown.auto) { if (Conf['Auto Hide QR'] && !QR.cooldown.auto) {
QR.hide(); QR.hide();

View File

@ -1471,8 +1471,10 @@ QR =
QR.abort() QR.abort()
reply = QR.replies[0] reply = QR.replies[0]
threadID = g.THREAD_ID or $('select', QR.el).value
# prevent errors # prevent errors
unless reply.com or reply.file unless threadID is 'new' and reply.file or threadID isnt 'new' and (reply.com or reply.file)
err = 'No file selected.' err = 'No file selected.'
else else
# get oldest valid captcha # get oldest valid captcha
@ -1499,8 +1501,6 @@ QR =
return return
QR.cleanError() QR.cleanError()
threadID = g.THREAD_ID or $('select', QR.el).value
# Enable auto-posting if we have stuff to post, disable it otherwise. # Enable auto-posting if we have stuff to post, disable it otherwise.
QR.cooldown.auto = QR.replies.length > 1 QR.cooldown.auto = QR.replies.length > 1
if Conf['Auto Hide QR'] and not QR.cooldown.auto if Conf['Auto Hide QR'] and not QR.cooldown.auto