(
        self,
    )
return None
If there is a valid trial or subscription, we should return None. Otherwise we should return the reason for the block.

        Note to future self: We do not need a "subscription_missing" state
        because a user missing a subscription is equivalent to have 0 seats.
        Once they exceed 0 active users they will hit the "seats_exceeded"
        state.
If there is a valid trial or subscription, we should return None. Otherwise we should return the reason for the block.
If there is a valid trial or subscription we should return None . Otherwise we should return the reason for the block .
def get_subscription_blocker(
        self,
    ) -> Optional[Union[SubscriptionExpired, TrialExpired, SeatsExceeded]]:
        """
        If there is a valid trial or subscription, we should return None. Otherwise we should return the reason for the block.

        Note to future self: We do not need a "subscription_missing" state
        because a user missing a subscription is equivalent to have 0 seats.
        Once they exceed 0 active users they will hit the "seats_exceeded"
        state.
        """
        if not self.can_subscribe():
            return None

        if self.active_trial():
            return None

        customer_info = self.stripe_customer_info()

        subscription_quantity = (
            customer_info.subscription_quantity if customer_info else 0
        )
        active_users = UserPullRequestActivity.get_active_users_in_last_30_days(
            account=self
        )
        if subscription_quantity < len(active_users):
            allowed_user_ids = [
                user.github_id for user in active_users[:subscription_quantity]
            ]
            return SeatsExceeded(allowed_user_ids=allowed_user_ids)

        if customer_info:
            if customer_info.expired:
                return SubscriptionExpired()
            # active subscription within active user limits.
            return None

        if self.trial_expired():
            return TrialExpired()

        # the user has never signed up for a trial or subscription and has 0
        # active users.
        return None
def get_subscription_blocker ( self , ) -> Optional [ Union [ SubscriptionExpired , TrialExpired , SeatsExceeded ] ] : if not self . can_subscribe ( ) : return None if self . active_trial ( ) : return None customer_info = self . stripe_customer_info ( ) subscription_quantity = ( customer_info . subscription_quantity if customer_info else 0 ) active_users = UserPullRequestActivity . get_active_users_in_last_30_days ( account = self ) if subscription_quantity < len ( active_users ) : allowed_user_ids = [ user . github_id for user in active_users [ : subscription_quantity ] ] return SeatsExceeded ( allowed_user_ids = allowed_user_ids ) if customer_info : if customer_info . expired : return SubscriptionExpired ( ) # active subscription within active user limits. return None if self . trial_expired ( ) : return TrialExpired ( ) # the user has never signed up for a trial or subscription and has 0 # active users. return None