Commit Graph

524 Commits

Author SHA1 Message Date
Gloria Elston 092662d83e api: Use new endpoint for handling reactions. 2019-08-16 14:36:15 -07:00
Anders Kaseorg 5d063910ff zilencer: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg becef760bf cleanup: Delete leading newlines.
Previous cleanups (mostly the removals of Python __future__ imports)
were done in a way that introduced leading newlines.  Delete leading
newlines from all files, except static/assets/zulip-emoji/NOTICE,
which is a verbatim copy of the Apache 2.0 license.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-06 23:29:11 -07:00
Mateusz Mandera 8e0b6fa6cf populate_db: Use separate realm for system bots, like in production.
This commit alone breaks things, needs to be merged with the follow-up
ones.

welcome-bot is removed from the explicit list, because it already is in
settings.INTERNAL_BOTS.
2019-07-31 15:58:39 -07:00
Anders Kaseorg fd7803e7f4 settings: Unset STATIC_ROOT in development.
Django’s default FileSystemFinder disallows STATICFILES_DIRS from
containing STATIC_ROOT (by raising an ImproperlyConfigured exception),
because STATIC_ROOT is supposed to be the result of collecting all the
static files in the project, not one of the potentially many sources
of static files.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-24 17:40:31 -07:00
Mateusz Mandera 34b9a7bcad populate_db: Refactor and rename send_messages().
We rename the send_messages function to generate_and_messages, and
factor out the actual sending part of it into a separate function, which
now gets the name send_messages().
2019-07-22 15:56:17 -07:00
Mateusz Mandera e5138c38b2 populate_db: Add a batching option. 2019-07-22 15:55:28 -07:00
Mateusz Mandera d1bab42da6 populate_db: Send generated messages in one do_send_messages call.
Sending messages one-by-one is significantly slower compared to taking
advantage of the batch-handling code in do_send_messages, so we pass all
the messages to the function in one go. This is memory-hungry if there's
a lot of messages, so we will allow splitting into smaller batches in
the next commit.
2019-07-22 15:55:28 -07:00
Mateusz Mandera a50524762c populate_db: Refactor message.pub_date generating code.
The code generating pub_dates for messages would fail to distribute them
across days if tot_messages was too large.
We refactor this code as a separate function (for clarity and to unit
test for the bug we're fixing), and change the structure and naming to a
form that more clearly describes what's happening. We also shift away
from the approach of all the float-to-int conversions as this is in
general tricky and bug prone - django's timedelta() handles floats as
arguments, so we take advantage of that.
2019-07-22 15:55:28 -07:00
Wyatt Hoodes 9b69c1f7fe Merge pull request #12833 from whoodes/clean-up-new-user-bot
bots: Replace remnants of new-user-bot with default-bot@zulip.com.
2019-07-20 14:38:05 -07:00
Mateusz Mandera c1a8ba2974 populate_db: Use do_change_is_admin for setting api_super_user. 2019-07-15 12:32:29 -07:00
Yashashvi Dave d7ee2aced1 models: Add `external_account` in custom profile field types.
Add new custom profile field type, External account.
External account field links user's social media
profile with account. e.g. GitHub, Twitter, etc.

Fixes part of #12302
2019-07-09 17:21:54 -07:00
Yashashvi Dave f813fdcd5e populate_db: Rename URL type custom profile field.
Rename URL type custom profile field in populate db to avoid confusion
with the "GitHub profile" custom external account profile field we'll
be adding shortly.
2019-07-09 17:21:39 -07:00
Vaibhav fa85b92eda populate_db: Add MD content to stream descriptions and user bio.
This adds a 'bold' element to `all` stream and 'code' element to
`test` stream in populate_db. Also changes the bio for Hamlet to
include a list.
2019-06-24 22:10:24 -07:00
Wyatt Hoodes fb58b54293 test-backend: Move `test_messages.json` to `var/<uuid>/test-backend`. 2019-06-24 12:23:09 -07:00
Tim Abbott bcc6949461 zilencer: Add better error handling for IntegrityError.
This provides a clean warning and 40x error, rather than a 500, for
this corner case which is very likely user error.

The test here is awkward because we have to work around
https://github.com/zulip/zulip/issues/12362.
2019-05-20 17:53:43 -07:00
neiljp (Neil Pilgrim) f3ef2a186c mypy: Enable strict-optional for calculate_first_visible_message_id. 2019-05-01 10:49:24 -07:00
Vishnu Ks ecdd3bea43 billing: Add cron job to run invoice_plans once a day.
Fixes #11960
2019-04-29 11:23:17 -07:00
Anders Kaseorg 9a9de156c3 lint: Fix calls to _() on computed strings.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 15:23:03 -07:00
Anders Kaseorg 643bd18b9f lint: Fix code that evaded our lint checks for string % non-tuple.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 15:21:37 -07:00
Tim Abbott cfd5054f2d zilencer: Add indexes for remotecount models.
These new indexes improve the performance of checking whether our
Remote*Count models are up to date by a factor of ~1000.
2019-04-23 13:52:02 -07:00
Rishi Gupta e8741c448d refactoring: Move set_default_streams into do_create_realm.
After the commits leading up to this, the only meaningful use of this
function was in the realm creation process.
2019-03-21 12:33:19 -07:00
Rishi Gupta e71a1a2b4e onboarding: Remove initial streams other than general and core team.
The hope is that by having a shorter list of initial streams, it'll
avoid some potential confusion confusion about the value of topics.
At the very least, having 5 streams each with 1 topic was not a good
way to introduce Zulip.

This commit minimizes changes to the message content in
`send_initial_realm_messages` to keep the diff readable. Future commits will
reshape the content.
2019-03-21 12:30:14 -07:00
Tim Abbott 12756b48a0 populate_db: Fix help text for --test-suite. 2019-02-20 17:42:30 -08:00
Eeshan Garg 179b747769 streams: Refactor multi-option helpers into separate functions.
For internal stream messages, most of the time, we have access to
a Stream object. For the few corner cases where we don't, it is a
much cleaner approach to have a separate function that accepts a
stream name than having one multi-option helper that accepts both
names and objects.
2019-02-12 11:10:26 -08:00
Greg Price 49fd2e65de push notif: Add GCM options to bouncer API; empty for now.
The first use case for this will be setting `priority`,
coming up shortly.
2019-02-08 09:40:43 -08:00
Eeshan Garg c240008edb internal_prep_stream_message: Support accepting a Stream object.
If the caller has access to a Stream object, it is wasteful to
query a database for a stream by ID or name. In addition, not
having to go through stream names eliminates various classes of
possible bugs involved with getting a Stream object back.
2019-02-08 08:53:16 -08:00
Anders Kaseorg f5197518a9 analytics/zilencer/zproject: Remove unused imports.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-02 17:31:45 -08:00
Anders Kaseorg 4e21cc0152 views: Remove unused imports.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-02 17:23:43 -08:00
Tim Abbott 55ead5b77f zilencer: Fix buggy validation of installation_counts upload.
This was a simple copy-paste error.  It's probably worth a bit more
work on code duplication in this code path.
2019-02-02 11:51:22 -08:00
Tim Abbott 022c8beaf5 analytics: Add APIs for submitting analytics to another server.
This adds a new API for sending basic analytics data (number of users,
number of messages sent) from a Zulip server to the Zulip Cloud
central analytics database, which will make it possible for servers to
elect to have their usage numbers counted in published stats on the
size of the Zulip ecosystem.
2019-02-01 22:03:52 -08:00
Anders Kaseorg 79d888223f profiling: Use mkstemp for profile.data filename.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-01-15 16:08:48 -08:00
Tim Abbott 3c70a61132 models: Deduplicate definitions of push tokens.
Since c57c4cf703, these are no longer
different implementations, so we can deduplicate them.  Because Django
is smart, no migration is required.
2018-12-18 13:05:23 -08:00
Tim Abbott e603237010 email: Convert accounts code to use delivery_email.
A key part of this is the new helper, get_user_by_delivery_email.  Its
verbose name is important for clarity; it should help avoid blind
copy-pasting of get_user (which we'll also want to rename).
Unfortunately, it requires detailed understanding of the context to
figure out which one to use; each is used in about half of call sites.

Another important note is that this PR doesn't migrate get_user calls
in the tests except where not doing so would cause the tests to fail.
This probably deserves a follow-up refactor to avoid bugs here.
2018-12-06 16:21:38 -08:00
Vishnu Ks 2889de6d90 populate_db: Extract subscribe_users_to_streams function. 2018-11-29 12:15:58 -08:00
Tim Abbott 9c224ccdd3 populate_db: Suppress logging output for push notifications.
This fixes a lot of spammy output of the form:

2018-11-27 17:46:48.279 INFO [zerver.lib.push_notifications] Sending push notification to user 46

when running populate_db, which is both confusing (since we're not
actually sending push notifications here) and spammy.
2018-11-27 09:50:17 -08:00
Tim Abbott e8290ccd6d add_new_user: Fix mention of running "python manage.py".
This won't work on Python 3.
2018-11-06 13:28:18 -08:00
Tim Abbott 68ab71eb8b push: Fix exceptions when removing push notifications.
Now that we allow multiple users to have registered the same token, we
need to configure calls to unregister tokens to only query the
targeted user_id.

We conveniently were already passing the `user_id` into the push
notification bouncer for the remove API, so no migration for older
Zulip servers is required.
2018-10-12 11:19:23 -07:00
Vishnu Ks d8c19cb003 models: Move billing models from zilencer to corporate. 2018-10-11 14:54:29 -07:00
Tim Abbott c57c4cf703 notifications: Fix push notifications with multiple realms.
Previously, Zulip did not correctly handle the case of a mobile device
being registered with a push device token being registered for
multiple accounts on the same server (which is a common case on
zulipchat.com).  This was because our database `unique` and
`unique_together` indexes incorrectly enforced the token being unique
on a given server, rather than unique for a given user_id.

We fix this gap, and at the same time remove unnecessary (and
incorrectly racey) logic deleting and recreating the tokens in the
appropriate tables.

There's still an open mobile app bug causing repeated re-registrations
in a loop, but this should fix the fact that the relevant mobile bug
causes the server to 500.

Follow-up work that may be of value includes:
* Removing `ios_app_id`, which may not have much purpose.
* Renaming `last_updated` to `data_created`, since that's what it is now.

But none of those are critical to solving the actual bug here.

Fixes #8841.
2018-10-10 16:15:52 -07:00
Vishnu Ks 59865797ac billing: Move billing tests from zilencer to corporate. 2018-10-01 15:44:02 -07:00
Vishnu Ks c01ebaa8d8 billing: Move billing management commands from zilencer to corporate. 2018-10-01 15:43:55 -07:00
Vishnu Ks 93b398bc0a billing: Move zilencer/lib/stripe to corporate. 2018-10-01 15:43:44 -07:00
Vishnu Ks 6914ee126c billing: Move billing-related views and urls to corporate. 2018-10-01 15:43:21 -07:00
Vishnu Ks 5a6b2ebb1f billing: Add ability for users to change their card. 2018-09-24 19:25:26 -07:00
Vishnu Ks 3e86fa84ea billing: Rename RealmAuditLog.STRIPE_CARD_ADDED to STRIPE_CARD_CHANGED. 2018-09-11 00:08:38 -07:00
Rishi Gupta 18b86a9499 billing: Fix RealmAuditLog accounting for downgrade. 2018-09-01 09:42:10 -07:00
Rishi Gupta 31ed4492ce billing: Add backend for downgrading. 2018-08-31 17:49:34 -07:00
Rishi Gupta b7c326a161 billing: Include account balance in prorated credits calculation. 2018-08-31 17:49:34 -07:00
Rishi Gupta bebd93b571 billing: Fix idempotency bug in setup_stripe management command. 2018-08-31 17:49:34 -07:00
Rishi Gupta 24b22e7e75 billing: Guard billing by BILLING_ENABLED rather than DEVELOPMENT. 2018-08-31 17:49:34 -07:00
Vishnu Ks 7b307fa58f billing: Set max_invites to 3000 for Premium organizations.
This is meant to be effectively infinite for legitimate use.
2018-08-28 16:03:34 -07:00
Vishnu Ks 98dac0f0a9 billing: Remove Customer.billing_user. 2018-08-27 12:35:46 -07:00
Vishnu Ks dcb7b15069 billing: Use UserProfile.is_billing_admin instead of Customer.billing_user. 2018-08-27 12:35:46 -07:00
Rishi Gupta eec07072ee billing: Add coupons. 2018-08-24 17:27:26 -07:00
Rishi Gupta d229948a43 billing: Make source optional when creating stripe customer. 2018-08-24 16:40:34 -07:00
Rishi Gupta 4ad8f20c28 billing: Add comment explaining race condition in customer creation. 2018-08-24 16:40:34 -07:00
Rishi Gupta 90407537a0 billing: Add comment explaining race conditions in initial subscription. 2018-08-22 21:30:48 -07:00
Rishi Gupta 16a5540e58 billing: Add comment to downgrading section in views.billing_home. 2018-08-22 19:20:06 -07:00
Rishi Gupta d081cf7b78 billing: Add transaction.atomic() for Customer creation and logging. 2018-08-22 19:20:06 -07:00
Rishi Gupta 3cf9cd00d6 billing: Remove idempotency key from upgrade process.
This would be relevant if we retried on network failure, but we don't.
2018-08-22 19:18:32 -07:00
Vishnu Ks 9bb338be11 models: Add plan_type to Realm. 2018-08-21 12:39:06 -07:00
Rishi Gupta c3a912f8b6 management commands: Add sleep_forever to lib/management. 2018-08-17 09:20:51 -07:00
Rishi Gupta 4181d575b1 billing: Move Stripe call to end in do_subscribe_customer_to_plan.
In general, everything that could throw an error and that could come before
the Stripe call should do so.
2018-08-13 20:24:08 -07:00
Rishi Gupta 56d4034db4 billing: Require successful charge to establish billing relationship.
There are several situations in which we want to create a Customer and
stripe.Customer object before we really have a billing relationship with a
customer. The main one is giving non-profit or educational discounts.
2018-08-13 20:24:08 -07:00
Rishi Gupta 27d4b1a5f0 billing: Add RealmAuditLogProcessor. 2018-08-13 17:12:50 -07:00
Rishi Gupta e804c563a8 billing: Update stripe error handling code. 2018-08-13 17:12:50 -07:00
Rishi Gupta d0e377428a billing: Fix typo in CONTACT_SUPPORT error message. 2018-08-10 22:48:10 -07:00
Rishi Gupta 2855864f54 billing: Rename RealmAuditLog.REALM_PLAN_QUANTITY_RESET. 2018-08-10 15:54:31 -07:00
Rishi Gupta abc044e869 billing: Rename RealmAuditLog.REALM_PLAN_STARTED. 2018-08-10 15:54:31 -07:00
Rishi Gupta d33d7e1c28 billing: Rename RealmAuditLog.REALM_CARD_ADDED. 2018-08-10 15:54:30 -07:00
Rishi Gupta bdb6d8213f billing: Rename RealmAuditLog.REALM_STRIPE_INITIALIZED. 2018-08-10 15:46:55 -07:00
Vishnu Ks 0c84260faa billing: Enforce full coverage in zilencer/tests. 2018-08-10 13:52:35 -07:00
Vishnu Ks 4895637a5a billing: Fix the BillingError description check in test.
The self.assertEqual statement won't get executed because
BillingError would be raised and the execution would exit
with block.
2018-08-10 13:52:35 -07:00
Vishnu Ks d32051b106 billing: Test that salt and seat_count are set correctly in /upgrade. 2018-08-10 13:52:35 -07:00
Vishnu Ks 132480c031 billing: Pass email to stripe.Customer.create. 2018-08-10 13:52:35 -07:00
Vishnu Ks d64ba5d2be billing: Update the charged amount when user changes plan in upgrade page. 2018-08-10 13:52:35 -07:00
Yago González 6a192ac84c utils: Move random API key generator as generate_api_key.
random_api_key, the function we use to generate random tokens for API
keys, has been moved to zerver/lib/utils.py because it's used in more
parts of the codebase (apart from user creation), and having it in
zerver/lib/create_user.py was prone to cyclic dependencies.

The function has also been renamed to generate_api_key to have an
imperative name, that makes clearer what it does.
2018-08-08 16:45:25 -07:00
Yago González f6219745de users: Get all API keys via wrapper method.
Now reading API keys from a user is done with the get_api_key wrapper
method, rather than directly fetching it from the user object.

Also, every place where an action should be done for each API key is now
using get_all_api_keys. This method returns for the moment a single-item
list, containing the specified user's API key.

This commit is the first step towards allowing users have multiple API
keys.
2018-08-08 16:35:17 -07:00
Rishi Gupta 2cdcf4b88f billing: Rename get_upcoming_invoice. 2018-08-06 16:24:09 -04:00
Rishi Gupta 89ca1d0d97 billing: Rename get_stripe_customer. 2018-08-06 16:24:09 -04:00
Rishi Gupta 086b7d76e5 billing: Rename customer_with_active_subscription in fixture generation.
Fixes regression introduced in 79dddd5.
2018-08-06 16:24:09 -04:00
Rishi Gupta 9f2b8a4a11 billing: Move checks from process_initial_upgrade into separate function. 2018-08-06 11:05:33 -04:00
Rishi Gupta 5719633992 billing: Update and unify billing error handling. 2018-08-06 11:05:33 -04:00
Rishi Gupta 79dddd5b80 billing: Rename customer_with_active_subscriptiion. 2018-08-06 11:05:33 -04:00
Vishnu Ks 18a9e4fc9c billing: Call mock directly in test_subscribe_customer_to_second_plan. 2018-08-06 11:05:33 -04:00
Vishnu Ks e06957bef5 billing: Raise exceptions instead of returning errors in upgrade flow. 2018-08-06 11:05:33 -04:00
Vishnu Ks 8643c681f0 billing: Separate initial upgrade logic to another function. 2018-08-06 11:05:33 -04:00
Vishnu Ks fa7b98030b billing: Add mock for cancel at period end subscriptions. 2018-08-04 19:17:34 -04:00
Vishnu Ks d89e07b8a7 billing: Add mock and test for extracting canceled subscription. 2018-08-04 19:17:34 -04:00
Vishnu Ks 84b148728f billing: Don't mock functions in test_extract_current_subscription. 2018-08-04 19:17:34 -04:00
Vishnu Ks c2023eaaa8 billing: Mention the exact type of stripe.Customers subscriptions attribute. 2018-08-04 19:17:34 -04:00
Vishnu Ks 036ad03b3a billing: Mention the exact return type for mock functions. 2018-08-04 19:17:34 -04:00
Vishnu Ks 8bcd4131fe billing: Rename retrieve_customer fixture. 2018-08-04 19:17:34 -04:00
Vishnu Ks b7d3a1a0f3 billing: Don't check for stripe key and plan objects in tests.
Stripe already returns an appropriate error in prod, and these checks are
just a hassle in tests.

Also fixes an error where the check for Plan.objects.exists() was missing
a "not".
2018-08-04 19:17:34 -04:00
Roman Godov c0806917ec models: Rename Realm.restricted_to_domain field.
This renames Realm.restricted_to_domain field to
emails_restricted_to_domains, for greater clarity as to what it does
just from seeing the setting name, without having to look it up.

Fixes part of #10042.
2018-07-31 09:28:33 -07:00
Rishi Gupta 4554b564f7 billing: Rename RealmAuditLog.REALM_PLAN_QUANTITY_UPDATED. 2018-07-31 10:56:31 -04:00
Vishnu Ks abf485bfcb billing: Add mypy stubs to stripe imports.
Tweaked by tabbott to add an extra type: ignore.
2018-07-26 16:31:32 -07:00
Vishnu Ks d7b7430af0 billing: Add test for subscribing customer to second plan. 2018-07-25 23:03:55 -07:00
Vishnu Ks ba7db968d8 billing: Don't check for stripe config while running tests. 2018-07-25 23:03:55 -07:00
Vishnu Ks 51c82b6d4f models: Rename PLAN_QUANITY_UPDATED event type. 2018-07-25 23:03:55 -07:00
Vishnu Ks 975969aa89 stripe: Check for the existence of Pan objects in dev environment. 2018-07-25 23:03:55 -07:00
Vishnu Ks d6ed2c69be billing: Don't use self.realm and self.user in tests. 2018-07-25 23:03:55 -07:00
Vishnu Ks f98a86cdc2 billing: Don't show initial upgrade page in production for now. 2018-07-25 23:03:55 -07:00
Vishnu Ks b88613fd0b billing: Expand default_source object when retrieving customer. 2018-07-24 10:20:23 -07:00
Vishnu Ks 1225bfd6ee billing: Don't use data attribute for iterating through subscriptions.
Iterating through data attribute is same as iterating through
subscriptions.
2018-07-24 10:20:23 -07:00
Vishnu Ks 0bcc0ca0d8 stripe: Fix type of stripe_customer_id. 2018-07-24 10:20:23 -07:00
Vishnu Ks 15eff517f4 billing: Verify that plan names are not tampered. 2018-07-24 08:04:00 -07:00
Vishnu Ks 82fc82b7e2 billing: Sign and verify the seat count during upgrade. 2018-07-24 08:04:00 -07:00
Vishnu Ks d75054fb15 billing: Add function to sign strings. 2018-07-24 07:16:12 -07:00
Tim Abbott 888434e6cd test_stripe: Delete broken test.
This is an expedient way to fix master failing, which it has been
since f2861442f7.
2018-07-23 22:20:12 -07:00
Vishnu Ks eb48197f67 billing: Get upcoming invoice only if there is a live subscription. 2018-07-23 19:18:17 -07:00
Vishnu Ks f2861442f7 billing: Enforce Customer can have only one live subscription at a time. 2018-07-23 19:03:36 -07:00
Vishnu Ks db8700513b stripe: Fix type of stripe_plan_id in do_subscribe_customer_to_plan. 2018-07-23 17:55:15 -07:00
Vishnu Ks 28167585b1 models: Rename several RealmAuditlog event types to past tense.
These event types haven't been used in production yet, and thus are
save to change without a migration.
2018-07-22 20:00:05 -07:00
Max Nussenbaum 8fd900626d billing: Style billing page.
This adds styles to /billing.
2018-07-13 18:30:38 +05:30
Vishnu Ks 895c7703a6 billing: Show the billing page only to admins and billing users. 2018-07-12 12:51:38 +05:30
Vishnu Ks 377fac2864 billing: Pass stripe_customer instead of Customer in upgrade functions. 2018-07-12 12:51:38 +05:30
Vishnu Ks ff4c1ca2c1 models: Add SUBSCRIPTION_CREATED event type constant to RealmAuditLog. 2018-07-10 15:42:26 +05:30
Vishnu Ks 89fefcd1a2 mypy: Replace Any with stripe types in zilencer/lib/stripe.py. 2018-07-09 15:24:57 +05:30
Shubham Dhama 7cbacdb8c2 populate_db: Integrate populate_analytics_db.
As detailed in the documentation changes, this simplifies the
development workflow for doing UI work on the /stats pages.

The cost is a ~10% increase the time it takes to run `populate_db`,
which doesn't happen very often (and for most purposes manifests as a
1% increase in the time it takes to rebuild the database from scratch).
2018-07-09 15:05:48 +05:30
Rishi Gupta b5753d0ddc billing: Add initial support for seat based plans.
The main remaining todo for correctly populating
RealmAuditLog.requires_billing_update is supporting the de-seating (and
corresponding re-seating) that happens after being offline for two weeks.
2018-07-09 14:33:08 +05:30
Rishi Gupta 16334a1ba7 billing: Update billing system. 2018-07-09 14:33:07 +05:30
Anders Kaseorg 037f696d26 Enable pycodestyle W605 (invalid escape sequence).
The only changes visible at the AST level, checked using
https://github.com/asottile/astpretty, are

zerver/lib/test_fixtures.py:
'\x1b\\[(1|0)m' ↦ '\\x1b\\[(1|0)m'
'\\[[X| ]\\] (\\d+_.+)\n' ↦ '\\[[X| ]\\] (\\d+_.+)\\n'

which is fine because re treats '\\x1b' and '\\n' the same way as
'\x1b' and '\n'.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-07-03 16:54:46 +02:00
Yashashvi Dave 8909cb1d15 custom fields: Allow list of users in user type of custom fields.
Allow user to add more than one user-value in user type of custom
fields.

Tweaked by tabbott to improve the models.py code and type annotations.
2018-06-16 09:37:49 -07:00
Rishi Gupta 634c4516a7 portico: Add svgs of sea creatures. 2018-06-06 13:57:55 -07:00
Tim Abbott 27e7770540 populate_db: Initialize the outgoing webhook bot properly.
Previously, we created the bot, but didn't initialize its service
object.
2018-06-01 08:48:17 -07:00
Robert Hönig 497cd4a1f9 outgoing webhooks: Change default URL in all tests.
This reflects the changes to the default URL publicly
displayed to the user. It also changes the default
URL of the default test server outgoing webhook, which
prevented the test server flaskbotrc from working out
of the box.
2018-05-28 10:40:44 -07:00
Yashashvi Dave e82c879b85 custom fields: Add user type of custom fields.
Fixes #8878
2018-05-27 23:01:21 -07:00
Vishnu Ks 54a002c2e2 requirements: Upgrade pyflakes to 2.0.0.
We fix a few errors that only the new version finds.
2018-05-24 11:31:36 -07:00
Aditya Bansal 8cfb437677 provision: Don't run create_realm_internal_bots management command.
We essentially stop running create_realm_internal_bots during
every provisioing and move its operations to run from populate db.
In fact to speed things up a bit we actually make populate db call the
funcs which create_realm_internal_bots calls behind the scenes.

Fixes: #9467.
2018-05-23 13:34:52 +05:30
Tim Abbott 1b47b2e7cd populate_db: Fix an out-of-date mypy annotation. 2018-05-22 14:46:03 -07:00
Tim Abbott 8a64d8ef06 populate_db: Fix stream colors being generated wrong.
Previously, the stream colors index i was accidentally a function only
of the user, so each user got the same color for all their streams.

This should provide a lot nicer-looking development environment
experience.
2018-05-22 14:29:43 -07:00
Tim Abbott 4c8a69e3fb populate_db: Add an initial stream for the default guest user. 2018-05-22 14:29:43 -07:00
Sampriti Panda 4ce5a85a49 populate_db: Make test_suite data generation more deterministic. 2018-05-22 14:07:55 -07:00
Tim Abbott cec7686f3d push notifications: Clean up unregistered/bad APNS tokens.
We've had this sort of logic for GCM for a long time; it's worth
adding for APNS as well.

Writing this is a bit of a reminder that I'm not a fan of how our unit
tests for push notifications work.
2018-05-21 11:30:56 -07:00
Shubham Padia 4d70d032bc populate_db: Make is_web_public default to False.
Explicit mentions of `is_web_public` as False in the stream dict to be
passed to `bulk_create_streams` have been removed.
2018-05-16 13:40:22 -07:00
Shubham Padia 315047a38b populate_db: Make invite_only default to False.
Explicit mentions of `invite_only` as False in the stream dict to be
passed to `bulk_create_streams` have been removed.
2018-05-16 13:40:10 -07:00
Shubham Padia 7b4f6e0058 tests: Make is_announcement_only true for `announce` stream in populate_db.
Makes announce stream `is_announcement_only` for the dev db for easier
manual testing. The default value for `is_announcement_only` in
`bulk_create_streams` is False.
2018-05-16 13:35:45 -07:00
Aditya Bansal 67bf71472a zilencer: Change use of typing.Text to str. 2018-05-12 15:22:39 -07:00
Tim Abbott 7cbff8b521 push registration: Use standard error message for auth problems.
This avoids adding an unnecessary new translated string.
2018-05-04 09:04:39 -07:00
Tim Abbott 43098a6f7c zilencer: Add automated signup system for push notifications.
Based on an initial version by Rishi Gupta.

Fixes #7325.
2018-05-03 21:27:49 -07:00
Rishi Gupta d18102d1c6 zilencer: Remove uniqueness constraint on RemoteZulipServer.hostname.
Enforcing the unique constraint adds an unnecessary support burden for
figuring out who actually controls a given hostname, and in particular, for
verifying updates to the org id/key on a re-install of the Zulip server.
2018-05-03 12:50:29 -07:00
Rishi Gupta 42a99e8c1d zilencer: Rename remote_server_unregister_push. 2018-05-03 12:50:29 -07:00
Rishi Gupta 76650f5930 zilencer: Rename remote_server_register_push to register_remote_push_device. 2018-05-03 12:50:29 -07:00
Aditya Bansal 9629be689b populate_db: Add a web public stream to dev database.
We flip the Stream "Rome" to be a web public stream. Also we add
attribute is_web_public in various stream dicts and in the
bulk_create_streams function of bulk_create.py responsible for
default stream creation in dev environment.
2018-05-02 15:23:33 -07:00
Yashashvi Dave 0d7d94d0db custom fields: Add support for custom URL field type. 2018-04-30 10:53:23 -07:00
Yashashvi Dave 4033f210af custom fields: Add support for custom date field type. 2018-04-30 23:04:25 +05:30
Tim Abbott 8344bd171e populate_db: Properly initialize the email_gateway_bot.
Apparently, this bot account was not properly being tagged as an API
super user in the test database; resulting in incorrect behavior if we
tried to send to a private stream in a test.

(Note that there seems to also be a similar issue in production, that
we don't understand the cause of; that is unrelated).
2018-04-27 13:56:04 -07:00
Umair Khan cf2f6b38dd profile: Add choice field.
Fixes part of #8878
2018-04-26 00:35:51 -07:00