<commit_before>_ = require 'underscore'
{ CURRENT_USER } = require('sharify').data
Backbone = require 'backbone'
analytics = require '../../lib/analytics.coffee'
SearchBarView = require '../search_bar/view.coffee'
Following = require '../follow_button/collection.coffee'
UserInterests = require '../../collections/user_interests.coffee'
template = -> require('./templates/index.jade') arguments...
collectionTemplate = -> require('./templates/collection.jade') arguments...

module.exports = class UserInterestsView extends Backbone.View
  template: ->
    template arguments...
  collectionTemplate: ->
    collectionTemplate arguments...

  events:
    'click .js-user-interest-remove': 'uninterested'

  defaults:
    persist: true
    mode: 'post'

  initialize: (options = {}) ->
    { @limit,
      @autofocus,
      @mode,
      @persist,
      @collectorProfile } = _.defaults options, @defaults

    @collection = new UserInterests [], collectorProfile: @collectorProfile
    @following = new Following [], kind: 'artist'

    @listenTo @collection, 'sync add remove', @renderCollection

  interested: (e, model) ->
    userInterest = @collection.addInterest model
    if @persist
      options = @collectorProfile.pick('anonymous_session_id') if @collectorProfile?
      userInterest.save options or {}

    if @persist and CURRENT_USER?<commit_msg>Allow collection to be configured<commit_after>_ = require 'underscore'
{ CURRENT_USER } = require('sharify').data
Backbone = require 'backbone'
analytics = require '../../lib/analytics.coffee'
SearchBarView = require '../search_bar/view.coffee'
Following = require '../follow_button/collection.coffee'
UserInterests = require '../../collections/user_interests.coffee'
template = -> require('./templates/index.jade') arguments...
collectionTemplate = -> require('./templates/collection.jade') arguments...

module.exports = class UserInterestsView extends Backbone.View
  template: ->
    template arguments...
  collectionTemplate: ->
    collectionTemplate arguments...

  events:
    'click .js-user-interest-remove': 'uninterested'

  defaults:
    persist: true
    mode: 'post'

  initialize: (options = {}) ->
    { @limit,
      @autofocus,
      @mode,
      @persist,
      @collectorProfile } = _.defaults options, @defaults

    @collection ?= new UserInterests [], collectorProfile: @collectorProfile
    @following = new Following [], kind: 'artist'

    @listenTo @collection, 'sync add remove', @renderCollection

  interested: (e, model) ->
    userInterest = @collection.addInterest model
    if @persist
      options = @collectorProfile.pick('anonymous_session_id') if @collectorProfile?
      userInterest.save options or {}

    if @persist and CURRENT_USER?
{'fraction_non_alphanumeric': 0.13326031398320554, 'fraction_numerical': 0.0, 'mean_word_length': 3.7322970639032813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '508744', 'n_tokens_mistral': 796, 'n_tokens_neox': 759, 'n_words': 185}