(request, invitation, web_user, is_new_user=False)
Processes the Invitation (if available) and sets up the user in the
        new domain they were invited to.
        :param request: HttpRequest
        :param invitation: Invitation or None
        :param web_user: WebUser
Processes the Invitation (if available) and sets up the user in the
        new domain they were invited to.
        :param request: HttpRequest
        :param invitation: Invitation or None
        :param web_user: WebUser
Processes the Invitation ( if available ) and sets up the user in the new domain they were invited to . : param request : HttpRequest : param invitation : Invitation or None : param web_user : WebUser
def _process_invitation(request, invitation, web_user, is_new_user=False):
        """
        Processes the Invitation (if available) and sets up the user in the
        new domain they were invited to.
        :param request: HttpRequest
        :param invitation: Invitation or None
        :param web_user: WebUser
        """
        if invitation.is_expired:
            request.sso_new_user_messages['error'].append(
                _("Could not accept invitation because it is expired.")
            )
            return

        invitation.accept_invitation_and_join_domain(web_user)
        request.sso_new_user_messages['success'].append(
            _('You have been added to the "{}" project space.').format(
                invitation.domain,
            )
        )

        if settings.IS_SAAS_ENVIRONMENT and is_new_user:
            track_workflow(
                web_user.username,
                "New User Accepted a project invitation with SSO",
                {"New User Accepted a project invitation": "yes"}
            )
            send_hubspot_form(
                HUBSPOT_NEW_USER_INVITE_FORM,
                request,
                user=web_user
            )
def _process_invitation ( request , invitation , web_user , is_new_user = False ) : if invitation . is_expired : request . sso_new_user_messages [ 'error' ] . append ( _ ( "Could not accept invitation because it is expired." ) ) return invitation . accept_invitation_and_join_domain ( web_user ) request . sso_new_user_messages [ 'success' ] . append ( _ ( 'You have been added to the "{}" project space.' ) . format ( invitation . domain , ) ) if settings . IS_SAAS_ENVIRONMENT and is_new_user : track_workflow ( web_user . username , "New User Accepted a project invitation with SSO" , { "New User Accepted a project invitation" : "yes" } ) send_hubspot_form ( HUBSPOT_NEW_USER_INVITE_FORM , request , user = web_user )