mirror of https://github.com/zulip/zulip.git
views: Move json_refer_friend to invite.py.
This commit is contained in:
parent
dd352dd456
commit
5b7dfafcac
|
@ -28,7 +28,7 @@ from zerver.lib.actions import do_change_password, do_change_full_name, do_chang
|
|||
update_user_presence, do_events_register, \
|
||||
do_change_enable_offline_email_notifications, \
|
||||
do_change_enable_digest_emails, do_change_tos_version, \
|
||||
user_email_is_unique, do_refer_friend, \
|
||||
user_email_is_unique, \
|
||||
compute_mit_user_fullname, do_set_muted_topics, clear_followup_emails_queue, \
|
||||
do_update_pointer, realm_user_count
|
||||
from zerver.lib.push_notifications import num_push_devices_for_user
|
||||
|
@ -694,20 +694,6 @@ def events_register_backend(request, user_profile, apply_markdown=True,
|
|||
narrow=narrow)
|
||||
return json_success(ret)
|
||||
|
||||
|
||||
@authenticated_json_post_view
|
||||
@has_request_variables
|
||||
def json_refer_friend(request, user_profile, email=REQ()):
|
||||
# type: (HttpRequest, UserProfile, str) -> HttpResponse
|
||||
if not email:
|
||||
return json_error(_("No email address specified"))
|
||||
if user_profile.invites_granted - user_profile.invites_used <= 0:
|
||||
return json_error(_("Insufficient invites"))
|
||||
|
||||
do_refer_friend(user_profile, email);
|
||||
|
||||
return json_success()
|
||||
|
||||
@authenticated_json_post_view
|
||||
@has_request_variables
|
||||
def json_set_muted_topics(request, user_profile,
|
||||
|
|
|
@ -8,7 +8,8 @@ from six import text_type
|
|||
from typing import Set
|
||||
|
||||
from zerver.decorator import authenticated_json_post_view
|
||||
from zerver.lib.actions import do_invite_users, get_default_subs, internal_send_message
|
||||
from zerver.lib.actions import do_invite_users, do_refer_friend, \
|
||||
get_default_subs, internal_send_message
|
||||
from zerver.lib.request import REQ, has_request_variables, JsonableError
|
||||
from zerver.lib.response import json_success, json_error
|
||||
from zerver.lib.validator import check_string, check_list
|
||||
|
@ -82,3 +83,16 @@ def json_bulk_invite_users(request, user_profile,
|
|||
user_profile.realm.domain, internal_message)
|
||||
return json_success()
|
||||
|
||||
@authenticated_json_post_view
|
||||
@has_request_variables
|
||||
def json_refer_friend(request, user_profile, email=REQ()):
|
||||
# type: (HttpRequest, UserProfile, str) -> HttpResponse
|
||||
if not email:
|
||||
return json_error(_("No email address specified"))
|
||||
if user_profile.invites_granted - user_profile.invites_used <= 0:
|
||||
return json_error(_("Insufficient invites"))
|
||||
|
||||
do_refer_friend(user_profile, email);
|
||||
|
||||
return json_success()
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ legacy_urls = [
|
|||
url(r'^json/make_stream_private$', 'zerver.views.streams.json_make_stream_private'),
|
||||
url(r'^json/invite_users$', 'zerver.views.invite.json_invite_users'),
|
||||
url(r'^json/bulk_invite_users$', 'zerver.views.invite.json_bulk_invite_users'),
|
||||
url(r'^json/refer_friend$', 'zerver.views.invite.json_refer_friend'),
|
||||
url(r'^json/settings/change$', 'zerver.views.user_settings.json_change_settings'),
|
||||
url(r'^json/notify_settings/change$', 'zerver.views.user_settings.json_change_notify_settings'),
|
||||
url(r'^json/ui_settings/change$', 'zerver.views.user_settings.json_change_ui_settings'),
|
||||
|
@ -26,7 +27,6 @@ legacy_urls = [
|
|||
url(r'^json/messages_in_narrow$', 'zerver.views.messages.json_messages_in_narrow'),
|
||||
url(r'^json/update_message$', 'zerver.views.messages.json_update_message'),
|
||||
url(r'^json/fetch_raw_message$', 'zerver.views.messages.json_fetch_raw_message'),
|
||||
url(r'^json/refer_friend$', 'zerver.views.json_refer_friend'),
|
||||
url(r'^json/set_muted_topics$', 'zerver.views.json_set_muted_topics'),
|
||||
url(r'^json/set_avatar$', 'zerver.views.user_settings.json_set_avatar'),
|
||||
url(r'^json/time_setting$', 'zerver.views.user_settings.json_time_setting'),
|
||||
|
|
Loading…
Reference in New Issue