From 300cceb3e4a8dfdb3f5c1543cd1e99bf51ebd682 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Wed, 13 Nov 2013 10:59:27 -0500 Subject: [PATCH] Create feedback bot in enterprise installs (imported from commit 0c0a6919bd29e12484d520f80789b39b203099b0) --- .../commands/initialize_enterprise_db.py | 23 ++----------------- zproject/settings.py | 5 +++- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/zerver/management/commands/initialize_enterprise_db.py b/zerver/management/commands/initialize_enterprise_db.py index b24ba55136..075a37c08d 100644 --- a/zerver/management/commands/initialize_enterprise_db.py +++ b/zerver/management/commands/initialize_enterprise_db.py @@ -37,7 +37,7 @@ class Command(BaseCommand): ) def handle(self, **options): - zulip_realm = Realm.objects.create(domain="zulip.com") + Realm.objects.create(domain="zulip.com") Realm.objects.create(domain=settings.ADMIN_DOMAIN) realms = {} for realm in Realm.objects.all(): @@ -45,29 +45,10 @@ class Command(BaseCommand): # Create test Users (UserProfiles are automatically created, # as are subscriptions to the ability to receive personals). - names = [("Othello, the Moor of Venice", "othello@zulip.com"), ("Iago", "iago@zulip.com"), - ("Prospero from The Tempest", "prospero@zulip.com"), - ("Cordelia Lear", "cordelia@zulip.com"), ("King Hamlet", "hamlet@zulip.com")] + names = [(settings.FEEDBACK_BOT_NAME, settings.FEEDBACK_BOT)] for i in xrange(options["extra_users"]): names.append(('Extra User %d' % (i,), 'extrauser%d@zulip.com' % (i,))) create_users(realms, names) - # Create public streams. - stream_list = ["Verona", "Denmark", "Scotland", "Venice", "Rome"] - create_streams(realms, zulip_realm, stream_list) - recipient_streams = [Stream.objects.get(name=name, realm=zulip_realm).id for name in stream_list] - - # Create subscriptions to streams - # TODO: Replace this with something nonrandom - subscriptions_to_add = [] - profiles = UserProfile.objects.select_related().all() - for i, profile in enumerate(profiles): - # Subscribe to some streams. - for type_id in recipient_streams[:int(len(recipient_streams) * - float(i)/len(profiles)) + 1]: - r = Recipient.objects.get(type=Recipient.STREAM, type_id=type_id) - s = Subscription(recipient=r, user_profile=profile) - subscriptions_to_add.append(s) - Subscription.objects.bulk_create(subscriptions_to_add) # Create the "website" and "API" clients; if we don't, the # default values in zerver/decorators.py will not work diff --git a/zproject/settings.py b/zproject/settings.py index 52856f09f0..66a7b30bd6 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -258,7 +258,10 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '', 'NAGIOS_STAGING_RECEIVE_BOT': None, 'APNS_CERT_FILE': None, 'ZULIP_ADMINISTRATOR': '', - 'INITIAL_PASSWORD_SALT': None + 'INITIAL_PASSWORD_SALT': None, + 'FEEDBACK_BOT': 'feedback@zulip.com', + 'FEEDBACK_BOT_NAME': 'Zulip Feedback Bot', + 'ENABLE_FEEDBACK': True } for setting_name, setting_val in DEFAULT_SETTINGS.iteritems():