When adding multiple files, if there is only one reply and no file has been selected, set the first file to it instead of creating a new reply.

This commit is contained in:
Nicolas Stepien 2012-01-10 16:49:39 +01:00
parent 84057f65c1
commit 4f2c1eb775
2 changed files with 10 additions and 2 deletions

View File

@ -1300,8 +1300,12 @@
qr.error("" + file.name + ": Unsupported file type."); qr.error("" + file.name + ": Unsupported file type.");
break; break;
} }
if (qr.replies.length === 1 && !qr.replies[0].file) {
qr.replies[0].file = file;
} else {
new qr.reply(file); new qr.reply(file);
} }
}
return $.addClass(qr.el, 'dump'); return $.addClass(qr.el, 'dump');
}, },
replies: [], replies: [],

View File

@ -961,6 +961,10 @@ qr =
else if -1 is qr.mimeTypes.indexOf file.type else if -1 is qr.mimeTypes.indexOf file.type
qr.error "#{file.name}: Unsupported file type." qr.error "#{file.name}: Unsupported file type."
break break
if qr.replies.length is 1 and not qr.replies[0].file
# set initial reply's file
qr.replies[0].file = file
else
new qr.reply file new qr.reply file
$.addClass qr.el, 'dump' $.addClass qr.el, 'dump'