<commit_before>import CanCheckEmails from 'discourse/mixins/can-check-emails';
import { propertyNotEqual, setting } from 'discourse/lib/computed';

export default Ember.Controller.extend(CanCheckEmails, {
  editingTitle: false,
  originalPrimaryGroupId: null,
  availableGroups: null,

  showApproval: setting('must_approve_users'),
  showBadges: setting('enable_badges'),

  primaryGroupDirty: propertyNotEqual('originalPrimaryGroupId', 'model.primary_group_id'),

  automaticGroups: function() {
    return this.get("model.automaticGroups").map((g) => g.name).join(", ");
  }.property("model.automaticGroups"),

  userFields: function() {
    const siteUserFields = this.site.get('user_fields'),
          userFields = this.get('model.user_fields');

    if (!Ember.isEmpty(siteUserFields)) {
      return siteUserFields.map(function(uf) {
        let value = userFields ? userFields[uf.get('id').toString()] : null;
        return { name: uf.get('name'), value: value };
      });
    }
    return [];
  }.property('model.user_fields.@each'),

  actions: {
    toggleTitleEdit() {
      this.toggleProperty('editingTitle');
    },

    saveTitle() {
      const self = this;

      return Discourse.ajax("/users/" + this.get('model.username').toLowerCase(), {
        data: {title: this.get('title')},
        type: 'PUT'
      }).catch(function(e) {
        bootbox.alert(I18n.t("generic_error_with_reason", {error: "http: " + e.status + " - " + e.body}));
      }).finally(function() {
        self.send('toggleTitleEdit');<commit_msg>missing model prefix for saving title<commit_after>import CanCheckEmails from 'discourse/mixins/can-check-emails';
import { propertyNotEqual, setting } from 'discourse/lib/computed';

export default Ember.Controller.extend(CanCheckEmails, {
  editingTitle: false,
  originalPrimaryGroupId: null,
  availableGroups: null,

  showApproval: setting('must_approve_users'),
  showBadges: setting('enable_badges'),

  primaryGroupDirty: propertyNotEqual('originalPrimaryGroupId', 'model.primary_group_id'),

  automaticGroups: function() {
    return this.get("model.automaticGroups").map((g) => g.name).join(", ");
  }.property("model.automaticGroups"),

  userFields: function() {
    const siteUserFields = this.site.get('user_fields'),
          userFields = this.get('model.user_fields');

    if (!Ember.isEmpty(siteUserFields)) {
      return siteUserFields.map(function(uf) {
        let value = userFields ? userFields[uf.get('id').toString()] : null;
        return { name: uf.get('name'), value: value };
      });
    }
    return [];
  }.property('model.user_fields.@each'),

  actions: {
    toggleTitleEdit() {
      this.toggleProperty('editingTitle');
    },

    saveTitle() {
      const self = this;

      return Discourse.ajax("/users/" + this.get('model.username').toLowerCase(), {
        data: {title: this.get('model.title')},
        type: 'PUT'
      }).catch(function(e) {
        bootbox.alert(I18n.t("generic_error_with_reason", {error: "http: " + e.status + " - " + e.body}));
      }).finally(function() {
        self.send('toggleTitleEdit');
{'fraction_non_alphanumeric': 0.1617363344051447, 'fraction_numerical': 0.0012861736334405145, 'mean_word_length': 3.838258164852255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4043702', 'n_tokens_mistral': 966, 'n_tokens_neox': 949, 'n_words': 158}