<commit_before>Maildog.Views.EmailListItem = Backbone.View.extend({
  template: JST['emailListItem'],
  tagName: "li",
  className: "email-list-item group",

  initialize: function(options) {
    this.folder = options.folder;
  },

  events: {
    "click .star": "starClick",
    "click .check-box": "checkBoxClick"
  },

  render: function() {
    var correspondent = this.model.correspondentString(this.folder);
    var content = this.template({
      email: this.model,
      correspondent: correspondent
    });

    this.$el.html(content);
    if (this.folder === "drafts") { this.swapLinkForDiv(); }
    this.$el.attr('data-id', this.model.id);

    return this;
  },

  starClick: function(e) {
    e.preventDefault();
    $(e.currentTarget).toggleClass('star-on');
    if (this.model.get('starred')) {
      this.model.set('starred', false)
    } else {
      this.model.set('starred', true)
    }
    // this.model.save({}, {
    //   error: function() {
    //     alert('error')
    //   }
    // })
  },

  checkBoxClick: function(e) {
    this.$('.check-box-container').toggleClass('checked');
    this.$el.toggleClass("checked-list-item");
    $(e.currentTarget).toggleClass("checked-check-box");
  },

  swapLinkForDiv: function() {
    var $a = this.$("a");
    $div = $("<div>");
    $div.addClass($a.attr('class'))
    $div.append($a.children());
    $a.replaceWith($div);
    this.events["click"] = "showDraft";
    this.delegateEvents();
  },

  showDraft: function() {
    var thread = new Maildog.Collections.EmailThreads([], { id: this.model.id });
    thread.fetch({
      reset: true,
      success: function() {
        if (thread.length === 1) {
          var view = new Maildog.Views.ComposeEmailBox({
            email: thread.at(0)
          });
          Maildog.emailFolders.addSubview('.compose-email-popup-container', view);
          $('.compose-email-body').focus();
        } else {<commit_msg>remove flashes when click on email list item > draft message<commit_after>Maildog.Views.EmailListItem = Backbone.View.extend({
  template: JST['emailListItem'],
  tagName: "li",
  className: "email-list-item group",

  initialize: function(options) {
    this.folder = options.folder;
  },

  events: {
    "click .star": "starClick",
    "click .check-box": "checkBoxClick"
  },

  render: function() {
    var correspondent = this.model.correspondentString(this.folder);
    var content = this.template({
      email: this.model,
      correspondent: correspondent
    });

    this.$el.html(content);
    if (this.folder === "drafts") { this.swapLinkForDiv(); }
    this.$el.attr('data-id', this.model.id);

    return this;
  },

  starClick: function(e) {
    e.preventDefault();
    $(e.currentTarget).toggleClass('star-on');
    if (this.model.get('starred')) {
      this.model.set('starred', false)
    } else {
      this.model.set('starred', true)
    }
    // this.model.save({}, {
    //   error: function() {
    //     alert('error')
    //   }
    // })
  },

  checkBoxClick: function(e) {
    this.$('.check-box-container').toggleClass('checked');
    this.$el.toggleClass("checked-list-item");
    $(e.currentTarget).toggleClass("checked-check-box");
  },

  swapLinkForDiv: function() {
    var $a = this.$("a");
    $div = $("<div>");
    $div.addClass($a.attr('class'))
    $div.append($a.children());
    $a.replaceWith($div);
    this.events["click"] = "showDraft";
    this.delegateEvents();
  },

  showDraft: function() {
    Maildog.router.removeFlashes();
    var thread = new Maildog.Collections.EmailThreads([], { id: this.model.id });
    thread.fetch({
      reset: true,
      success: function() {
        if (thread.length === 1) {
          var view = new Maildog.Views.ComposeEmailBox({
            email: thread.at(0)
          });
          Maildog.emailFolders.addSubview('.compose-email-popup-container', view);
          $('.compose-email-body').focus();
        } else {
{'fraction_non_alphanumeric': 0.18605830164765527, 'fraction_numerical': 0.0010139416983523447, 'mean_word_length': 2.7724665391969405, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 6, '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': '1206026', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1273, 'n_words': 210}