<commit_before>class window.UserActivitiesGroupView extends Backbone.Marionette.CompositeView
  template:
    text:
      """
      <div class="activity-group-user">
        <a href="{{ user_profile_url }}" rel="backbone">{{{ avatar }}}</a>
      </div>

      <div class="activity-group-link">
        <a href="{{ user_profile_url }}" rel="backbone">{{ username }}</a>
      </div>

      <div class="activity-group-activities js-region-activities"></div>

      <div class="activity-group-time">{{ time_ago }} ago</div>
      """

  className: 'activity-group'
  itemView: Backbone.View
  itemViewContainer: ".js-region-activities"

  @actions: ["added_first_factlink", "created_channel", "added_subchannel"]
  actions: -> UserActivitiesGroupView.actions

  @new: (options)->
    new (@classForModel(options.model))(options)

  @classForModel: (model) ->
    action = model.get("action")

    if action in UserFactActivitiesGroupView.actions
      UserFactActivitiesGroupView
    else
      UserActivitiesGroupView

  initialize: -> @collection = new Backbone.Collection [@model]

  sameUser: (model) -> @model.get('username') == model.get('username')

  appendable: (model) -> @sameUser(model) and model.get('action') in @actions()

  append: (model) ->
    return false unless @appendable(model)
    @collection.add model unless @lastView?.append(model)
    true

  buildItemView: (item, ItemView, options) ->
    #ignore ItemView
    NewItemView = window.getActivityItemViewFor(item)
    @lastView = super(item, NewItemView, options)

class UserFactActivitiesGroupView extends UserActivitiesGroupView
  @actions: ["added_fact_to_channel", "created_comment", "created_sub_comment", "added_supporting_evidence", "added_weakening_evidence", "believes", "doubts", "disbelieves"]
  actions: -> UserFactActivitiesGroupView.actions

  template:
    text: """
      <div class="activity-group-user">
        <a href="{{ user_profile_url }}" rel="backbone">{{{ avatar }}}</a>
      </div>

      <div class="activity-group-link">
        <a href="{{ user_profile_url }}" rel="backbone">{{ username }}</a>
      </div>

      <div class="activity-group-activities js-region-activities"></div>

      <div class="activity-group-time">{{ time_ago }} ago</div>
      
      <div class="activity-group-fact js-region-fact"></div>
    """

  onRender: ->
    @$('.js-region-fact').html @factView().render().el

  onClose: ->
    @factView().close()

  factView: -> @_factView ?= new FactView model: @fact()<commit_msg>Fixed "added first factlink" activity.<commit_after>class window.UserActivitiesGroupView extends Backbone.Marionette.CompositeView
  template:
    text:
      """
      <div class="activity-group-user">
        <a href="{{ user_profile_url }}" rel="backbone">{{{ avatar }}}</a>
      </div>

      <div class="activity-group-link">
        <a href="{{ user_profile_url }}" rel="backbone">{{ username }}</a>
      </div>

      <div class="activity-group-activities js-region-activities"></div>

      <div class="activity-group-time">{{ time_ago }} ago</div>
      """

  className: 'activity-group'
  itemView: Backbone.View
  itemViewContainer: ".js-region-activities"

  @actions: ["created_channel", "added_subchannel"]
  actions: -> UserActivitiesGroupView.actions

  @new: (options)->
    new (@classForModel(options.model))(options)

  @classForModel: (model) ->
    action = model.get("action")

    if action in UserFactActivitiesGroupView.actions
      UserFactActivitiesGroupView
    else
      UserActivitiesGroupView

  initialize: -> @collection = new Backbone.Collection [@model]

  sameUser: (model) -> @model.get('username') == model.get('username')

  appendable: (model) -> @sameUser(model) and model.get('action') in @actions()

  append: (model) ->
    return false unless @appendable(model)
    @collection.add model unless @lastView?.append(model)
    true

  buildItemView: (item, ItemView, options) ->
    #ignore ItemView
    NewItemView = window.getActivityItemViewFor(item)
    @lastView = super(item, NewItemView, options)

class UserFactActivitiesGroupView extends UserActivitiesGroupView
  @actions: ["added_first_factlink", "added_fact_to_channel", "created_comment", "created_sub_comment", "added_supporting_evidence", "added_weakening_evidence", "believes", "doubts", "disbelieves"]
  actions: -> UserFactActivitiesGroupView.actions

  template:
    text: """
      <div class="activity-group-user">
        <a href="{{ user_profile_url }}" rel="backbone">{{{ avatar }}}</a>
      </div>

      <div class="activity-group-link">
        <a href="{{ user_profile_url }}" rel="backbone">{{ username }}</a>
      </div>

      <div class="activity-group-activities js-region-activities"></div>

      <div class="activity-group-time">{{ time_ago }} ago</div>
      
      <div class="activity-group-fact js-region-fact"></div>
    """

  onRender: ->
    @$('.js-region-fact').html @factView().render().el

  onClose: ->
    @factView().close()

  factView: -> @_factView ?= new FactView model: @fact()
{'fraction_non_alphanumeric': 0.16207101765522713, 'fraction_numerical': 0.0, 'mean_word_length': 3.8667953667953667, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 79, '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': '2559676', 'n_tokens_mistral': 1604, 'n_tokens_neox': 1545, 'n_words': 309}