Merge pull request #7275 from nextcloud/disable-elements-while-a-comment-is-being-deleted

Disable elements while a comment is being deleted
This commit is contained in:
Morris Jobke 2017-11-24 16:14:53 +01:00 committed by GitHub
commit 892d2630fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -35,8 +35,8 @@
border: none;
opacity: .3;
}
#commentsTabView .newCommentForm .submit:hover,
#commentsTabView .newCommentForm .submit:focus {
#commentsTabView .newCommentForm .submit:not(:disabled):hover,
#commentsTabView .newCommentForm .submit:not(:disabled):focus {
opacity: 1;
}

View File

@ -544,9 +544,16 @@
var $comment = $(ev.target).closest('.comment');
var commentId = $comment.data('id');
var $loading = $comment.find('.submitLoading');
var $commentField = $comment.find('.message');
var $submit = $comment.find('.submit');
var $cancel = $comment.find('.cancel');
$commentField.prop('contenteditable', false);
$submit.prop('disabled', true);
$cancel.prop('disabled', true);
$comment.addClass('disabled');
$loading.removeClass('hidden');
this.collection.get(commentId).destroy({
success: function() {
$comment.data('commentEl').remove();
@ -555,6 +562,10 @@
error: function() {
$loading.addClass('hidden');
$comment.removeClass('disabled');
$commentField.prop('contenteditable', true);
$submit.prop('disabled', false);
$cancel.prop('disabled', false);
OC.Notification.showTemporary(t('comments', 'Error occurred while retrieving comment with id {id}', {id: commentId}));
}
});