 class window.ActivitiesGroupView extends Backbone.Marionette.CompositeView
+  className: 'activity-group'
+  itemView: Backbone.View
+  itemViewContainer: ".js-region-activities"
+
   @new: (options)->
     new (@classForModel(options.model))(options)
 


  fact: -> new Fact @model.get("activity").fact

  sameFact: (model) ->
    @model.get('activity').fact?.id == model.get('activity').fact?.id

  appendable: (model) -> super(model) and @sameFact(model)

  isOpinion: (activity) ->
    activity.get('action') in ['believes', 'disbelieves', 'doubts']

  isAddedArgument: (activity) ->
    activity.get('action') == "created_comment"

  activityMadeRedundantBy: (newActivity, oldActivity) ->
    @isOpinion(oldActivity) && @isOpinion(newActivity) ||
      @isAddedArgument(oldActivity) && @isAddedArgument(newActivity)

class UsersFollowedGroupView extends UserActivitiesGroupView
  template: 'activities/users_followed_group'

  @actions: ["followed_user"]
  actions: -> UsersFollowedGroupView.actions

  activityMadeRedundantBy: (newActivity, oldActivity) ->
    newActivity.get('activity').followed_user.username ==
      oldActivity.get('activity').followed_user.username

      if action in group_view.actions
        return group_view

    return ActivitiesGroupView

  templateHelpers: ->
    user: @user?.toJSON()
