Kaynağa Gözat

Avoid empty comment submission.

Paulo Reis 9 yıl önce
ebeveyn
işleme
36f15ff56e

+ 9 - 3
services/web/app/views/project/editor/review-panel.jade

@@ -204,7 +204,8 @@ script(type='text/ng-template', id='commentEntryTemplate')
 				button.rp-entry-button(
 					ng-click="onReply();"
 					ng-if="permissions.comment"
-					ng-disabled="!entry.replyContent.length")
+					ng-disabled="!entry.replyContent.length"
+				)
 					i.fa.fa-reply
 					|  Reply
 	
@@ -284,10 +285,15 @@ script(type='text/ng-template', id='addCommentEntryTemplate')
 						focus-on="comment:new:open"
 					)
 				.rp-entry-actions
-					a.rp-entry-button(href, ng-click="cancelNewComment();") 
+					button.rp-entry-button(
+						ng-click="cancelNewComment();"
+					) 
 						i.fa.fa-times
 						|  Cancel
-					a.rp-entry-button(href, ng-click="submitNewComment()") 
+					button.rp-entry-button(
+						ng-click="submitNewComment()"
+						ng-disabled="!state.content.length"
+					) 
 						i.fa.fa-comment
 						|  Comment
 

+ 3 - 2
services/web/public/coffee/ide/review-panel/directives/addCommentEntry.coffee

@@ -27,8 +27,9 @@ define [
 			scope.handleCommentKeyPress = (ev) ->
 				if ev.keyCode == 13 and !ev.shiftKey and !ev.ctrlKey and !ev.metaKey
 					ev.preventDefault()
-					ev.target.blur()
-					scope.submitNewComment()
+					if scope.state.content.length > 0 
+						ev.target.blur()
+						scope.submitNewComment()
 
 			scope.submitNewComment = () ->
 				scope.onSubmit { content: scope.state.content }

+ 1 - 1
services/web/public/coffee/ide/review-panel/directives/commentEntry.coffee

@@ -18,7 +18,7 @@ define [
 			scope.handleCommentReplyKeyPress = (ev) ->
 				if ev.keyCode == 13 and !ev.shiftKey and !ev.ctrlKey and !ev.metaKey
 					ev.preventDefault()
-					if scope.entry.length > 0 
+					if scope.entry.replyContent.length > 0 
 						ev.target.blur()
 						scope.onReply()