<commit_before>Template.comment_edit.rendered = function(){
  var comment = this.data.comment;

  if(comment && Meteor.user() && !this.editor){
    this.editor = new EpicEditor(EpicEditorOptions).load();
    this.editor.importFile('editor', comment.body);
    $(this.editor.editor).bind('keydown', 'meta+return', function(){
      $(window.editor).closest('form').find('input[type="submit"]').click();
    });
  }
}

Template.comment_edit.events({
  'click input[type=submit]': function(e, instance){
    var comment = this;
    var content = cleanUp(instance.editor.exportFile());

    e.preventDefault();

    if(!Meteor.user())
      throw i18n.t('You must be logged in.');

    Comments.update(comment._id, {
      $set: {
        body: content
      }
    });

    trackEvent("edit comment", {'postId': comment.post, 'commentId': comment._id});
    Router.go("/posts/"+comment.post+"/comment/"+comment._id);
  },
  'click .delete-link': function(e){
    var comment = this;

    e.preventDefault();
    
    if(confirm(i18n.t("Are you sure?"))){
      Meteor.call('removeComment', comment._id);
      Router.go("/comments/deleted");
    }
  }
});<commit_msg>fixed issue for broken redirection to template after commment deletion<commit_after>Template.comment_edit.rendered = function(){
  var comment = this.data.comment;

  if(comment && Meteor.user() && !this.editor){
    this.editor = new EpicEditor(EpicEditorOptions).load();
    this.editor.importFile('editor', comment.body);
    $(this.editor.editor).bind('keydown', 'meta+return', function(){
      $(window.editor).closest('form').find('input[type="submit"]').click();
    });
  }
}

Template.comment_edit.events({
  'click input[type=submit]': function(e, instance){
    var comment = this;
    var content = cleanUp(instance.editor.exportFile());

    e.preventDefault();

    if(!Meteor.user())
      throw i18n.t('You must be logged in.');

    Comments.update(comment._id, {
      $set: {
        body: content
      }
    });

    trackEvent("edit comment", {'postId': comment.post, 'commentId': comment._id});
    Router.go("/posts/"+comment.post+"/comment/"+comment._id);
  },
  'click .delete-link': function(e){
    var comment = this;

    e.preventDefault();
    
    if(confirm(i18n.t("Are you sure?"))){
      Meteor.call('removeComment', comment._id);
      Router.go("/posts/"+comment.post)
      throwError("Your comment has been deleted.");
//      Router.go("/comments/deleted");
    }
  }
});
{'fraction_non_alphanumeric': 0.1869196608800969, 'fraction_numerical': 0.003229713362939039, 'mean_word_length': 3.4972776769509983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2348872', 'n_tokens_mistral': 795, 'n_tokens_neox': 770, 'n_words': 135}