<commit_before>angular.module("doubtfire.tasks.task-comment-composer", [])

#
# Allows a new comment to be created and added to a task
# Includes the ability to create and add audio, text, and image comments
#
.directive('taskCommentComposer', ->
  restrict: 'E'
  templateUrl: 'tasks/task-comment-composer/task-comment-composer.tpl.html'
  scope:
    task: '='
    comment: '=ngModel'
    singleDropZone: '=?'
  controller: ($scope, $modal, $state, $sce, $timeout, CommentResourceService, CommentsModal, listenerService, currentUser, TaskFeedback, TaskComment, Task, Project, taskService, alertService, projectService, analyticsService) ->

    $scope.isRecorderOpen = false
    # Initialise comment
    $scope.comment = {
      text: ""
      type: "text"
    }

    $scope.audioPopover = 'audioRecorderPopover.html'

    # Don't insert a newline character when sending a comment
    $scope.keyPress = (e) ->
      if (e.key.toLowerCase() == "enter" && !e.shiftKey)
        e.preventDefault()
        $scope.addComment()

    $scope.formatImageName = (imageName) ->
      index = imageName.indexOf(".")
      nameString = imageName.substring(0,index)
      typeString = imageName.substring(index)

      if nameString.length > 20
        nameString = nameString.substring(0,20) + ".."
<commit_msg>ENHANCE: Don't attempt send comment if text is empty<commit_after>angular.module("doubtfire.tasks.task-comment-composer", [])

#
# Allows a new comment to be created and added to a task
# Includes the ability to create and add audio, text, and image comments
#
.directive('taskCommentComposer', ->
  restrict: 'E'
  templateUrl: 'tasks/task-comment-composer/task-comment-composer.tpl.html'
  scope:
    task: '='
    comment: '=ngModel'
    singleDropZone: '=?'
  controller: ($scope, $modal, $state, $sce, $timeout, CommentResourceService, CommentsModal, listenerService, currentUser, TaskFeedback, TaskComment, Task, Project, taskService, alertService, projectService, analyticsService) ->

    $scope.isRecorderOpen = false
    # Initialise comment
    $scope.comment = {
      text: ""
      type: "text"
    }

    $scope.audioPopover = 'audioRecorderPopover.html'

    # Don't insert a newline character when sending a comment
    $scope.keyPress = (e) ->
      if (e.key.toLowerCase() == "enter" && !e.shiftKey)
        e.preventDefault()
        if $scope.comment.text.trim() != ""
          $scope.addComment()

    $scope.formatImageName = (imageName) ->
      index = imageName.indexOf(".")
      nameString = imageName.substring(0,index)
      typeString = imageName.substring(index)

      if nameString.length > 20
        nameString = nameString.substring(0,20) + ".."

{'fraction_non_alphanumeric': 0.12970555348490495, 'fraction_numerical': 0.004472605292582929, 'mean_word_length': 3.5185185185185186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2142649', 'n_tokens_mistral': 826, 'n_tokens_neox': 814, 'n_words': 196}