Commit Graph

726 Commits

Author SHA1 Message Date
Tim Abbott 18f94de07f Use standard functions for parsing/validating email addresses.
This adds two new functions for parsing out the domain and username
from an email address, and switches our backend to use them and
django.core.validators.valid_email() rather than custom parsing and
raw email.split("@").

(imported from commit 3d6e997d66908811eccb5f82f2f7fe349b40f238)
2013-07-18 13:58:16 -04:00
Tim Abbott bece588897 Include server deployment location and git commit in blueslip emails.
This should make it a bit easier to figure out exactly what was
running on the backend when an error happens.

(imported from commit d1002a92c24870b8d98d7133dff865eecf1cfffe)
2013-07-18 13:58:16 -04:00
Jessica McKellar 849b49b22d Make "subject" an alias for the "topic" operator.
(imported from commit 52c11ff48a286533906b99ed62839e6ae3e35b17)
2013-07-17 12:04:46 -04:00
Tim Abbott 8755fc05ca Move subscription_property state change code to actions.py.
(imported from commit 57056af4e4fe021fafa1d0d511a9c551cd53c74d)
2013-07-17 10:36:57 -04:00
Zev Benjamin eb93f20f95 On MIT, when narrowing to an unclass (or derivatives) also narrow to the base stream
Previously, narrowing to a stream also narrowed to
/^(un)*stream-name(.d)*$/, but not the other way around.

(imported from commit 6643f8d8306a737f4e96d473dd1fdbfdcd56e2a8)
2013-07-16 16:53:08 -04:00
Jessica McKellar 81f6052fd2 views: Switch from Humbug to Zulip in user-visible text.
(imported from commit 86a6d26c751f0953b2bab1f91a8b7046236921c6)
2013-07-15 17:38:04 -04:00
Leo Franchi e5b855d883 Add a bulk invite page for the first user in a realm
(imported from commit cf85c9d475209da4591e2f06f142008fb19ac9d5)
2013-07-12 13:07:02 -04:00
Leo Franchi bd837936ce Refactor json_invite_users into do_invite_users
(imported from commit 053274a1fcfbb93fba27d136b246b65b3491f549)
2013-07-12 13:07:02 -04:00
Scott Feeney ccec989036 Set page_params.staging on anything that isn't a prod deploy
Until now, page_params.staging has been dependent on whether DEBUG =
True. On your local server, page_params.staging is true unless you set
DEBUG to False to test minification, in which case, it's false. This
situation still counts as staging IMHO, and the new behavior will be
more useful for testing as well as consistent.

Quick reference chart:

Is page_params.staging true...  without this commit?    with this commit?
                                --------------------    -----------------
On a local server, DEBUG=True          Yes                    Yes
On a local server, DEBUG=False          No                    Yes
On staging                             Yes                    Yes
On production                           No                     No

(imported from commit 6ea960e7945844dde0fbedbe901062508312b051)
2013-07-12 11:33:16 -04:00
Steve Howell 97994ea7a9 Shorten private operator (private-message -> private).
(imported from commit f938bd56de05cc8fc0da18348d4dec8a18c96bb9)
2013-07-10 16:58:17 -04:00
Tim Abbott b8c40119a2 Don't 500 when users try to make their name super long.
(imported from commit 0c5e8baa421ed8cbff431bc5085ffe78b0a8fc1e)
2013-07-09 17:43:47 -04:00
Luke Faraone cfe9e268f4 Do not specify cascade=True in deactivate_user_backend.
This was mistakenly included from a previous iteration of the do_deactivate()
function's interface.

(imported from commit 0a6ddc5ba1dfe944f2cc0087c590046da6a73531)
2013-07-08 15:44:01 -07:00
Luke Faraone 2c83d015a9 Refactor bot deactivation view to cover all users and expose via REST
(imported from commit 9f7afb3b43ed14db0bb4217dbae4114846bb840b)
2013-07-08 18:00:28 -04:00
Luke Faraone b6cfb40140 Allow for rest_dispatch-backed webapp API calls
(imported from commit 7813f1911bda92f76921159ef67dd60de9ca6465)
2013-07-08 14:30:20 -04:00
Steve Howell 75ac44f9f3 Support deactivate_bot API.
(imported from commit 41eece8bf69a930e02eb4c0208cf25b5c283da16)
2013-07-05 14:09:32 -04:00
Tim Abbott 58536354ad Fix regexp for mit.edu narrowing.
(imported from commit 1f82671de8a00ac6fb0fc649ed3f85a8ceaa388f)
2013-07-03 18:34:01 -04:00
Luke Faraone 490020b441 Serve custom fonts to OS X desktop clients
Previously we added code which prevented us from serving custom fonts to
Humbug Desktop user agents due to concerns QtWebKit bugs with
@font-face.

On OS X, we use the system WebKit so we don't have this bug. In fact,
the aformentioned change caused us to have no custom fonts at all on Mac
systems!

Here we fix this by resuming the serving of such fonts to Macs.

(imported from commit b222e9dd721914d17aed8341244cfb5c71149a12)
2013-07-03 16:37:56 -04:00
Jessica McKellar 46afe3be69 views: remove now-unused tutorial message sending capabilities.
(imported from commit 65d14bf469f64b47cf682f4fb36946c6d841eebd)
2013-07-02 18:26:17 -04:00
Jessica McKellar 9a40276865 views: don't defer subscribing a new users to their streams until after the tutorial.
We did this as a hack to prevent traffic while you were in the
tutorial. In the revised tutorial, we want you to see your actual
streams while you go through it, and we'll instead store the events
client-side for processing after you finish.

(imported from commit 75af93d0661c9d14b2c85624aef3f71a78053980)
2013-07-02 18:26:16 -04:00
Leo Franchi 779ab0e3ca Get apply_markdown value from REQ if it exists
(imported from commit c93b0a96564535c0a0162e827a67379fdf166de9)
2013-07-02 15:04:42 -04:00
Leo Franchi 93765b0568 Keep variable in list comprehension from shadowing
(imported from commit 2d2bbc029d7c13b5e6f125bd5f79ba3d73d3c677)
2013-07-02 12:10:23 -04:00
Tim Abbott 74fd508b2f Remove subscriptions using bulk queries.
This improves the performance of unsubscribing to N streams by more
than a factor of 10 for large N.

(imported from commit a529e6d3ac4452f49c2294908d275280019bbd05)
2013-07-02 10:50:29 -04:00
Tim Abbott 703dec0344 Use bulk queries to get the recipients for narrowing to MIT streams.
Otherwise we could in theory make dozens or hundreds of
memcached/database queries to handle a narrow.

(imported from commit 232f38d8c005b9aef6f12f2f9a4d68a19134d038)
2013-07-02 10:50:29 -04:00
Jeff Arnold 45116a0b61 For mit.edu, include unclasses and .d classes in narrowed views
(imported from commit e21aab715c949d4348c447e6e135281b47e06b98)
2013-07-02 10:50:29 -04:00
Tim Abbott a4cf528fad Use a bulk query to fetch the streams in list_to_streams.
This substantially improves the performance of all the functions using
this helper.

(imported from commit 9c247e82f392475c8ddf46b4b498ef293911e9f5)
2013-07-02 10:50:29 -04:00
Tim Abbott a66bb508bb Use bulk queries for adding many subscriptions to a single user.
Previously we only used bulk queries when adding many users to a
single stream, resulting in very slow performance when subscribing
users to large numbers of streams (as happens when setting up a new
MIT realm user).

(imported from commit 849fa7b2a1a146c0a9adc1c727c20c9fbfb7b425)
2013-07-02 10:50:28 -04:00
Tim Abbott c6916faca2 Genericize the bulk cache fetching logic.
(imported from commit 52664ce0ad800efff6b583e80c27701638ff6205)
2013-07-02 10:50:28 -04:00
Luke Faraone cf81c46c77 Omit fonts.css on QtWebKit clients
QTBUG-3467 prevents non-normal-face @font-face fonts from being used when
defined as such in CSS. To work around this, the desktop applications now
ship the Humbug font themselves, and this commit causes the server to no
longer send the problematic CSS rules to those clients.

We have some duplication insofar as we now have two minified CSS files, but
this is better than conditionally applying the CSS at page runtime.

(imported from commit 9a887f9fb8002d44171d366d1249ebbf21cc9c77)
2013-07-01 14:37:58 -04:00
Steve Howell 0f3b6cd863 Show a user's bots in the order they were created.
Showing a user's bots in alphabetical order leads to a mildly
confusing experience when we append a new bot to the end of the
table, but then you hit refresh, and the new bot goes to a different
position.  Since any given user is unlikely to have zillions of
bots, I don't think we need alphabetical order to help them find
old bots.

(imported from commit 4f19dbd7a016e7d867e88248190849dcd52c6d71)
2013-06-27 17:10:05 -04:00
Scott Feeney 83cd963c49 Remove unused imports
(imported from commit 9e3050c72a2d1137b9096c6cfa1c3945341b9a56)
2013-06-27 16:22:39 -04:00
Steve Howell 2bacaf2213 Fix % formatting style in miscellaneous places.
(imported from commit 917196024c981f879355c728da9b4590e964eeef)
2013-06-27 14:41:17 -04:00
Tim Abbott 1ec0ee0fd6 [manual] API add_subscriptions: Change arguments to support options.
Since in the future we might want requests to add subscriptions to
include things like colors, in_home_view, etc., we're changing the
data format for the add_subscriptions API call to pass each stream as
a dictionary, giving a convenient place to put any added options.

The manual step required here is updating the API version in AFS
available for use with the zephyr_mirror.py system.

(imported from commit 364960cca582a0658f0d334668822045c001b92c)
2013-06-25 16:34:45 -04:00
Tim Abbott 238f4a6362 API: Fix broken list_subscriptions call in REST API.
Previously, it always failed because we had hooked up the API endpoint
to a function that doesn't exist.

(imported from commit b5269f6d8e385facae4362742fe69a422f6315b7)
2013-06-25 16:34:45 -04:00
Tim Abbott 9924faaabd [manual] API get_public_streams: Return streams in a dictionary.
This way we can return properties of the streams other than just their
names in future versions of the API without breaking old clients.

The manual step required is to deploy the updated version of
sync-public-streams on zmirror.humbughq.com when we deploy this code
to prod.

(imported from commit 42b86d8daa5729f52c9961dd912c5776a25ab0b4)
2013-06-25 16:34:44 -04:00
Tim Abbott ce50812bca API get_members: Return a dictionary of users, not a list of tuples.
I believe this should require no special work on deploy, since some
grepping of logs suggests we are not currently using this API query.

(imported from commit 240086f900c6680cbc90bf6a2f334a9e1f172df6)
2013-06-25 16:34:43 -04:00
Scott Feeney 6b8bc74b4e Replace SITE_ROOT with DEPLOY_ROOT
Whereas `SITE_ROOT` referred to the directory where settings.py is
located, *all* actual uses of `SITE_ROOT` were joining it with `..` to
get the root of the git checkout, a much more useful value.

`DEPLOY_ROOT` now represents the root of the git checkout.

(imported from commit 351437f9a5801e5c7c08a3a97619e863144e5cc8)
2013-06-24 15:55:03 -04:00
Tim Abbott 8b4d406083 get_old_messages: Use a raw database query for empty narrows.
This improves the performance of the get_old_messages queries when
loading the home page by about a factor of 2.5x.

(imported from commit 581840a6ed7b391c9d9fde67f368fce816e567e2)
2013-06-24 10:17:10 -04:00
Tim Abbott a8d86d5fb2 get_old_messages: Refactor handling of UserMessage flags.
This is in preparation for having a case in which we query the
database directly to get the message flags, without going through a
UserMessage object.

(imported from commit d5218974680b0c4b028a84f3aae1c8242ceb08ce)
2013-06-24 10:17:10 -04:00
Tim Abbott e5e0544816 get_old_messages: Clean up code duplication in database queries.
(imported from commit c35aa71fc848c77f9c5c8edd8cc8acaa9481df74)
2013-06-24 10:17:10 -04:00
Tim Abbott 631a9048f7 Send message dicts to memcached as JSON dumps.
memcached stores objects sent to it using pickling, which is very
slow.  We work around this by sending memcached strings (i.e. JSON
dumps); pickling doesn't slow things down too much if all it is
getting is a string.

(imported from commit 0f0e534182eccb76c5731198e05a9324a1cef316)
2013-06-24 10:17:10 -04:00
Tim Abbott 222ef672b5 [manual] Use ujson instead of simplejson.
This saves something like 15ms on our 1000 message get_old_messages
queries, and will save even more when we start sending JSON dumps into
our memcached system.

We need to install python-ujson on servers and dev instances before
pushing this to prod.

(imported from commit 373690b7c056d00d2299a7588a33f025104bfbca)
2013-06-24 10:17:10 -04:00
Steve Howell b896c587e2 Extracted S3-related code to lib/upload.py
(imported from commit 4f0b0012b89d21b3bd445a2a6f84f3de72190e13)
2013-06-19 18:10:45 -04:00
Steve Howell 2b320f8d57 Allow user to upload an image for their bot's avatar (back end).
(imported from commit 34833b61b935f4eec2b23abbb3532aaa58e13fb6)
2013-06-19 10:21:20 -04:00
Zev Benjamin 80702ccaa0 Add metrics variables to the template context via a context processor
Wrapping render_to_response never actually worked correctly.  On the
login page, mixpanel_token would be missing, but we wouldn't get an
error because it is surrounded by double quotes, which meant that it
was still valid Javascript.

(imported from commit 820ee42fab8f679983e5a3a4309a2feaf690f20f)
2013-06-18 17:07:36 -04:00
Leo Franchi 625f8427e6 Return both subscribed and unsubscribed stream information when listing streams
(imported from commit 0aee84712eefd93aebc1041b371e471182eb7e9b)
2013-06-13 10:06:34 -04:00
Steve Howell d740d7c082 Show user-uploaded avatars on the website.
Show user-uploaded avatars on the website for users who have
UserProfile.avatar_source == 'U'.  (Continue to show gravatars
for other users.)  This includes the home page, the visible-phone
div, and the settings page.

This fix does NOT address a few things:
* There is no GUI to actually upload user images yet on the website.
* The !gravatar syntax in bugdown will continue to show gravatar images
  only.
* We are not changing identicon behavior.

(imported from commit 9f5ac0bbe21ba56528048233aab2430e4dd431aa)
2013-06-12 15:34:51 -04:00
Leo Franchi 76c9e27a76 Disable composebox experiments on prod
(imported from commit a553320e7d775978ee31af0f8920cbfeb705f5cb)
2013-06-11 11:41:34 -04:00
Leo Franchi 3cb34cf246 Rate limit jira and beanstalk API endpoints
(imported from commit ea299df983d53ee3f917f3c7314e78e813fe95a2)
2013-06-07 10:32:41 -04:00
Leo Franchi 0b5b1dafc4 Add a rate limiting system to our backend
(imported from commit a1218618918b4dedc77307e2f277665e7dd8fa22)
2013-06-04 09:43:09 -04:00
Jessica McKellar 088984b31a Don't let CUSTOMER4 users invite new users to the realm.
As requested by the facilitators: only they should be able to invite
new people.

(imported from commit 636e332759b9ad56a8d45115d92326a929472c14)
2013-06-02 13:23:04 -04:00