[schema] Add a bit for whether inactive users are mirror dummies.

(imported from commit bb21bb2c62ac09742484d7a4ca8907e7d864b982)
This commit is contained in:
Tim Abbott
2014-01-07 12:57:54 -05:00
parent 8e3911269e
commit 47500d8352
5 changed files with 265 additions and 6 deletions

View File

@@ -20,13 +20,15 @@ def random_api_key():
# Only use this for bulk_create -- for normal usage one should use
# create_user (below) which will also make the Subscription and
# Recipient objects
def create_user_profile(realm, email, password, active, bot, full_name, short_name, bot_owner):
def create_user_profile(realm, email, password, active, bot, full_name,
short_name, bot_owner, is_mirror_dummy):
now = timezone.now()
email = UserManager.normalize_email(email)
user_profile = UserProfile(email=email, is_staff=False, is_active=active,
full_name=full_name, short_name=short_name,
last_login=now, date_joined=now, realm=realm,
pointer=-1, is_bot=bot, bot_owner=bot_owner,
is_mirror_dummy=is_mirror_dummy,
onboarding_steps=ujson.dumps([]))
if bot or not active:
@@ -39,9 +41,11 @@ def create_user_profile(realm, email, password, active, bot, full_name, short_na
def create_user(email, password, realm, full_name, short_name,
active=True, bot=False, bot_owner=None,
avatar_source=UserProfile.AVATAR_FROM_GRAVATAR):
avatar_source=UserProfile.AVATAR_FROM_GRAVATAR,
is_mirror_dummy=False):
user_profile = create_user_profile(realm, email, password, active, bot,
full_name, short_name, bot_owner)
full_name, short_name, bot_owner,
is_mirror_dummy)
user_profile.avatar_source = avatar_source
user_profile.save()
recipient = Recipient.objects.create(type_id=user_profile.id,