<commit_before>class window.ActivityItemView extends Backbone.Marionette.ItemView
  template: "activities/generic_activity"
  tryAppend: (model) -> false

  @classForModel: (model) ->
    switch model.get("action")
      when "added_supporting_evidence", "added_weakening_evidence"
        AddedEvidenceView
      when "created_comment", "created_sub_comment"
        CreatedCommentView
      when "created_channel"
        CreatedChannelView
      when "added_subchannel"
        AddedSubchannelView
      when "believes", "doubts", "disbelieves"
        AddedOpinionView
      when "added_fact_to_channel" # TODO: rename actual activity to added_fact_to_topic
        AddedFactToTopicGroupView
      when 'followed_user'
        FollowedUserView
      when "added_first_factlink"
        AddedFirstFactlinkView
      else
        ActivityItemView

class CreatedChannelView extends ActivityItemView
  template: "activities/created_channel"

class AddedSubchannelView extends ActivityItemView
  template: "activities/added_subchannel"

class AddedEvidenceView extends ActivityItemView
  template: "activities/added_evidence"

class CreatedCommentView extends ActivityItemView
  template: "activities/created_comment"

class AddedOpinionView extends ActivityItemView
  template: "activities/added_opinion"

class FollowedUserView extends ActivityItemView
  tagName: 'span'
  className: 'separator-list-item'
  template: "activities/followed_user"
  templateHelpers: =>
    followed_user: new User(@model.get('activity').followed_user).toJSON()

class AddedFirstFactlinkView extends ActivityItemView
  template: "activities/added_first_factlink"

class AddedFactToTopicView extends ActivityItemView
  _.extend @prototype, Backbone.Factlink.PopoverMixin

  tagName: 'span'
  className: 'separator-list-item'
  template: 'activities/added_fact_to_topic'

  templateHelpers: ->
    topic: @topic().toJSON()

  onRender: ->
    Backbone.Factlink.makeTooltipForView @,
      positioning:
        align: 'left'
        side: 'bottom'
      selector: '.js-link'
      $offsetParent: @options.$offsetParent
      tooltipViewFactory: =>
        new TopicPopoverContentView model: @topic()

  topic: -> @_topic ?= new Topic(@model.get('activity').topic)

class AddedFactToTopicGroupView extends ActivitiesGroupView
  template: 'activities/added_fact_to_topic_group'
  className: ''
  itemView: AddedFactToTopicView
  itemViewContainer: '.js-region-channels'

  itemViewOptions: ->
    $offsetParent: @options.$offsetParent

  actions: -> ["added_fact_to_channel"]

  initialEvents: -><commit_msg>Don't show topic popover<commit_after>class window.ActivityItemView extends Backbone.Marionette.ItemView
  template: "activities/generic_activity"
  tryAppend: (model) -> false

  @classForModel: (model) ->
    switch model.get("action")
      when "added_supporting_evidence", "added_weakening_evidence"
        AddedEvidenceView
      when "created_comment", "created_sub_comment"
        CreatedCommentView
      when "created_channel"
        CreatedChannelView
      when "added_subchannel"
        AddedSubchannelView
      when "believes", "doubts", "disbelieves"
        AddedOpinionView
      when "added_fact_to_channel" # TODO: rename actual activity to added_fact_to_topic
        AddedFactToTopicGroupView
      when 'followed_user'
        FollowedUserView
      when "added_first_factlink"
        AddedFirstFactlinkView
      else
        ActivityItemView

class CreatedChannelView extends ActivityItemView
  template: "activities/created_channel"

class AddedSubchannelView extends ActivityItemView
  template: "activities/added_subchannel"

class AddedEvidenceView extends ActivityItemView
  template: "activities/added_evidence"

class CreatedCommentView extends ActivityItemView
  template: "activities/created_comment"

class AddedOpinionView extends ActivityItemView
  template: "activities/added_opinion"

class FollowedUserView extends ActivityItemView
  tagName: 'span'
  className: 'separator-list-item'
  template: "activities/followed_user"
  templateHelpers: =>
    followed_user: new User(@model.get('activity').followed_user).toJSON()

class AddedFirstFactlinkView extends ActivityItemView
  template: "activities/added_first_factlink"

class AddedFactToTopicView extends ActivityItemView
  _.extend @prototype, Backbone.Factlink.PopoverMixin

  tagName: 'span'
  className: 'separator-list-item'
  template: 'activities/added_fact_to_topic'

  templateHelpers: ->
    topic: @topic().toJSON()

  onRender: ->
    # Backbone.Factlink.makeTooltipForView @,
    #   positioning:
    #     align: 'left'
    #     side: 'bottom'
    #   selector: '.js-link'
    #   $offsetParent: @options.$offsetParent
    #   tooltipViewFactory: =>
    #     new TopicPopoverContentView model: @topic()

  topic: -> @_topic ?= new Topic(@model.get('activity').topic)

class AddedFactToTopicGroupView extends ActivitiesGroupView
  template: 'activities/added_fact_to_topic_group'
  className: ''
  itemView: AddedFactToTopicView
  itemViewContainer: '.js-region-channels'

  itemViewOptions: ->
    $offsetParent: @options.$offsetParent

  actions: -> ["added_fact_to_channel"]

  initialEvents: ->
{'fraction_non_alphanumeric': 0.08373435996150144, 'fraction_numerical': 0.0, 'mean_word_length': 4.4125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '135910', 'n_tokens_mistral': 1552, 'n_tokens_neox': 1484, 'n_words': 307}