Merge pull request #25257 from owncloud/comments-showerroronsave

Show error message when posting an invalid comment
This commit is contained in:
Christoph Wurst 2016-06-24 17:11:20 +02:00 committed by GitHub
commit e9a0a6d83a
3 changed files with 12 additions and 8 deletions

View File

@ -337,10 +337,10 @@
$comment.data('commentEl').remove();
$comment.remove();
},
error: function(msg) {
error: function() {
$loading.addClass('hidden');
$comment.removeClass('disabled');
OC.Notification.showTemporary(msg);
OC.Notification.showTemporary(t('comments', 'Error occurred while retrieving comment with id {id}', {id: commentId}));
}
});
@ -388,12 +388,12 @@
.html(self._formatMessage(model.get('message')));
$row.remove();
},
error: function(msg) {
error: function() {
$submit.removeClass('hidden');
$loading.addClass('hidden');
$textArea.prop('disabled', false);
OC.Notification.showTemporary(msg);
OC.Notification.showTemporary(t('comments', 'Error occurred while updating comment with id {id}', {id: commentId}));
}
});
} else {
@ -413,12 +413,12 @@
$loading.addClass('hidden');
$textArea.val('').prop('disabled', false);
},
error: function(msg) {
error: function() {
$submit.removeClass('hidden');
$loading.addClass('hidden');
$textArea.prop('disabled', false);
OC.Notification.showTemporary(msg);
OC.Notification.showTemporary(t('comments', 'Error occurred while posting comment'));
}
});
}

View File

@ -185,7 +185,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
$msg = 'Message exceeds allowed character limit of ';
throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e);
}
return false;
throw $e;
}
}

View File

@ -166,6 +166,10 @@ class CommentsNodeTest extends \Test\TestCase {
$this->assertTrue($this->node->updateComment($msg));
}
/**
* @expectedException Exception
* @expectedExceptionMessage buh!
*/
public function testUpdateCommentLogException() {
$msg = null;
@ -198,7 +202,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->logger->expects($this->once())
->method('logException');
$this->assertFalse($this->node->updateComment($msg));
$this->node->updateComment($msg);
}
/**