mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
users: Move check_change_full_name to actions.py.
This avoids an import loop in the next commit, and better matches our usual code structure.
This commit is contained in:
@@ -2,7 +2,6 @@ from typing import List, Text
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from zerver.lib.actions import do_change_full_name
|
||||
from zerver.lib.request import JsonableError
|
||||
from zerver.models import UserProfile, Service, Realm, \
|
||||
get_user_profile_by_id
|
||||
@@ -25,16 +24,6 @@ def check_short_name(short_name_raw):
|
||||
raise JsonableError(_("Bad name or username"))
|
||||
return short_name
|
||||
|
||||
def check_change_full_name(user_profile, full_name_raw, acting_user):
|
||||
# type: (UserProfile, Text, UserProfile) -> Text
|
||||
"""Verifies that the user's proposed full name is valid. The caller
|
||||
is responsible for checking check permissions. Returns the new
|
||||
full name, which may differ from what was passed in (because this
|
||||
function strips whitespace)."""
|
||||
new_full_name = check_full_name(full_name_raw)
|
||||
do_change_full_name(user_profile, new_full_name, acting_user)
|
||||
return new_full_name
|
||||
|
||||
def check_valid_bot_type(bot_type):
|
||||
# type: (int) -> None
|
||||
if bot_type not in UserProfile.ALLOWED_BOT_TYPES:
|
||||
|
||||
Reference in New Issue
Block a user