<commit_before><template>
  <div>
    <div class="card comment" v-if="currentUser">
      <editor v-model="body" @submit="newComment"></editor>
      <b-button @click="newComment" variant="primary">
        Add Comment
      </b-button>
    </div>
    <div class="card comment" v-else>
      <div class="comment card-block">
        You must be <a href="/#/login">logged in</a> to comment.
      </div>
    </div>
  </div>
</template>

<script>
 import Editor from '@/components/General/Editor'
 import Axios from 'axios'

 export default {
   name: 'comment-form',

   components: {
     Editor
   },

   computed: {
     currentUser: function () {
       return this.$store.getters.currentUser
     }
   },

   data: function () {
     return { body: '' }
   },

   methods: {
     newComment: function () {
       let url = '/api/tickets/' + this.$route.params.key + '/addComment'
       Axios.post(url,
         {
           body: this.body,
           author: this.currentUser.username
         }).then((res) => {
           this.$emit('newComment')
           this.body = ''
         }).catch((err) => {
           console.log('ERROR:', err)
         })
     }
   }
 }
</script>

<style lang="scss">
 .md-editor {
   width: 100%;
 }
</style>
<commit_msg>Update old link to a router-link<commit_after><template>
  <div>
    <div class="card comment" v-if="currentUser">
      <editor v-model="body" @submit="newComment"></editor>
      <b-button @click="newComment" variant="primary">
        Add Comment
      </b-button>
    </div>
    <div class="card comment" v-else>
      <div class="comment card-block">
        You must be <router-link v-bind:to="currentUrl">logged in</router-link> to comment.
      </div>
    </div>
  </div>
</template>

<script>
 import Editor from '@/components/General/Editor'
 import Axios from 'axios'

 export default {
   name: 'comment-form',

   components: {
     Editor
   },

   computed: {
     currentUser: function () {
       return this.$store.getters.currentUser
     },

     currentUrl: function () {
       return '/login?to=' + this.$route.path
     }
   },

   data: function () {
     return { body: '' }
   },

   methods: {
     newComment: function () {
       let url = '/api/tickets/' + this.$route.params.key + '/addComment'
       Axios.post(url,
         {
           body: this.body,
           author: this.currentUser.username
         }).then((res) => {
           this.$emit('newComment')
           this.body = ''
         }).catch((err) => {
           console.log('ERROR:', err)
         })
     }
   }
 }
</script>

<style lang="scss">
 .md-editor {
   width: 100%;
 }
</style>

{'fraction_non_alphanumeric': 0.16855203619909503, 'fraction_numerical': 0.0022624434389140274, 'mean_word_length': 2.0706018518518516, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 47, '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': '3733348', 'n_tokens_mistral': 857, 'n_tokens_neox': 845, 'n_words': 180}