Commit Graph

41 Commits

Author SHA1 Message Date
Leo Franchi 26cd96f132 Let clients specify how long queues shall live, within limits
(imported from commit 86609f6611ed37b45b28c31e541528ce260d62c8)
2013-08-20 16:19:07 -04:00
Tim Abbott 517c98d56f add_subscriptions: add authorization_errors_fatal parameter.
For syncing streams between Zephyr and Zulip, we need to be able to
have the API client send the server a long list of streams, some of
which might be invite-only, and add the ones that it can add and not
the ones it cannot without a bunch of annoying round trips dropping
individual streams one is not authorized to one by one.  This argument
makes that possible.

We might find other applications as well.

(imported from commit 9236d185897c42218ab6cac3d8f3ddcb1bbc94e9)
2013-08-20 14:57:15 -04:00
Tim Abbott 5f724a94ac Add support for invite-only streams in mit.edu realm.
This changes the mit.edu access rules from:

* Susbcriber list and inviting users to streams are unavailable

to

* Susbcriber lists and inviting users to streams are only available
  for invite-only streams

streams must still be made invite-only manually.

This both cuts down on the amount of code that is different between
the mit.edu user experience and the standard one, as well as paving
the way for us to invite-only streams for zcrypt.

(imported from commit 24e0e85428608c05c89eeea349338dd392e5489a)
2013-08-20 14:57:14 -04:00
Tim Abbott 53e62d4e7b Use bulk queries when checking auth for invite-only streams.
This gets rid of our last query-in-a-loop in the code path for adding
subscriptions.

(imported from commit d192a7723647f49878fc05028e78d593077a3b78)
2013-08-20 14:57:14 -04:00
Tim Abbott 3396dc3aa9 list_to_streams: Return which new streams were created.
(imported from commit 95f6701c3d9e4ea31bbf2470fe91d05f7f1f5a17)
2013-08-20 14:57:14 -04:00
Tim Abbott a0238fcfcc list_to_streams: Rename existing_streams.
(imported from commit f7aec045fc9ead2911328860341fde31001c9456)
2013-08-20 14:57:14 -04:00
Tim Abbott 3ffc3bc7f6 Don't filter invite-only streams for mit.edu superuser.
It's likely we'll eventually want to split this into 2 API queries,
but most of the code in get_public_streams_backend is specialized for
the performance requirements of the mit.edu mirroring anyway.

(imported from commit 47ac6586b59467fd64992c573b6e36885167dcc5)
2013-08-20 14:57:14 -04:00
Tim Abbott 7f350abf74 Add missing update_fields when saving bots.
(imported from commit bdbf3785f41d39f934780a1e54dcb3e61c4c8af4)
2013-08-20 14:57:13 -04:00
Zev Benjamin 237746f3e2 Handle force pushes in Bitbucket integration
(imported from commit 6663934788b5cea13f9cf1344c45d2a568a0f287)
2013-08-20 12:28:04 -04:00
Zev Benjamin 8010b49067 Add support for issues events for Github integration
(imported from commit 6ae1013948626acdd161bd6f2648351201842658)
2013-08-19 17:13:37 -04:00
Kevin Mehall 8a741ed3d4 Ensure that the pointer is valid before saving it.
Trac #1716

Fix the tests to use real message IDs for the pointer. One helper didn't
use the pointer ID it was passed at all, so the test didn't actually test
what it was supposed to before.

(imported from commit 457bcdb04a6c3873e224b68cd9d79c9a26612010)
2013-08-19 16:46:52 -04:00
Kevin Mehall 054ccabf16 Don't fail to load the home page if the pointer is invalid.
Trac #1716

(imported from commit 089093aaa2e5466c9f8fb89f795b44c648e8a6e8)
2013-08-19 16:46:43 -04:00
Zev Benjamin 04147ae01f Set Cache-Control headers on index.html requesting no caching
This solves the problem of restoring a tab taking you to the previous
load's initial pointer position.

(imported from commit e5e988af65966b15a9d091064b65f87be3f0d75a)
2013-08-16 18:08:41 -04:00
Zev Benjamin f06c3c0aed Add BitBucket webhook integration
(imported from commit 50be72fb72d52e24b161f09b1d2314aaae5d636c)
2013-08-16 14:38:54 -04:00
Zev Benjamin 7650804499 Split build_message_from_gitlog in two
We do this because the upcoming Bitbucket webhook does not send
enough information for us to send a useful message for deleted
branches or force-pushes.

(imported from commit dcac675f47e10672125caabd6fefa8dc0dc9c86c)
2013-08-16 14:38:54 -04:00
Zev Benjamin 2f262b1558 Make @authenticated_rest_api_view imply @csrf_exempt
(imported from commit a90402effe48b184c05bf19f1136e3d63a6f460b)
2013-08-16 14:38:54 -04:00
Jessica McKellar d0aefa872e Give new users in all realms historical messages in their home view.
(imported from commit 60977c330d3a3dd22d77749104e388e12ef9e314)
2013-08-15 17:25:02 -04:00
Luke Faraone 4ad77831d1 Don't crash if a MIT user registers who has never sent/received a zgram.
(imported from commit 2527c8f4c3a5d8f6281318afff5ebdb431d0613e)
2013-08-15 13:17:46 -04:00
Luke Faraone 21b4b65322 Prefill a MIT user's fullname if we can guess.
(imported from commit 032aa393ee741cdae0deba6a4091be5c7dcc38d9)
2013-08-15 13:17:46 -04:00
Luke Faraone db2fd45deb Create MitUser objects in organic signups.
This is the way we disambiguate MIT users from normal PreregistrationUsers.

(imported from commit adfe781036f653ef2c15850100c7ea26332d9ef4)
2013-08-15 13:17:46 -04:00
Luke Faraone 9e71d0c7b2 Encode names before passing to urllib.
This otherwise causes Unicode bugs. See for example:

>>> import urllib
>>> urllib.quote_plus("hello&world+whats@up?")
'hello%26world%2Bwhats%40up%3F'
>>> urllib.quote_plus(u"faraoné")
/usr/lib/python2.7/urllib.py:1268: UnicodeWarning: Unicode equal
comparison failed to convert both arguments to Unicode - interpreting
them as being unequal
  return ''.join(map(quoter, s))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/urllib.py", line 1275, in quote_plus
    return quote(s, safe)
  File "/usr/lib/python2.7/urllib.py", line 1268, in quote
    return ''.join(map(quoter, s))
KeyError: u'\xe9'
>>> urllib.quote_plus(u"faraoné".encode("utf-8"))
'faraon%C3%A9'

(imported from commit 7c13b749bdc7f89e7b767ddd630be0ebce30802c)
2013-08-15 10:56:46 -04:00
Tim Abbott e24c770738 Fix bare save on UserProfile object in regenerate_api_key.
We should never be using bare saves like this, since they create
unfortunate races.

(imported from commit 82837e89b20eb4ac7040a79a5f695ca28cdf97bb)
2013-08-13 18:09:19 -04:00
Luke Faraone ecc42bc9f8 Add administrative panel to allow for user deactivations etc.
We now show a list of users and allow you to deactivate a user using the
same process as `python manage.py deactivate_user`.

We add a new menu item accessible from the gear icon which will eventually
have much more than just this, but we have a good start here.

Here we also add a property to UserProfile which determines whether you're
eligible to access the administration panel, and then have code which shows
the menu option if so.

This introduces a new JS file, admin.js.

(imported from commit 52296fdedb46b4f32d541df43022ffccfb277297)
2013-08-13 14:20:18 -04:00
Zev Benjamin 91c0be44a1 Raise JsonableErrors while checking messages instead of returning error strings
(imported from commit 986ad1e19dd508b12386c57cf093b32d3fbcf49e)
2013-08-13 13:45:10 -04:00
Jessica McKellar 1a0cc2b421 Send enough information in page_params for the client to consider bankruptcy.
Previously, we'd determine unread counts client-side as messages got
loaded, which meant:

a) how many unread messages you were known to have kept changing
b) you could bankrupt yourself and then get the bankruptcy message
again as more messages arrived from the server

(imported from commit 90f1af27b493c720f77d37487d8746749faf157e)
2013-08-12 17:33:39 -04:00
Luke Faraone 0cb741d7cc Removed confusing ALLOW_REGISTER setting.
ALLOW_REGISTER was no longer being used in determining whether you could
register for the app, so I've removed it to avoid additional local-dev /
production issues.

This closes #1613.

(imported from commit c928c6d350602d35f745ae1e60d734e4567885fc)
2013-08-12 16:16:26 -04:00
Luke Faraone cb2e993393 Allow any user with a @mit.edu to register for Zulip.
We add a new validator that ensures that people who sign up with @mit.edu
addresses are in fact MIT users.

This closes #1612.

(imported from commit 1e30794b1615dd57cb0e367d1fa186a877253357)
2013-08-12 13:09:20 -07:00
Zev Benjamin 51beeba854 referral: Prevent empty form submission
(imported from commit cc012e84c21bc424adaaa79611f09415480a2ba5)
2013-08-12 12:50:32 -04:00
Tim Abbott f9c3f77d07 For the CUSTOMER3 realm, include 100 messages in initial message set.
This is an experiment to try to ease the customer3 onboarding process
given that there will be a website with a public feed of recent Zulip
messages, to ensure that those messages appear for new users.

(imported from commit 31fb59c1800728b5e4d8a5ce7282c7dcedb02b21)
2013-08-12 10:17:18 -04:00
Tim Abbott b7e3f608cb Fix setting the initial pointer for users starting with messages.
This if statement stopped working when we made the pointer managed via
the events system.

(imported from commit 382ca5bd055ab85048b211068ff3d43a47607f28)
2013-08-12 10:17:18 -04:00
Tim Abbott 7fa448cdef Return the message ID when sending a message.
Our API documentation says that we do, and it seems like it could be
useful to clients, so we might as well do it.

(imported from commit c391e4952a09d41df4dc06e3dc6ee094f774822b)
2013-08-09 15:35:33 -04:00
Tim Abbott 9d6627d269 Rewrite documentation for /api/endpoints.
The main changes are:
(1) Changing the input format for the example response so that it is
human-readable and editable
(2) Updating it to use the events API

(imported from commit 308fade9595d6877836d343d2307e3fceff3e7d4)
2013-08-09 15:34:57 -04:00
Jessica McKellar 3f8dfc7b9b Move to a common random token generation function instead of several one-offs.
(imported from commit 3217de5384088deff68fbffc6bd481c045a76817)
2013-08-09 14:59:26 -04:00
Jessica McKellar 28a4c1e971 Give API superusers the ability to send messages to arbitrary realms.
(imported from commit e7d1e89844cd2c32c14ad852d848e93b5861eac1)
2013-08-09 14:59:26 -04:00
Jessica McKellar 62a20cf0ef Make emailgateway@zulip.com an API superuser.
(imported from commit 02b6c98123bbc10bd8feca29382a091b43d5b65a)
2013-08-09 14:59:26 -04:00
Steve Howell 8eb15a5436 Don't show inactive users as stream subscribers.
This fixes trac #1660.  A deactivated user may still have the
active flag set to "true" on their subscriptions, but this is
just to help future reactivations; they are not actually
valid subscribers while deactivated, so we add UserProfile.is_active
to our filter in the query in get_subscribers_backend().

(imported from commit 8598b2e180faea618371293e42b794898e645004)
2013-08-08 16:29:18 -04:00
Steve Howell 164215bc78 Support API for changing user's API key.
(imported from commit b9f5594cf809965c996115c8420a359820dad3ff)
2013-08-08 13:03:09 -04:00
Jessica McKellar d6c87f35e2 Move domain validation from a form field validator to a data cleaning check.
We need to be able to let a user through if they are trying to sign up
for a completely open realm like CUSTOMER3.

(imported from commit 1e33ab0ce94545f217739d501e9227dfb48e1123)
2013-08-08 10:12:22 -04:00
Jessica McKellar 99b2a90440 Move completely_open to models.py.
It will have new callers soon and that's as fine a place as any to
avoid circular imports.

(imported from commit 089a724e9ad06cb5a51ffe80f1729d789238e5f6)
2013-08-08 10:12:22 -04:00
Tim Abbott 1f1af26048 Change Humbug => Zulip in text/comments.
(imported from commit 2f9d73431ae40e1b9e9e11bc2f4f62f566ae758a)
2013-08-07 10:00:07 -04:00
Tim Abbott e111a2f9a5 [manual] Rename Django app from zephyr to zerver.
This needs to be deployed to both staging and prod at the same
off-peak time (and the schema migration run).

At the time it is deployed, we need to make a few changes directly in
the database:

(1) UPDATE django_content_type set app_label='zerver' where app_label='zephyr';
(2) UPDATE south_migrationhistory set app_name='zerver' where app_name='zephyr';

(imported from commit eb3fd719571740189514ef0b884738cb30df1320)
2013-08-06 07:39:36 -04:00