<commit_before>/** @jsx m */

"use strict";
require("./CommentForm.scss");

var m = require("mithril");

var CommentForm = {};

CommentForm.controller = function(options) {
  this.body = m.prop("");
  this.anonymous = m.prop(false);
  this.user = options.user;
  this.comments = options.comments;
  this.field = options.field;

  var _this = this;

  this.handleSubmit = function(e) {
    e.preventDefault();
    var res = _this.comments.add({
      "owner_id": _this.user.get("id"),
      "comment": _this.body(),
      "anonymous": _this.anonymous(),
      "field": _this.field
    }, {sync: true});

    _this.body("");
    if (options.onAdd) {
      options.onAdd();
    }
  };

  this.handleInput = function() {
    _this.body(this.value);
    CommentForm.autosize(this);
  };<commit_msg>CommentForm: pre-fill in name and created_at<commit_after>/** @jsx m */

"use strict";
require("./CommentForm.scss");

var m = require("mithril");

var CommentForm = {};

CommentForm.controller = function(options) {
  this.body = m.prop("");
  this.anonymous = m.prop(false);
  this.user = options.user;
  this.comments = options.comments;
  this.field = options.field;

  var _this = this;

  this.handleSubmit = function(e) {
    e.preventDefault();
    var res = _this.comments.add({
      "owner_id": _this.user.get("id"),
      "comment": _this.body(),
      "anonymous": _this.anonymous(),
      "field": _this.field,
      "name": _this.user.get("fullName"),
      "created_at": (new Date()).toString()
    }, {sync: true});

    _this.body("");
    if (options.onAdd) {
      options.onAdd();
    }
  };

  this.handleInput = function() {
    _this.body(this.value);
    CommentForm.autosize(this);
  };
{'fraction_non_alphanumeric': 0.18368544600938966, 'fraction_numerical': 0.0, 'mean_word_length': 3.128329297820823, 'pattern_counts': {'":': 10, '<': 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': '3288187', 'n_tokens_mistral': 591, 'n_tokens_neox': 586, 'n_words': 110}