diff --git a/app/assets/javascripts/comment.js b/app/assets/javascripts/comment.js index 54c2e6d6f4..42e6b77c2a 100644 --- a/app/assets/javascripts/comment.js +++ b/app/assets/javascripts/comment.js @@ -23,7 +23,8 @@ if(!$(this).hasClass('bound-error')) { $(this).addClass('bound-error').bind('ajax:error', function(e,response){ - notyNotification('mint', 3000, 'success', 'topRight', 'Some error occured while adding comment'); + notyNotification('mint', 3000, 'error', 'topRight', 'Some error occured while adding comment'); + $(this).find('#text-input').prop('disabled',false); $(this).find('.control-group').addClass('has-error') $(this).find('.control-group .help-block ').remove() $(this).find('#text-input').val(''); diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb index f8c9948c6f..8cb5e97799 100644 --- a/app/controllers/comment_controller.rb +++ b/app/controllers/comment_controller.rb @@ -51,8 +51,8 @@ def create end end rescue CommentError - flash[:error] = 'The comment could not be saved.' - render plain: 'failure' + flash.now[:error] = 'The comment could not be saved.' + render plain: 'failure', status: :bad_request end end