<commit_before>App.actions = {
  listItem: {
    update: function(itemData, newItemData) {
      var payload = {
        itemData: itemData,
        newItemData: newItemData
      };

      this.dispatch(App.constants.ITEM_UPDATE, payload);
      App.updateItem(
        payload,
        function(data) {
          this.dispatch(App.constants.ITEM_UPDATE_SUCCESS, data);
        }.bind(this),
        function(payload) {
          this.dispatch(App.constants.ITEM_UPDATE_FAILURE, payload);
        }.bind(this)
      );
    },

    add: function(newItemData) {
      var listID = this.flux.store("ListStore").getID();
      var listItemID = App.makeId();
      var itemData = {
        title: newItemData.title,
        link: newItemData.amazon_url,
        image_url: newItemData.thumbnail_url,
        list_id: listID,
        rank: 0,
        listItemID: listItemID
      };

      this.dispatch(App.constants.ITEM_ADD, itemData);
      App.saveItem(
        itemData,
        function(savedItem) {
          this.dispatch(App.constants.ITEM_ADD_SUCCESS, savedItem);
        }.bind(this),
        function(error) {
          this.dispatch(App.constants.ITEM_ADD_FAILURE, error);
        }.bind(this)
      );
    },

    delete: function(itemId) {
      App.deleteItem(
        itemId,
        function(itemId) {
          this.dispatch(App.constants.ITEM_DELETE, itemId);
        }.bind(this)
      );
    }
  },
  list: {
    update: function(listData) {
      this.dispatch(App.constants.LIST_UPDATE, listData.newData);

      listData.newData.listId = this.flux.store("ListStore").getID();
      listData.newData.public = listData.newData.isPublic;
      App.updateList(
        listData.newData,
        function(data) {
          this.dispatch(App.constants.LIST_UPDATE_SUCCESS, data);
        }.bind(this),
        function(error) {
          listData.error = error;
          this.dispatch(App.constants.LIST_UPDATE_FAILURE, listData);
        }.bind(this)
      );
    },
  }
};<commit_msg>Add update and remove tag actions.<commit_after>App.actions = {
  listItem: {
    update: function(itemData, newItemData) {
      var payload = {
        itemData: itemData,
        newItemData: newItemData
      };

      this.dispatch(App.constants.ITEM_UPDATE, payload);
      App.updateItem(
        payload,
        function(data) {
          this.dispatch(App.constants.ITEM_UPDATE_SUCCESS, data);
        }.bind(this),
        function(payload) {
          this.dispatch(App.constants.ITEM_UPDATE_FAILURE, payload);
        }.bind(this)
      );
    },

    add: function(newItemData) {
      var listID = this.flux.store("ListStore").getID();
      var listItemID = App.makeId();
      var itemData = {
        title: newItemData.title,
        link: newItemData.amazon_url,
        image_url: newItemData.thumbnail_url,
        list_id: listID,
        rank: 0,
        listItemID: listItemID
      };

      this.dispatch(App.constants.ITEM_ADD, itemData);
      App.saveItem(
        itemData,
        function(savedItem) {
          this.dispatch(App.constants.ITEM_ADD_SUCCESS, savedItem);
        }.bind(this),
        function(error) {
          this.dispatch(App.constants.ITEM_ADD_FAILURE, error);
        }.bind(this)
      );
    },

    delete: function(itemId) {
      App.deleteItem(
        itemId,
        function(itemId) {
          this.dispatch(App.constants.ITEM_DELETE, itemId);
        }.bind(this)
      );
    }
  },
  list: {
    update: function(listData) {
      // console.log('Action: list::update()', listData);
      this.dispatch(App.constants.LIST_UPDATE, listData.newData);
      listData.newData.listId = this.flux.store("ListStore").getID();
      App.updateList(
        listData.newData,
        function(data) {
          this.dispatch(App.constants.LIST_UPDATE_SUCCESS, data);
        }.bind(this),
        function(error) {
          listData.error = error;
          this.dispatch(App.constants.LIST_UPDATE_FAILURE, listData);
        }.bind(this)
      );
    },

    updateTags: function(newTagData) {
      this.dispatch(App.constants.LIST_TAGS_UPDATE);
      App.updateTags(
        newTagData,
        function(data) {
          this.dispatch(App.constants.LIST_UPDATE_SUCCESS, data);
        }.bind(this),
        function(error) {
          this.dispatch(App.constants.LIST_TAGS_UPDATE_FAILURE);
        }.bind(this)
      );
    },

    removeTag: function(tagToRemove) {
      // console.log('delete', tagToRemove);
      this.dispatch(App.constants.LIST_TAG_REMOVE);
      App.removeTag(
        tagToRemove,
        function(data) {
          // console.log('remove success', data);
          this.dispatch(App.constants.LIST_TAG_REMOVE_SUCCESS, data);
        }.bind(this),
        function(error) {
          // console.log('error remove', error);
          this.dispatch(App.constants.LIST_TAG_REMOVE_FAILURE);
        }.bind(this)
      );
    }
  }
};
{'fraction_non_alphanumeric': 0.12540650406504064, 'fraction_numerical': 0.0004065040650406504, 'mean_word_length': 2.187176165803109, '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': '3614671', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1521, 'n_words': 210}