<commit_before>/*jshint indent:2, curly:true eqeqeq:true, immed:true, latedef:true,
newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true
white:true*/
/*global XT:true, XM:true, Backbone:true, _:true, console:true */

(function () {
  "use strict";

  /**
    @class

    @extends XM.Model
  */
  XM.Settings = XM.Model.extend(/** @lends XM.Settings# */{

    autoFetchId: false,
    
    parse: function (resp) {
      return resp;
    },
    
    save: function (key, value, options) {
      options = options ? _.clone(options) : {};
      var that = this,
        success = options.success;
        
      // Handle both `"key", value` and `{key: value}` -style arguments.
      if (_.isObject(key) || _.isEmpty(key)) {
        options = value ? _.clone(value) : {};
      }
        
      options.success = function (resp) {
        XT.session.settings.set(that.attributes);
        if (success) { success(that, resp, options); }
      };
      
      // Handle both `"key", value` and `{key: value}` -style arguments.
      if (_.isObject(key) || _.isEmpty(key)) { value = options; }
      return XM.Model.prototype.save.call(this, key, value, options);
    },
    
    /**
      Reimplemented to discard `dataState`.
<commit_msg>issue #18411: Fix options pass through on setting save.<commit_after>/*jshint indent:2, curly:true eqeqeq:true, immed:true, latedef:true,
newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true
white:true*/
/*global XT:true, XM:true, Backbone:true, _:true, console:true */

(function () {
  "use strict";

  /**
    @class

    @extends XM.Model
  */
  XM.Settings = XM.Model.extend(/** @lends XM.Settings# */{

    autoFetchId: false,
    
    parse: function (resp) {
      return resp;
    },
    
    save: function (key, value, options) {
      options = options ? _.clone(options) : {};
      var that = this,
        success;
        
      // Handle both `"key", value` and `{key: value}` -style arguments.
      if (_.isObject(key) || _.isEmpty(key)) {
        options = value ? _.clone(value) : {};
      } else {
        options = options ? _.clone(options) : {};
      }
      success = options.success;
        
      options.success = function (resp) {
        XT.session.settings.set(that.attributes);
        if (success) { success(that, resp, options); }
      };
      
      // Handle both `"key", value` and `{key: value}` -style arguments.
      if (_.isObject(key) || _.isEmpty(key)) { value = options; }
      return XM.Model.prototype.save.call(this, key, value, options);
    },
    
    /**
      Reimplemented to discard `dataState`.

{'fraction_non_alphanumeric': 0.15940931465354033, 'fraction_numerical': 0.0026505111700113595, 'mean_word_length': 2.4763157894736842, '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': '3348842', 'n_tokens_mistral': 873, 'n_tokens_neox': 857, 'n_words': 205}