2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
module AcceptsPendingInvitations
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
def accept_pending_invitations(user: resource)
|
|
|
|
return unless user.active_for_authentication?
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
if user.pending_invitations.load.any?
|
|
|
|
user.accept_pending_invitations!
|
2021-06-08 01:23:25 +05:30
|
|
|
after_pending_invitations_hook
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def after_pending_invitations_hook
|
|
|
|
# no-op
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
end
|