<commit_before>import Ember from 'ember';
import EmberValidations from 'ember-validations';
import BufferedProxy from 'ember-buffered-proxy/proxy';

export default BufferedProxy.extend(EmberValidations.Mixin, Ember.Evented, {
  apiErrors: Ember.computed.oneWay('content.errors'),

  init: function() {
    this._super();
    this.get('content').on('becameInvalid', 'didCommit', () => {
      this.get('apiErrorBlacklist').clear();
    });
  },

  apiErrorBlacklist: Ember.computed(function() {
    return Ember.A();
  }),

  setUnknownProperty: function(key, value) {
    this._super(key, value);
    this.trigger('didSetFormProperty', key, value);
  },

  formPropertySet: Ember.on('didSetFormProperty', function(key) {
    if (this.get(key) !== this.get(`content.${key}`)) {
      this.get('apiErrorBlacklist').pushObject(key);
    }
  }),

  displayErrors: Ember.computed('validators.@each.isValid', 'apiErrors.[]', 'apiErrorBlacklist.[]', function() {
    var displayErrors = Ember.A(Ember.keys(this.get('errors')).map((key) =>
      `${key}: ${this.get(`errors.${key}`).join(', ')}`
    ));
    this.get('apiErrors').forEach((apiError) => {
      if (!this.get('apiErrorBlacklist').contains(apiError.attribute)) {
        displayErrors.push(apiError.message);
      }
    });
    return displayErrors;
  })
});<commit_msg>fixed filtering of validation errors<commit_after>import Ember from 'ember';
import EmberValidations from 'ember-validations';
import BufferedProxy from 'ember-buffered-proxy/proxy';

export default BufferedProxy.extend(EmberValidations.Mixin, Ember.Evented, {
  apiErrors: Ember.computed.oneWay('content.errors'),

  init: function() {
    this._super();
    this.get('content').on('becameInvalid', 'didCommit', () => {
      this.get('apiErrorBlacklist').clear();
    });
  },

  apiErrorBlacklist: Ember.computed(function() {
    return Ember.A();
  }),

  setUnknownProperty: function(key, value) {
    this._super(key, value);
    this.trigger('didSetFormProperty', key, value);
  },

  formPropertySet: Ember.on('didSetFormProperty', function(key) {
    if (this.get(key) !== this.get(`content.${key}`)) {
      this.get('apiErrorBlacklist').pushObject(key);
    }
  }),

  displayErrors: Ember.computed('validators.@each.isValid', 'apiErrors.[]', 'apiErrorBlacklist.[]', function() {
		var errorKeys = Ember.keys(this.get('errors')).filter((key) => {
			return Ember.isPresent(this.get(`errors.${key}`));
		});
    var displayErrors = Ember.A(errorKeys.map((key) =>
      `${key}: ${this.get(`errors.${key}`).join(', ')}`
    ));
    this.get('apiErrors').forEach((apiError) => {
      if (!this.get('apiErrorBlacklist').contains(apiError.attribute)) {
        displayErrors.push(apiError.message);
      }
    });
    return displayErrors;
  })
});
{'fraction_non_alphanumeric': 0.19044196909809558, 'fraction_numerical': 0.0, 'mean_word_length': 4.343570057581574, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4398700', 'n_tokens_mistral': 913, 'n_tokens_neox': 906, 'n_words': 127}