Add API support for setting defaults in the add bot API

Support setting default_to_stream, default_events_register_stream, and
default_all_public_streams during in the bot creation API.

(imported from commit bef484dd8be9f8aacd65a959594075aea8bdf271)
This commit is contained in:
Jason Michalski
2014-02-11 12:43:30 -05:00
parent f3180b774b
commit 50db83508b
4 changed files with 163 additions and 12 deletions

View File

@@ -42,11 +42,20 @@ def create_user_profile(realm, email, password, active, bot, full_name,
def create_user(email, password, realm, full_name, short_name,
active=True, bot=False, bot_owner=None,
avatar_source=UserProfile.AVATAR_FROM_GRAVATAR,
is_mirror_dummy=False):
is_mirror_dummy=False, default_sending_stream=None,
default_events_register_stream=None,
default_all_public_streams=None):
user_profile = create_user_profile(realm, email, password, active, bot,
full_name, short_name, bot_owner,
is_mirror_dummy)
user_profile.avatar_source = avatar_source
user_profile.default_sending_stream = default_sending_stream
user_profile.default_events_register_stream = default_events_register_stream
# Allow the ORM default to be used if not provided
if default_all_public_streams is not None:
user_profile.default_all_public_streams = default_all_public_streams
user_profile.save()
recipient = Recipient.objects.create(type_id=user_profile.id,
type=Recipient.PERSONAL)