<commit_before>'use strict';

require('css/registrations.css');

require('bootstrap');

var $ = require('jquery');
var ko = require('knockout');
var Raven = require('raven-js');
var bootbox = require('bootbox');
var moment = require('moment');
var History = require('exports?History!history');

require('js/koHelpers');

var $osf = require('js/osfHelpers');
var osfLanguage = require('js/osfLanguage');
var SUPPORT_LINK = osfLanguage.SUPPORT_LINK;
var language = osfLanguage.registrations;

var SaveManager = require('js/saveManager');
var editorExtensions = require('js/registrationEditorExtensions');
var RegistrationModal = require('js/registrationModal');

// This value should match website.settings.DRAFT_REGISTRATION_APPROVAL_PERIOD
var DRAFT_REGISTRATION_MIN_EMBARGO_DAYS = 10;
var DRAFT_REGISTRATION_MIN_EMBARGO_TIMESTAMP = new Date().getTime() + (
        DRAFT_REGISTRATION_MIN_EMBARGO_DAYS * 24 * 60 * 60 * 1000
);

var VALIDATORS = {
    required: {
        validator: ko.validation.rules.required.validator,
        message: 'This question is required and unanswered.',
        messagePlural: 'Some required questions are unanswered.'
    }
};
var VALIDATOR_LOOKUP = {};
$.each(VALIDATORS, function(key, value) {
    VALIDATOR_LOOKUP[value.message] = value;
});

/**
 * @class Comment
 * Model for storing/editing/deleting comments on form fields
 *
 * @param {Object} data: optional data to instatiate model with
 * @param {User} data.user
 * @param {Date string} data.lastModified
 * @param {Date string} data.created
 * @param {Boolean} data.isDeleted
 * @param {String} data.value
 *
 * @type User
 * @property {String} id
 * @property {String} fullname
 **/
function Comment(data) {
    var self = this;

    self.saved = ko.observable(data ? true : false);

    data = data || {};
    self.user = data.user || $osf.currentUser();
    self.value = ko.observable(data.value || '');
    self.value.subscribe(function() {
        self.lastModified = new Date();
    });

    self.created = data.created ? new Date(data.created) : new Date();
    self.lastModified = data.lastModified ? new Date(data.lastModified) : new Date();

    self.isDeleted.subscribe(function(isDeleted) {
        if (isDeleted) {
            self.value('');
        }
    });

    self.seenBy = ko.observableArray(data.seenBy || [self.user.id]);<commit_msg>Readd a line that was deleted by mistake<commit_after>'use strict';

require('css/registrations.css');

require('bootstrap');

var $ = require('jquery');
var ko = require('knockout');
var Raven = require('raven-js');
var bootbox = require('bootbox');
var moment = require('moment');
var History = require('exports?History!history');

require('js/koHelpers');

var $osf = require('js/osfHelpers');
var osfLanguage = require('js/osfLanguage');
var SUPPORT_LINK = osfLanguage.SUPPORT_LINK;
var language = osfLanguage.registrations;

var SaveManager = require('js/saveManager');
var editorExtensions = require('js/registrationEditorExtensions');
var RegistrationModal = require('js/registrationModal');

// This value should match website.settings.DRAFT_REGISTRATION_APPROVAL_PERIOD
var DRAFT_REGISTRATION_MIN_EMBARGO_DAYS = 10;
var DRAFT_REGISTRATION_MIN_EMBARGO_TIMESTAMP = new Date().getTime() + (
        DRAFT_REGISTRATION_MIN_EMBARGO_DAYS * 24 * 60 * 60 * 1000
);

var VALIDATORS = {
    required: {
        validator: ko.validation.rules.required.validator,
        message: 'This question is required and unanswered.',
        messagePlural: 'Some required questions are unanswered.'
    }
};
var VALIDATOR_LOOKUP = {};
$.each(VALIDATORS, function(key, value) {
    VALIDATOR_LOOKUP[value.message] = value;
});

/**
 * @class Comment
 * Model for storing/editing/deleting comments on form fields
 *
 * @param {Object} data: optional data to instatiate model with
 * @param {User} data.user
 * @param {Date string} data.lastModified
 * @param {Date string} data.created
 * @param {Boolean} data.isDeleted
 * @param {String} data.value
 *
 * @type User
 * @property {String} id
 * @property {String} fullname
 **/
function Comment(data) {
    var self = this;

    self.saved = ko.observable(data ? true : false);

    data = data || {};
    self.user = data.user || $osf.currentUser();
    self.value = ko.observable(data.value || '');
    self.value.subscribe(function() {
        self.lastModified = new Date();
    });

    self.created = data.created ? new Date(data.created) : new Date();
    self.lastModified = data.lastModified ? new Date(data.lastModified) : new Date();

    self.isDeleted = ko.observable(data.isDeleted || false);
    self.isDeleted.subscribe(function(isDeleted) {
        if (isDeleted) {
            self.value('');
        }
    });

    self.seenBy = ko.observableArray(data.seenBy || [self.user.id]);
{'fraction_non_alphanumeric': 0.13942307692307693, 'fraction_numerical': 0.005016722408026756, 'mean_word_length': 4.123126338329764, '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': '4109857', 'n_tokens_mistral': 1550, 'n_tokens_neox': 1503, 'n_words': 343}