-angular.module('loomioApp').controller 'GroupPageController', ($rootScope, $location, $routeParams, Records, CurrentUser, MessageChannelService, AbilityService, AppConfig, LmoUrlService, PaginationService, ModalService, SubscriptionSuccessModal, GroupWelcomeModal, LegacyTrialExpiredModal) ->
+angular.module('loomioApp').controller 'GroupPageController', ($rootScope, $location, $routeParams, Records, CurrentUser, MessageChannelService, AbilityService, AppConfig, LmoUrlService, PaginationService, ModalService, SubscriptionSuccessModal, GroupWelcomeModal) ->
   $rootScope.$broadcast 'currentComponent', {page: 'groupPage'}
 
   # allow for chargify reference, which comes back #{groupKey}|#{timestamp}

    @group.isParent() and
    AbilityService.isCreatorOf(@group) and
    @group.noInvitationsSent() and
    !@group.trialIsOverdue() and
    !@subscriptionSuccess and
    !GroupWelcomeModal.shownToGroup[@group.id]

  @handleWelcomeModal = =>
    if @showWelcomeModel()
      GroupWelcomeModal.shownToGroup[@group.id] = true
    #  ModalService.open GroupWelcomeModal

  return

    @group = group

    if AbilityService.isLoggedIn()
      MessageChannelService.subscribeToGroup(@group)
      Records.drafts.fetchFor(@group)
      @handleSubscriptionSuccess()
      @handleWelcomeModal()

    @pageWindow = PaginationService.windowFor
      current:  parseInt($location.search().from or 0)
