Commit Graph

699 Commits

Author SHA1 Message Date
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
Steve Howell 3f1b3af002 Add "Mentioning messages" to the upper left sidebar.
Treat "mentioned" messages like "starred" messages for narrowing.

Lots of ugly copy/paste here.  There might be opportunity for
some cleanup in places.

(imported from commit e7629890d42643c0000e1cc85422b2a0690f2cc4)
2013-05-30 14:45:01 -04:00
Keegan McAllister 52e0aa59a6 Minify third-party JavaScript and CSS in production
(imported from commit 943d712bc460640d7a689ac678922d9c5bf7aa9c)
2013-05-30 13:51:47 -04:00
Leo Franchi 81058f5f9b Reset our 24hr email blackout when a user logs in
(imported from commit 93bed7c4d049ba4d7b30d2e02fbbe0d2debca6f8)
2013-05-24 21:23:59 -04:00
acrefoot 9454683108 [manual] Send new-stream invitations using a bulk database query
Messages that get sent out when someone subscribes many people to a new stream each
cause individual database queries (and their associated transactions). With the patched
bulk_create (which sets the .id on created objects), we can reduce this query down to a constant
number of queries on the Message and UserMessage tables.

Note for deployment (local dev, staging and prod):
you must be running a patched django, found here: https://github.com/acrefoot/django/branches
use this branch: acrefoot-bulk_create_with_id-1.5.1
on acrefoot-bulk_create_with_id-1.5.1
relevant sha1: ac6d885b811f7e2e34f0db0da217983f7dfd357f

(imported from commit b0dab9dac784d3ff47751e65bf22c2dddc22edf5)
2013-05-24 21:23:57 -04:00
Leo Franchi 4fc7c7c797 Support JIRA workflow post-function web hooks
(imported from commit cf70730f4c5a847835f07f0048559269f3afd06e)
2013-05-24 21:23:56 -04:00
Zev Benjamin ae9be7298d Wrap render_to_response
(imported from commit d23aa3e5ad4c5243e83df098953ea4b1f7b3c294)
2013-05-21 17:56:49 -04:00
Leo Franchi 813073ec32 Hide known warnings in unit test output
(imported from commit 484b383b7466f4428bbde55344775687149406b9)
2013-05-21 14:05:48 -04:00
Tim Abbott 2bdecd130a Add user interface frontend for editing messages.
The only known outstanding bug with this is that it doesn't properly
handle the updating of a message's highlighting/presence in a narrowed
view (e.g. in theory, a message should disappear if it is edited such
that its subject doesn't match your narrow or it no longer matches
your search).  I think I'll just open a trac ticket about that once
this is merged, since it's a little hairy to deal with and kinda a
marginal use case.

Also it's not pretty, but that should be easy to tweak once we get the
framework merged.

Conflicts:
	tools/jslint/check-all.js

(imported from commit 2d0e3a440bcd885546bd8e28aff97bf379649950)
2013-05-20 23:40:57 -04:00
Tim Abbott d467a93877 Add support for updating messages after they've been received.
Currently the interface for editing messages is limited to a
command-line API tool; it's great for testing with e.g.:

./api/examples/edit-message --message=348135 --content="test $(date +%s)" --site=http://localhost:9991 --subject="test"

The next commit will add a user interface for actually doing the editing.

(imported from commit bdd408cec2946f31c2292e44f724f96ed5938791)
2013-05-20 23:40:26 -04:00
Leo Franchi 0846ebd4b5 Revert use of rest_dispatch for beanstalk
For beanstalk we need to provide a decorator that converts %40 to @ in the
http basic auth part of the URL. However, if we put our own wrapper around
rest_dispatch, the Django CSRF protection jumps in. This requires us to put
@csrf_exempt on our extra dispatch function, at which point we might as well
have avoided rest_dispatch in the first place and put a @csrf_exempt decorator
on our api_beanstalk_webhook.

(imported from commit b1f459aad26a5b80cce93f6c859240a53c11cc22)
2013-05-20 23:37:58 -04:00
Leo Franchi cf3f62185c Handle unknown JIRA event types
(imported from commit 3760002996bac0a4c2b7b4cc8bff2026fb11978a)
2013-05-20 23:37:57 -04:00
Leo Franchi 3197a7fb89 Use rest_dispatch for beanstalk API
(imported from commit 9c261f648b39bb472718bbc763fd15883cbda4e9)
2013-05-20 23:37:57 -04:00
Waseem Daher 4480693f1a Signup page to collect beta customer info.
(imported from commit ce4e860aa6781aa74ca954c79ae133aa50a057f1)
2013-05-20 23:29:55 -04:00
Tim Abbott 56949b4788 Create subscription objects in bulk by user_profile.
This, combined with acrefoot's work on sending the notifications in
bulk, resolves trac #1142 -- we do only 10 database queries and the
whole operation completes in about 300ms on my laptop.

(imported from commit 36b5bb836bc6c713903d1ca72e39af87775dc469)
2013-05-20 23:29:54 -04:00
Zev Benjamin 0f6c9e7b6f search: Handle quoted, multi-word queries
This does the simple thing, which will work as long as the phrase
doesn't have any punctuation and contains the exact text being
searched for.  We really want phrase search (check if the lexemes in
the query occur in sequence in the input lexeme string), but Postgres
doesn't support that natively.

(imported from commit 67bf36883ed21743fcad3f02ad5b319ab188f816)
2013-05-17 01:02:35 -04:00
Leo Franchi 1902f6f149 Handle any malformed JSON input instead of just an empty body
(imported from commit a8a99173697ab6fb1ec60cf499e40cde8b8549d5)
2013-05-17 01:02:33 -04:00
Leo Franchi 9ffbc6d4ab Gracefully handle a jira POST request with no content
(imported from commit d11eb4462216c5344f1231bf92159bad84a8a583)
2013-05-17 01:02:33 -04:00
Tim Abbott c7f44f97d6 rest_dispatch: Apply process_as_post automatically.
(imported from commit 35a4710e2050efe268ed6d2e63a41eea1ebc1d24)
2013-05-17 01:02:33 -04:00
Luke Faraone 96048ca140 Record the realm of users in Mailchimp
THE CENSUS OF HUMBUG

Now it happened that at this time Waseem Daher issued a decree that
a census should be made of the whole users of Humbug.

This census -- the first -- took place while Faraone was governor of
MailChimp, and everyone went to be registered, each to his own realm.

So Alice Humbugger set out from the town of MIT for MailChimp in order to
be registered.

(imported from commit fca7714ebffd0b39b9b1337058f67975985f4039)
2013-05-17 01:02:32 -04:00
Tim Abbott b8e1809f94 Fix is_super_user_api for REST API.
(imported from commit 94ba18656ca3b0636da9d5ca7969872b31ae970b)
2013-05-14 15:18:21 -04:00
Jessica McKellar f37540bbda Add onboarding UI functions for displaying and completing setup items.
(imported from commit 9ba9cb09d5ad2845ceeda436f89f7d22a19c3fbc)
2013-05-14 10:27:40 -04:00
Jessica McKellar c6da73ade9 onboarding: add endpoint for updating your onboarding steps.
(imported from commit 30c326b50cd2273099aa464f2d9502f929a3d48f)
2013-05-14 10:27:39 -04:00
Zev Benjamin c9114eef9d Add json queries for creating and fetching user bots
(imported from commit f745a705dedca66cf671ef19d7bc5f46ce70a306)
2013-05-11 02:38:32 -04:00
Luke Faraone e18d76f4dd Readd a default for enable_sounds in json_change_settings.
Previously a default was missing from this function, which resulted in
users being unable to change their settings if they tried to disable
sounds.

(imported from commit 2dae67dcb2e8cb986abb6dee9659be2192993dd9)
2013-05-10 15:15:57 -07:00
Tim Abbott f1b5d69622 decorators: Replace POST with REQ everywhere.
It's strictly more functional, and having a single arguments
extraction decorator makes our codebase less confusing.

(imported from commit 2a5618c04b486268a462a24a1481ac030f15eac4)
2013-05-09 10:35:49 -04:00
Leo Franchi 4173862833 Send notification with missed message to users if they received a PM while offline
This is configurable in the user's settings on Humbug

(imported from commit 80bf6d7a6f0dc3811117548e2225865db8b533d9)
2013-05-09 10:35:48 -04:00
Tim Abbott 74148518b4 events: Fix the requesting client type being always internal.
(imported from commit b03bee006547ee811c2f0af66d82dfe6bc4331fc)
2013-05-09 10:35:47 -04:00