Welcome to mirror list, hosted at ThFree Co, Russian Federation.

accepts_pending_invitations.rb « concerns « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5601b7a7f797411faba69a470d03d930610f4735 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module AcceptsPendingInvitations
  extend ActiveSupport::Concern

  def accept_pending_invitations
    return unless resource.active_for_authentication?

    if resource.pending_invitations.load.any?
      resource.accept_pending_invitations!
      clear_stored_location_for_resource
      after_pending_invitations_hook
    end
  end

  def after_pending_invitations_hook
    # no-op
  end

  def clear_stored_location_for_resource
    session_key = stored_location_key_for(resource)

    session.delete(session_key)
  end
end