<commit_before>'use strict';

app.directive('partyEditProfileForm', [
  'pageService', function (page) {
    var link = function ($scope) {
      var party = $scope.party;
      var form = $scope.partyEditProfileForm;

      var fields = ['prename', 'sortname', 'affiliation', 'orcid', 'url'];

      function init() {
        form.data = {};
        fields.forEach(function (f) {
          form.data[f] = party[f];
        });
      }
      init();
      form.avatarUrl = party.avatarRoute();

      form.save = function () {
        page.messages.clear(form);
        form.$setSubmitted();
        var fd, upload;
        if (angular.isObject(form.data.avatar)) {
          fd = new FormData();

          fd.append('avatar', form.data.avatar[0]);

          for (var prop in form.data)
            if (form.data.hasOwnProperty(prop) && form.data[prop] !== undefined)
              fd.append(prop, form.data[prop]);

          upload = page.messages.add({
            type: 'yellow',
            body: page.constants.message('party.edit.avatar.upload', page.constants.message('avatar')),
            owner: form
          });
        } else
          fd = form.data;

        party.save(fd)
          .then(function () {
            form.validator.server({});
            page.messages.add({
              type: 'green',
              body: page.constants.message('party.edit.profile.success'),
              owner: form
            });
<commit_msg>Add note about avatar caching<commit_after>'use strict';

app.directive('partyEditProfileForm', [
  'pageService', function (page) {
    var link = function ($scope) {
      var party = $scope.party;
      var form = $scope.partyEditProfileForm;

      var fields = ['prename', 'sortname', 'affiliation', 'orcid', 'url'];

      function init() {
        form.data = {};
        fields.forEach(function (f) {
          form.data[f] = party[f];
        });
      }
      init();
      form.avatarUrl = party.avatarRoute();

      form.save = function () {
        page.messages.clear(form);
        form.$setSubmitted();
        var fd, upload;
        if (angular.isObject(form.data.avatar)) {
          fd = new FormData();

          fd.append('avatar', form.data.avatar[0]);

          for (var prop in form.data)
            if (form.data.hasOwnProperty(prop) && form.data[prop] !== undefined)
              fd.append(prop, form.data[prop]);

          upload = page.messages.add({
            type: 'yellow',
            body: page.constants.message('party.edit.avatar.upload', page.constants.message('avatar')),
            owner: form
          });
        } else
          fd = form.data;

        party.save(fd)
          .then(function () {
            form.validator.server({});
            page.messages.add({
              type: 'green',
              body: page.constants.message('party.edit.profile.success') + ('avatar' in form.data ? ' Your avatar will take some time to update.' : ''),
              owner: form
            });

{'fraction_non_alphanumeric': 0.15115115115115116, 'fraction_numerical': 0.000667334000667334, 'mean_word_length': 1.8854667949951878, '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': '4407018', 'n_tokens_mistral': 869, 'n_tokens_neox': 859, 'n_words': 175}