Commit Graph

4835 Commits

Author SHA1 Message Date
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 0cc9960ff5 compress message dictionaries in memcached using zlib.
This decreases the average size of the message dicts in memcached by
about half, without any significant change in the overall performance
of the query.  Since these message dicts are a significant fraction of
what we put in memcached, this seems like a worthwhile optimization.

(imported from commit 3896328074aa4344b8ac7c7ba7685f0a167ec7ad)
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
Tim Abbott 678dd502ef Add command-line tool to profile get_old_messages requests.
(imported from commit bd7fc27b0c6fc1ae4f82bb74763736f9163b90bf)
2013-06-24 10:17:09 -04:00
Zev Benjamin 90f4b1f227 Preserve the hash when reloading
Previously, if you were narrowed when we reloaded you, you'd be
kicked out to the home view.

(imported from commit c00f1b92c9a4f559998463e141a402b69873fd56)
2013-06-21 16:24:12 -04:00
Kevin Mehall 4f5b4fdb67 Bugdown: Elipsis followed by TLD should not be linkified. Trac #1388.
(imported from commit 3929e4bc68872e5f5ed58f35dd1b4eb53a2e5990)
2013-06-21 15:33:17 -04:00
Waseem Daher 0c01274989 Revert "Slight cleanup of registration page."
This reverts commit 91b4577c20afaf3ee9f5bed7f4e3451020960cf5.
Upon discussing with acrefoot, my new conclusion is that
the page should only look this way if you're going through
the workflow outlined in Trac #1391 -- otherwise it should
remain the way it is.

(imported from commit 57a1989d73526a357b47a4ac68dc911e8f2531cf)
2013-06-21 14:31:40 -04:00
Zev Benjamin bf9ad1874e puppet: Run pg_backup_and_purge.py nightly
(imported from commit 98555b970533adc3c60377490074607da9f78efb)
2013-06-21 14:08:57 -04:00
Zev Benjamin 15d13f8f40 puppet: Add script for doing Postgres base backups and purging old backups
(imported from commit 93a92729b2e964e054aa1af7bcb8a0bae3fd1b33)
2013-06-21 14:08:57 -04:00
Zev Benjamin 33b3b1fa62 puppet: Switch which S3 bucket we backup Postgres to
The old bucket was versioned and didn't allow deletes.  This was
great for paranoia, but not so great for being able to delete old
backups.

(imported from commit be79b5c582ca5ee466cdfea6d3093b6d5ba0e23d)
2013-06-21 14:08:57 -04:00
Zev Benjamin 1b6514b89f puppet: Use the correct Postgres archive command
I hadn't changed it previously out of paranoia in the case we had a
faulty failover and had two masters both uploading to the same place.
However, I now don't think this can happen, as recovery completion
will cause Postgres to start a new timeline.

(imported from commit d58f1aa306eff4f6fd950664ff658539c1249bdf)
2013-06-21 14:08:57 -04:00
Zev Benjamin bf82fadc95 puppet: Move /tmp to local storage on Postgres master servers
(imported from commit eae0a31faad6d95c8e2b55c11481aa19d7e108f2)
2013-06-21 14:08:57 -04:00
Waseem Daher 316d4e9220 Slight cleanup of registration page.
(In anticipation of the implementation of Trac #1391.)

(imported from commit 91b4577c20afaf3ee9f5bed7f4e3451020960cf5)
2013-06-21 11:57:48 -04:00
Michael McCanna 425a247569 Fix path injection for tools/review
(imported from commit 25bac426b71a55f29faa232dcac1d957f2941182)
2013-06-21 11:44:40 -04:00
acrefoot a37b08db58 In-Browser Notifications
Some browsers don't support desktop notifications. Some people haven't allowed permissions
for humbug to have desktop notifications. This is a poor man's attempt at desktop notifications.

We are adding the bootstrap-notify package (http://nijikokun.github.io/bootstrap-notify/)

Resolves Trac #1336.

(imported from commit 6a54f7d1875e765dabd32d94ada8ebe4474a3d71)
2013-06-21 11:44:25 -04:00
Jessica McKellar 05bbfb42a9 Make bankrupting more resilient against regular pointer updates being in flight.
(imported from commit 90e1dc16e7d3295b6ed3f5993fe82ac4fcd2d7cc)
2013-06-21 11:00:44 -04:00
Jessica McKellar 24b41351a6 Clean up the message we display while bankrupting you.
(imported from commit 007c97eded421a021cd6aefb7f38fe8f4946b26c)
2013-06-21 11:00:44 -04:00
Jessica McKellar e0b109c6ae Remove the bankruptcy button on the Settings page.
(imported from commit 3f67422df3e96b0902b315c8d055c607e07bc533)
2013-06-21 11:00:43 -04:00
Jessica McKellar 30ab99d765 Offer to bankrupt a user if they are way behind.
(imported from commit 5483bb548a55e6cbf788b71a8885b3c990b94b77)
2013-06-21 11:00:43 -04:00
Zev Benjamin 06bff38655 [schema] Remove old Postgres full text index
We haven't been using this for months and not removing it before was
just an oversight.

(imported from commit d95c1911765a04a0c8713cc6c0dd346c123c97a3)
2013-06-21 10:58:40 -04:00
Tim Abbott 5eca964f0e onboarding: Only update onboarding checklist state if it changed.
I noticed in our server logs that some users were sending
update_onboarding_steps requests to the server every time they sent a
message -- because they hadn't finished the onboarding process.

(imported from commit 8e1751a3344149f386022d96e7893e687d6631e8)
2013-06-21 10:42:32 -04:00
Waseem Daher fd2f41cc5e Slightly cleaner hotkey help for "New X message" buttons.
The "hotkey='x'" syntax was a bit too programmery for my tastes.

(imported from commit 3b4c6f500301b4a4efc2834190f1e86e7f825c3a)
2013-06-20 18:43:19 -04:00
Waseem Daher e5dbf4240e Hide the popover title area if it is empty.
This makes our popovers-as-menus look a bit better.

(imported from commit 53b8be0a4f16fc7a7884b3fcb276a9ab85fe6f24)
2013-06-20 18:42:06 -04:00
Tim Abbott 6cc45b89b1 Revert "Hide pointer until a hotkey is used"
This reverts commit fec64815c879f9704847795cc163e2b517b4190d.

We've decided this experiment didn't work out.

(imported from commit 04f38e15c8ef19fbaa022a06bbcca3b0c67ec5ad)
2013-06-20 18:02:18 -04:00
Tim Abbott c87e12ad41 Revert "Tweak hotkey behavior when pointer isn't shown."
This reverts commit 74fb298c711e61ae98c210d0ed11c875ce6ba591.

We've decided this experiment didn't work out.

(imported from commit 8acd3a030b692f9397155a20a9f89e63ed6a6cf7)
2013-06-20 18:02:18 -04:00
Tim Abbott e55eb53297 Use get_user_profile_by_* functions to get UserProfiles.
We had a few bugs where we were using a raw Django database query to
get a UserProfile object.  This might seem OK, but going through
memcached is more efficient, and also guarantees that we get back the
.select_related() version of the object, so that if we later access
related fields like user_profile.realm.domain, we don't end up doing a
second database query as well.

Fixing these should in practice save a substantial number of database
queries on handling update_status_list requests, which happen very
often and access user_profile.realm.domain.

(imported from commit 0a2027da1b5bbc7a4f6c6927aca498530d7a4977)
2013-06-20 17:57:06 -04:00
Steve Howell 2ee31f46cb Enforce timely tests more aggressively.
(imported from commit b14e484bd72f0fa19b246efeec64815633217a2f)
2013-06-20 16:52:16 -04:00
Steve Howell 92539daa99 Enforce timely test completion.
(imported from commit f2e3ff32b7372cc916cc60ba04abcb90c39197e2)
2013-06-20 16:52:16 -04:00
Steve Howell fac3b756b7 Add decorator to annotate slow Python tests.
(imported from commit adab5330e7f14f38da6755648ae7741fde48d852)
2013-06-20 16:52:16 -04:00
Leo Franchi 468bbf216d Add a new window.bridge call for unread pms
(imported from commit 098c31dbd69c4c020e4c093095e4c78723db0bb1)
2013-06-20 16:23:30 -04:00
Scott Feeney eb3281b193 Update a comment mentioning PipelineCachedStorage
(imported from commit 7b4029db2831538e3077a2f090804da418e13d38)
2013-06-20 16:20:52 -04:00
Steve Howell ca144b5297 Eliminate MyResult class by calling test method directly.
Instead of calling test(result), we emulate the behavior of
calling SimpleTestCase.__call__, minus the results protocol.

(imported from commit e12e3d5caa8726c050a2a7cfa583ca4d571d6cbb)
2013-06-20 13:42:32 -04:00
Steve Howell 1e48388728 removed obsolete comment
(imported from commit e04378869834189c26579727fb7727e63e2e1b5d)
2013-06-20 13:13:39 -04:00
Steve Howell 0e40dc9fc6 Print "Running <test>" from within run_test(), not MyResult.
(imported from commit c8e150c5bd56eabd60c167c207655efc2059d6af)
2013-06-20 13:13:39 -04:00
Steve Howell 618ec40ef7 Import time module at top of tests.py
(imported from commit daf6d20f0c452a51b0485c7dca01d1e541661fd5)
2013-06-20 13:13:39 -04:00
Steve Howell cdc095c3b3 Extract run_test() method in back end tests.
(imported from commit 264bf689b282fccf8b4e423060fe0c4d2708b934)
2013-06-20 13:13:39 -04:00
Allen Rabinovich e0c05ea7a9 Prevent buttons from stacking in a narrow window by removing their text labels
(imported from commit ab1526e12d7fea0dd791ae02f419ab65d7430e30)
2013-06-20 09:24:40 -07:00
Zev Benjamin 86b450ca06 Remove trailing whitespace
(imported from commit 1770beb3936b3f3290e3fde3a2548c7ea60cd503)
2013-06-20 12:21:42 -04:00
Zev Benjamin 0754430c86 Make portico pages structurally valid HTML
There were a few things the W3C validator complained about that I
didn't bother fixing (like img tags without alt attributes and
obsolete tags).  There also a few pages that were slightly more
annoying to get my local instance to render (like the 404 and 500
error pages), so I checked those by eye.

This does not cover the actual app at all.

(imported from commit 1cbe1ec11067e96718814ec23eaf5a8b4b68ef19)
2013-06-20 12:21:42 -04:00
Zev Benjamin 552347ac52 Grammar nit
(imported from commit cbb20cb7114c8fe4bc2a5021f35be55dc12ac4dd)
2013-06-20 12:21:42 -04:00
Zev Benjamin 0e330e7d7e Add mixpanel badge to the front page
Displaying the badge gets us a bunch of free mixpanel data points/month.

We only display the badge on the login page (which `/` redirects to)
and not on other portico pages.

(imported from commit 75871173a10ae888fdb7c92fe8e20586ce60c6bf)
2013-06-20 12:21:42 -04:00
Zev Benjamin d8f1413bc4 Rework bottom navbar styling
This just makes the markup on each list item more consistent.

(imported from commit d12f6ef503b6da10c39aaaadcf2c6d359e9d0d47)
2013-06-20 12:21:42 -04:00
Zev Benjamin 8921621621 Make our portico bottom copyright and navigation stick to the bottom of the page
We use the technique described here:
http://ryanfait.com/resources/footer-stick-to-bottom-of-page/

(imported from commit 108f3c9cc4ce9dbf483ff76d6f9a6a014077da56)
2013-06-20 12:21:42 -04:00
Allen Rabinovich 8ea3dc285d Fix for an overlapping scrollbar in streams list
(imported from commit f07114e06745b9dd7e8b31eec61d21a1914c22c6)
2013-06-20 08:43:32 -07:00
Tim Abbott 47255e9cd8 Fix buggy key computation in cache_with_key.
The refactoring to use the cache_get() method incorrectly didn't
remove the addition of KEY_PREFIX inside cache_with_key.  The result
was that the KEY_PREFIX was being added twice, once by cache_with_key
and again inside cache_get.

This had the impact of causing pointer saves to not take effect,
because our attempts to update the memcached cache when we save the
UserProfile object were using the correct cache key, but the actual
code reading values out of the caceh wasn't.

(imported from commit dcea000833f00622bdc0249488de3b186a7417b2)
2013-06-20 10:57:32 -04:00
Steve Howell c5631eb489 Make test_emoji about 500ms faster.
The test_emoji test makes sure that we build the correct image
tag for all of our emojis.  It's the same underlying algorithm
for all 800+ images, so we now test it in O(1) times instead
of O(N) time.  Randomly sampling the emojis makes the tests
slightly non-determinisitic in a theoretical sense, but not in
a practical sense.

(imported from commit c78b50072953f2c081fca0272b9ecf762a4802db)
2013-06-20 10:24:40 -04:00
Steve Howell 07afbabb79 Double speed of Python tests by removing fixtures code.
(We don't need the fixtures code once we override Django's
run_suite() method not to clobber our test database, since
all our tests use the same data anyway, and since Django
runs all the tests in a transaction and rolls back their
changes.)

(imported from commit d9daf09be3967de2de30934173b882d3d6b9ea27)
2013-06-20 09:41:34 -04:00
Steve Howell 3c79f6fa53 Make RateLimitTests less brittle to speedy tests
(imported from commit 1b81356d90bdb19b0550363aebb2f1426d386d10)
2013-06-20 09:41:25 -04:00