From d27ec057c5bbff2c50287c2950fb68d09c8b1487 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 27 Mar 2015 21:49:53 -0400 Subject: [PATCH] closes #2910 --- public/src/modules/composer.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index fa76d6b517..9545759395 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -121,8 +121,8 @@ define('composer', [ } } - function composerAlert(message) { - $('[data-action="post"]').removeAttr('disabled'); + function composerAlert(post_uuid, message) { + $('#cmp-uuid-' + post_uuid).find('.composer-submit').removeAttr('disabled'); app.alert({ type: 'danger', timeout: 3000, @@ -498,17 +498,17 @@ define('composer', [ var checkTitle = parseInt(postData.cid, 10) || parseInt(postData.pid, 10); if (uploads.inProgress[post_uuid] && uploads.inProgress[post_uuid].length) { - return composerAlert('[[error:still-uploading]]'); + return composerAlert(post_uuid, '[[error:still-uploading]]'); } else if (checkTitle && titleEl.val().length < parseInt(config.minimumTitleLength, 10)) { - return composerAlert('[[error:title-too-short, ' + config.minimumTitleLength + ']]'); + return composerAlert(post_uuid, '[[error:title-too-short, ' + config.minimumTitleLength + ']]'); } else if (checkTitle && titleEl.val().length > parseInt(config.maximumTitleLength, 10)) { - return composerAlert('[[error:title-too-long, ' + config.maximumTitleLength + ']]'); + return composerAlert(post_uuid, '[[error:title-too-long, ' + config.maximumTitleLength + ']]'); } else if (checkTitle && !utils.slugify(titleEl.val()).length) { - return composerAlert('[[error:invalid-title]]'); + return composerAlert(post_uuid, '[[error:invalid-title]]'); } else if (bodyEl.val().length < parseInt(config.minimumPostLength, 10)) { - return composerAlert('[[error:content-too-short, ' + config.minimumPostLength + ']]'); + return composerAlert(post_uuid, '[[error:content-too-short, ' + config.minimumPostLength + ']]'); } else if (bodyEl.val().length > parseInt(config.maximumPostLength, 10)) { - return composerAlert('[[error:content-too-long, ' + config.maximumPostLength + ']]'); + return composerAlert(post_uuid, '[[error:content-too-long, ' + config.maximumPostLength + ']]'); } var composerData = {}, action; @@ -546,7 +546,7 @@ define('composer', [ } socket.emit(action, composerData, function (err, data) { - $('[data-action="post"]').removeAttr('disabled'); + postContainer.find('.composer-submit').removeAttr('disabled'); if (err) { if (err.message === '[[error:email-not-confirmed]]') { return app.showEmailConfirmWarning(err);