mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 04:23:46 +00:00
invitations: Add check for invite limit to resend invite pathway.
This commit is contained in:
@@ -3935,8 +3935,8 @@ def check_invite_limit(user: UserProfile, num_invitees: int) -> None:
|
||||
type=Confirmation.INVITATION).count()
|
||||
if num_invitees + sent_invites > user.realm.max_invites:
|
||||
raise InvitationError(
|
||||
_("You do not have enough remaining invites; "
|
||||
"try again with fewer emails, or contact %s. "
|
||||
_("You do not have enough remaining invites. "
|
||||
"Please contact %s to have your limit raised. "
|
||||
"No invitations were sent." % (settings.ZULIP_ADMINISTRATOR)),
|
||||
[], sent_invitations=False)
|
||||
|
||||
@@ -4041,6 +4041,8 @@ def do_resend_user_invite_email(invite_id: int, realm_id: int) -> str:
|
||||
if (prereg_user.referred_by.realm_id != realm_id):
|
||||
raise JsonableError(_("Invalid invitation ID."))
|
||||
|
||||
check_invite_limit(prereg_user.referred_by, 1)
|
||||
|
||||
prereg_user.invited_at = timezone_now()
|
||||
prereg_user.save()
|
||||
|
||||
|
||||
@@ -680,8 +680,8 @@ earl-test@zulip.com""", ["Denmark"]))
|
||||
[str(i) for i in range(get_realm("zulip").max_invites - 1)]),
|
||||
"stream": ["Denmark"],
|
||||
"custom_body": ''}),
|
||||
"You do not have enough remaining invites; "
|
||||
"try again with fewer emails, or contact zulip-admin@example.com. "
|
||||
"You do not have enough remaining invites. "
|
||||
"Please contact zulip-admin@example.com to have your limit raised. "
|
||||
"No invitations were sent.")
|
||||
|
||||
def test_missing_or_invalid_params(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user