mirror of https://github.com/zulip/zulip.git
invitations: Change error messages for resend/revoke views.
We don't have a concept of invitation ID on the frontend (or backend).
This commit is contained in:
parent
cb5eb47470
commit
100167fcf8
|
@ -959,7 +959,7 @@ class InvitationsTestCase(InviteUserBase):
|
|||
result = self.client_delete('/json/invites/' + str(prereg_user.id))
|
||||
self.assertEqual(result.status_code, 200)
|
||||
error_result = self.client_delete('/json/invites/' + str(prereg_user.id))
|
||||
self.assert_json_error(error_result, "Invalid invitation ID.")
|
||||
self.assert_json_error(error_result, "No such invitation")
|
||||
|
||||
self.assertRaises(ScheduledEmail.DoesNotExist,
|
||||
lambda: ScheduledEmail.objects.get(address__iexact=invitee,
|
||||
|
@ -999,7 +999,7 @@ class InvitationsTestCase(InviteUserBase):
|
|||
|
||||
self.assertEqual(result.status_code, 200)
|
||||
error_result = self.client_post('/json/invites/' + str(9999) + '/resend')
|
||||
self.assert_json_error(error_result, "Invalid invitation ID.")
|
||||
self.assert_json_error(error_result, "No such invitation")
|
||||
|
||||
self.check_sent_emails([invitee], custom_from_name="Zulip")
|
||||
|
||||
|
@ -1009,9 +1009,9 @@ class InvitationsTestCase(InviteUserBase):
|
|||
email='email', referred_by=invitor, realm=invitor.realm)
|
||||
self.login(self.example_email("iago"))
|
||||
error_result = self.client_post('/json/invites/' + str(prereg_user.id) + '/resend')
|
||||
self.assert_json_error(error_result, "Invalid invitation ID.")
|
||||
self.assert_json_error(error_result, "No such invitation")
|
||||
error_result = self.client_delete('/json/invites/' + str(prereg_user.id))
|
||||
self.assert_json_error(error_result, "Invalid invitation ID.")
|
||||
self.assert_json_error(error_result, "No such invitation")
|
||||
|
||||
class InviteeEmailsParserTests(TestCase):
|
||||
def setUp(self) -> None:
|
||||
|
|
|
@ -77,10 +77,10 @@ def revoke_user_invite(request: HttpRequest, user_profile: UserProfile,
|
|||
try:
|
||||
prereg_user = PreregistrationUser.objects.get(id=prereg_id)
|
||||
except PreregistrationUser.DoesNotExist:
|
||||
raise JsonableError(_("Invalid invitation ID."))
|
||||
raise JsonableError(_("No such invitation"))
|
||||
|
||||
if prereg_user.referred_by.realm != user_profile.realm:
|
||||
raise JsonableError(_("Invalid invitation ID."))
|
||||
raise JsonableError(_("No such invitation"))
|
||||
|
||||
do_revoke_user_invite(prereg_user)
|
||||
return json_success()
|
||||
|
@ -92,10 +92,10 @@ def resend_user_invite_email(request: HttpRequest, user_profile: UserProfile,
|
|||
try:
|
||||
prereg_user = PreregistrationUser.objects.get(id=prereg_id)
|
||||
except PreregistrationUser.DoesNotExist:
|
||||
raise JsonableError(_("Invalid invitation ID."))
|
||||
raise JsonableError(_("No such invitation"))
|
||||
|
||||
if (prereg_user.referred_by.realm != user_profile.realm):
|
||||
raise JsonableError(_("Invalid invitation ID."))
|
||||
raise JsonableError(_("No such invitation"))
|
||||
|
||||
timestamp = do_resend_user_invite_email(prereg_user)
|
||||
return json_success({'timestamp': timestamp})
|
||||
|
|
Loading…
Reference in New Issue