Skip to content

Commit

Permalink
FIX: Ensure status change when no comment
Browse files Browse the repository at this point in the history
* Fix the triggering of task status from the feeback
  dialog, even when there is no comment.
* Only post comment when there is comment text
  • Loading branch information
macite committed Mar 21, 2016
1 parent a870cbf commit 9ad76cd
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ angular.module('doubtfire.tasks.task-feedback-assessor',[])
$scope.comment = { text: "" }

$scope.triggerTransition = (status) ->
# Firstly, try to add a comment
taskService.addComment $scope.task, $scope.comment.text,
(success) ->
# If the comment was successful then reset text and trigger transition
$scope.comment.text = ""
taskService.updateTaskStatus $scope.unit, $scope.task.project(), $scope.task, status
if $scope.comment.text.length > 0
# Firstly, try to add a comment
taskService.addComment $scope.task, $scope.comment.text,
(success) ->
# If the comment was successful then reset text and trigger transition
$scope.comment.text = ""
# Always trigger status update
taskService.updateTaskStatus $scope.unit, $scope.task.project(), $scope.task, status

if $scope.onStatusUpdate? && _.isFunction($scope.onStatusUpdate)
$scope.$on 'TaskStatusUpdated', (event, args) ->
Expand Down

0 comments on commit 9ad76cd

Please sign in to comment.