Commit Graph

3120 Commits

Author SHA1 Message Date
Keegan McAllister c65f9b548f signup: Remove error / success class setting for send_confirm
Also seems to have no effect.

(imported from commit 2e2f913ee0f0f3b0620153bde68b8179ebb781a5)
2013-04-10 18:04:59 -04:00
Keegan McAllister 498ac0ed52 signup: Remove validation-failed class
It seems to have no effect and does not appear anywhere else in our repository
or in jquery.validate.min.js.

(imported from commit c4d2f730f3b680e15af17cefee34f6930e64ade0)
2013-04-10 18:04:59 -04:00
Keegan McAllister 63d739ef17 signup: Rename forms
(imported from commit cd7e90aa56da4982b627af757f8c4684f5103bc2)
2013-04-10 18:04:59 -04:00
Jessica McKellar 19d93ba970 invites: correctly focus on the email textarea once the modal is visible.
(imported from commit 97aa226f892b726e7456184a0d671e4f51079d3d)
2013-04-10 16:58:17 -04:00
Jessica McKellar 8ed1229328 invites: clear e-mails before showing modal.
Otherwise, if you get an error those e-mails are still around the next
time you try to invite someone.

(imported from commit b521a74f4d6c0d67271f804221f519d1aa7551ff)
2013-04-10 16:58:17 -04:00
Jessica McKellar 560636e372 views: remove unused imports.
(imported from commit 68f66fe79dfb72671e6a7c79bb98646ec729c701)
2013-04-10 16:57:51 -04:00
Jessica McKellar 7175dc534a Send invitation e-mails asynchronously through RabbitMQ.
This avoids 10s of seconds of delay when you invite several people at
once through the web UI.

(imported from commit 75acdbdb04caf62bbb08affc7796330246d8a00e)
2013-04-10 16:57:49 -04:00
Jessica McKellar 69753f228c hotkeys: fix assumptions that message lists are non-empty.
This fixes user-visible browser errors caused by trying to use the id
of messages in an empty message list.

One error could be triggered by trying to go to the end of your feed
with the End key during a reload.

Another could be triggered by trying to narrow to a stream or subject
using hotkeys while in an empty narrow.

(imported from commit a0e5456fd3b475aecac6eddd7104772baaf3aeb8)
2013-04-10 16:36:11 -04:00
Zev Benjamin f6a6a6b220 Add per-stream desktop notifications
(imported from commit b4a0576847b3aec1495f017ca9805febe80c9275)
2013-04-10 16:11:27 -04:00
Zev Benjamin e754479e9c [schema] Add notifications to Subscription model
(imported from commit 4d6a7aa17f3fad4b6f8fb7a100b3b578446e3625)
2013-04-10 16:11:27 -04:00
Zev Benjamin 34e9b7d4da [South] Migration to add notifications to Subscription table
(imported from commit 5f3517f755f22ba17f56e9b166cbc8c8aff16920)
2013-04-10 16:11:27 -04:00
Zev Benjamin b8a5ba56b9 Make check-box subscription settings' HTML more generic
(imported from commit 58c02449245bd03eedab1ee6eabebdbd972d1678)
2013-04-10 16:11:27 -04:00
Zev Benjamin 3424bbd8d7 Reduce client-side code duplication in setting stream properties
(imported from commit 879384fea499a2d30104d2bc1d96f16dbd867532)
2013-04-10 16:11:27 -04:00
Zev Benjamin 7e532a02ad Simplify subscription property views
This also changes the API for GET /json/subscriptions/property to
only retrieve the property for a particular stream instead of
returning all streams and their properties.  We weren't using this
functionality anywhere and the change makes the API more consistent.

(imported from commit 2799aec2550fd0558e2282beb19734d60801bdb8)
2013-04-10 16:11:27 -04:00
Zev Benjamin a2010871e3 Make subscription properties less free-form
(imported from commit eda607c2abfa51d2dadddc7b9ecba3e2d0b5be4d)
2013-04-10 16:11:27 -04:00
Tim Abbott da8fa73a92 Fix duplicate narrow.deactivate() call via hashchange on Chrome.
I noticed that on chrome, calling narrow.deactivate() actually ended
up calling itself recursively due to the hashchange code not correctly
handling the fact that in Chrome if you set

window.location.hash = '#';

and then read out the value, you get '' back out.

(imported from commit 9b5047fbe0e2ac1846e5325d066c72306634c523)
2013-04-10 11:02:35 -04:00
Tim Abbott 55f606b417 Fix scrolling bug when unnarrowing after receiving a message.
What was happening is that if you un-narrowed immediately after
receiving a message (e.g. because you just sent it), the autoscroll
animation from the zfilt table would still be running after you return
to the home view, resulting in the viewport being scrolled to an
apparently random point in the home view (even though the pointer was
still in the right place).

This cancels the autoscroll animations whenever you do one of:
(1) hashchange (e.g. to go to the settings page)
(2) select a message (covers narrowing/unnarrowing as well as keyboard hotkeys)
(3) mousewheel scroll
since those are basically the cases where we set the viewport
scrolltop directly.

Arguably this should instead be something where we somehow detect
which scroll events are triggered by what and cancel for any scroll
event not from the animation or rererendering, but that seems hard.

(imported from commit f776021303404c87b36241c733b3d1bcb083163b)
2013-04-10 11:02:32 -04:00
Zev Benjamin 5e307f9cce Fix calculation of number of active users
(imported from commit 0a74f1d8db51988ec806deb6af7cd8a6ef18d08c)
2013-04-09 13:35:09 -04:00
Tim Abbott ea95a8b167 Future-proof adding new users to default streams.
The previous code for adding users to default streams wouldn't do so
if the user didn't have a PreregistrationUser row.

(imported from commit 25f1383f6771319542d07660b29d891368889212)
2013-04-09 11:58:07 -04:00
Tim Abbott 1b11eeb2bc Simplify the default_subscriptions code path.
(imported from commit 62894a5949621465fcfd8d25372316d7ab495252)
2013-04-09 11:58:07 -04:00
Leo Franchi a9151e4bc3 Handle populate_db generating read messages
NOTE: If you are getting test failures, please run generate-fixtures --force.

(imported from commit 7b44b40e3955742edf337335deb0d92829c7e2e1)
2013-04-09 11:56:32 -04:00
Leo Franchi 57974787b3 Set messages to read in populate_db
(imported from commit 726d2015dbb446f56e5a640b44107a3713917ed5)
2013-04-09 09:59:31 -04:00
Waseem Daher 062e106400 Update Jenkins integration instructions.
Now that our plugin is in the Jenkins marketplace thing,
we don't need to have the user laboriously download it
from us and upload it themselves.

(imported from commit 25e9926f7f2314db8f3ea6c00c40514b6fd546c3)
2013-04-05 17:32:41 -04:00
Tim Abbott 807b6396e0 realm_stats: Only count messages sent by humans in most stats.
For our primary measures of user engagement, messages sent by bots can
confuse the picture (e.g. a realm could be dead, but not appear to be,
because they didn't bother uninstalling their github and jenkins
hooks).  So it's best to leave those out of our main stats.

(imported from commit 4d0f0e6442093daab164d0ed016fff1d1aa906c7)
2013-04-05 17:28:04 -04:00
Tim Abbott e1173b08df Fix check for non-default Subscription colors.
(imported from commit b904220f7b1a013081b1d680d98b15a7532f0839)
2013-04-05 17:28:04 -04:00
Luke Faraone 429edfbdcd Insert a link with a pretty file name when uploading a file.
(imported from commit 1367004792e145afa19a02417fb564ad3662f576)
2013-04-05 13:39:08 -07:00
Luke Faraone 59684c20f2 Don't insert a link of "undefined" if the process fails.
(imported from commit ba7d2c8bc9a280225862bd5edce302735d916e61)
2013-04-05 13:38:55 -07:00
Luke Faraone 28afd7126f Send test uploads to their own bucket.
(imported from commit b47628c410b7732b2b58af42b40369e01da8a250)
2013-04-05 13:07:18 -07:00
Luke Faraone 424c5b49ef Add a progress bar to show file upload progress from browser to Django.
When testing locally this bar sort of lies, because the actual bottleneck
is Django→S3.

In prod, our connection to S3 will supposudly be really fast so this won't
matter.

(imported from commit c9f4b4882cbfdf3bbb8180f1500f35d8481c1f39)
2013-04-05 13:07:18 -07:00
Luke Faraone b692e8fc99 Abort the XHR if you close the alert or cancel the compose.
(imported from commit 21540f7b290d3f55f8116f9940554a5feb8809d7)
2013-04-05 13:07:18 -07:00
Luke Faraone 932e98f456 [third] Store the XHR produced by filedrop in the calling object's .data.
(imported from commit 92d165d66e09cb8fe02652b32000850665e675e5)
2013-04-05 13:07:17 -07:00
Luke Faraone 0f10d1c6d4 Boostrapify filedrop errors.
(imported from commit b2ff2850e952f33af3e99fc14c21599f856345d1)
2013-04-05 13:07:17 -07:00
Luke Faraone f20f605376 [manual] Add file upload support.
This allows users to drag and drop content onto the compose box, storing
their data in Amazon S3.

New dependencies:
 - python-boto

(imported from commit 339874e483db5c36312c9ceae56db29da6ca0d99)
2013-04-05 13:07:13 -07:00
Luke Faraone ca1e729ea2 [third] Import jquery.filedrop.js drom http://www.github.com/weixiyen/jquery-filedrop
License: MIT

(imported from commit b523594e31e242dbb9d00cfbed12d6e455c8a6ca)
2013-04-05 13:03:49 -07:00
Luke Faraone f4d00b6af9 [manual] Push new users' data to MailChimp.
This creates a new management command, subscribe_new_users, which should be
run as a daemon process. When new users are created, an event is passed to
RabbitMQ including the following data:
 * Email
 * Full name
 * IP address of the person who confirmed registration
 * Time of registration confirmation

MailChimp strongly encourages the collection of the last two to enable
responses to abuse requests, and providing more data lowers the chance that
we could get banned from their service if complaints do occur.

To use this commit, you need to install the "postmonkey" module from
PyPI.

(imported from commit 20c628c3fa8bb985aaead85a80ad3b38bf94b9dc)
2013-04-05 10:22:26 -07:00
Keegan McAllister 36a4e587ec Fix a markup test for Python-Markdown 2.3
Apparently it no longer coalesces adjacent blank lines in a code block (which
seems like an improvement).  The new test case doesn't have adjacent blank
lines and will work on old and new versions alike (tested on staging).

(imported from commit e49902be041cf1e7d6fbe489685b966cf4eae108)
2013-04-05 13:14:00 -04:00
Keegan McAllister 3c40dd3bf3 bugdown: Fix fenced_code for Python-Markdown 2.3
(imported from commit 3954444708e222217407df228f07d2cad402a02b)
2013-04-05 13:14:00 -04:00
Tim Abbott bfd9287068 Append timestamp to URLs when getting templates on dev machines.
This prevents the templates from being cached by over-aggressive
chrome caching.

(imported from commit 1a1f7f697a823f6e806d3f2289c3bbda7e3f0d79)
2013-04-05 10:38:38 -04:00
Tim Abbott fdefa06190 Eliminate use of old StreamColor model.
(imported from commit c72a06bdc44f30fb6bca299463e259262367e8c2)
2013-04-04 17:48:51 -04:00
Tim Abbott f6affa8802 gather_subscriptions: Use the colors from the Subscription table.
(imported from commit c23829ad4141a97c61e21b970e5031eae20e24b4)
2013-04-04 17:48:51 -04:00
Zev Benjamin a701083f71 Report additional information for "message in the middle of msg_list" errors
Hopefully this will help us track down what the problem is.

(imported from commit b8e30ee23ab8f1bf93525faa4f52ce9a4ccc9013)
2013-04-04 17:42:09 -04:00
Zev Benjamin d4acc3dd94 blueslip: Add mechanism for reporting additional information
(imported from commit 738bd3b8800e3b67497755580a2b7ccf66bb3829)
2013-04-04 17:42:09 -04:00
Zev Benjamin be04cff7c1 blueslip: Don't report some fatal errors twice
(imported from commit e50a324c3fc74e076b82c6154686a98e70ebed90)
2013-04-04 17:42:09 -04:00
Zev Benjamin b7cd8db139 Small code cleanup
(imported from commit d9f09e5a9b33be0b23ddae072a3021bb01a3de3e)
2013-04-04 17:42:09 -04:00
Leo Franchi 8fe82085c4 [schema][manual] Automatically subscribe users to default streams only after tutorial
(imported from commit 6511851c0aee2628bef597bf1310d6f96b0fd1d4)
2013-04-04 17:11:39 -04:00
Tim Abbott 7ce6154464 Set UserProfile to be the AUTH_USER_MODEL.
(imported from commit 92bf66b3e6a8ed06054bd491bcc96ef422a1fbe1)
2013-04-04 15:45:44 -04:00
Tim Abbott a1aae4a39f [South] [schema] Add an index on Userprofile.email.
We accidentally lost this when we did the User/UserProfile merge (this
commit also deletes the old code to add the auth_user index in
do-destroy-rebuild-database).

This below is mostly just notes for future reference, but when
deploying this change to staging, we should consider running the
following instead of using the migration directly:

CREATE UNIQUE INDEX CONCURRENTLY zephyr_userprofile_email_uniq ON zephyr_userprofile(email);
ALTER TABLE zephyr_userprofile ADD CONSTRAINT zephyr_userprofile_email_uniq UNIQUE USING INDEX zephyr_userprofile_email_uniq;
CREATE INDEX CONCURRENTLY zephyr_userprofile_email ON zephyr_userprofile(email);

But I think it might be the case that it's fine to just run it
directly, since the ALTER TABLE part seems to hang if there's an open
transaction working on a UserProfile object anyway.

(imported from commit 1bf34ce242de51e97c91c8bab86b6b273e17fb43)
2013-04-04 15:45:42 -04:00
Tim Abbott 33562adc4f Update subscription color migration to run on sqlite.
(imported from commit 8ca8d36b390d4afb85fca725b0ba2fb539438a0d)
2013-04-04 15:25:43 -04:00
Tim Abbott 0ee684a4b5 [schema] [manual] Add colors to the subscription model.
This is preparatory for removing the StreamColor model, so we also set
things up so anything changing the StreamColor model changes the
Subscription model too.

The manual task is to run the copy_colors.py management command after
deployment to each of staging and prod.

(imported from commit 1be7523ca59f5266eb2c4dc2009e31209ed49635)
2013-04-04 14:17:01 -04:00
Tim Abbott b06284717c [South] Migration to add color to Subscription model.
(imported from commit 0dc8c5924b6398ea73e90c5322dd4fd1beddccf1)
2013-04-04 14:17:01 -04:00
Reid Barton 94c46a0af2 Tutorial punctuation tweaks
(imported from commit 0097cfad492de2658a2ab8a08fba0844ec6ba3fa)
2013-04-04 14:11:15 -04:00
Zev Benjamin 9d1548fe08 Add empty feed notices for private messages
(imported from commit e4067336f6b2e9e82b794599d30dfc3825852652)
2013-04-04 11:36:51 -04:00
Zev Benjamin de1f4b0be2 Remove all inline event handlers
This allows blueslip to catch exceptions from the event handlers on
these elements in addition to the other benefits that not using
inline handlers provide.

(imported from commit 2bdcb2496c6c08fa7228a20ce6164b527cf64e41)
2013-04-04 11:34:32 -04:00
Zev Benjamin 79d0e78130 Remove extraneous delete statement
The close handler will be called on cancel anyway, so we don't need
to delete in the click handler.

(imported from commit 0fcf4b0d1408312a0889f2b69e01207c9c3835fa)
2013-04-04 11:34:05 -04:00
Zev Benjamin a6058c40ad Wrap hashchange event handler with blueslip wrapper
(imported from commit 96ed0681964d36e13878e09a3f58a65c5a993aa0)
2013-04-04 11:34:05 -04:00
Zev Benjamin a2a48a5d95 Expose blueslip's callback wrapper
(imported from commit e8b2139519254ac9f3a9ec6031c5134c4d6c0fef)
2013-04-04 11:34:05 -04:00
Zev Benjamin 0e4aa6727b Convert to string before using string methods on search operators
Previously, narrowing to a stream name that only contained digits
would throw an exception.

(imported from commit dc76877427078d70e3d5625622c665be3302c976)
2013-04-04 11:34:05 -04:00
Luke Faraone 86d794c3f8 Updating the pointer is logically a PUT, not a POST.
(imported from commit 191582008c15861639acd882742f22b3fd17445a)
2013-04-03 15:35:59 -07:00
Luke Faraone 3fd2bfa19e Don't convert to POST vars if POST is already populated.
Otherwise you could encounter errors if you POST to a method
with this decorator applied.

(imported from commit bcb31f336ea2a1eeee6b9e3e9dfeed1d205ae26a)
2013-04-03 15:35:59 -07:00
Luke Faraone 50809ca219 Rename process_patch_as_post to process_as_post for generality
(imported from commit c920216176a8b6d4b0172a60b6e65df6a58fc79a)
2013-04-03 15:35:58 -07:00
Tim Abbott fa239ea270 hashchange: Don't change the hash when called from hashchange code.
I generally don't like this sort of state variable, but I don't see a
better solution.  The codepath is that when you start out on the
subscriptions page and then click one of the left sidebar links to
narrow to something:

(1) hashchanged() would call ui.change_tab
(2) ui.change_tab triggers a gear change event
(3) The ui.js gear-changed event handler updates the hash

Resulting in the hash ending up at "#".  Since there's no easy way to
pass arguments through to the event handler, we just use a global
variable inside hash_change.js to track whether we're currently
handling a hashchange event.

(imported from commit 7bb905a223b5539240fc36de7896ee8074ebc62e)
2013-04-03 14:49:32 -04:00
Tim Abbott 200fd7ff70 Fix clicking on streams in left sidebar from subscriptions page.
We previously had 2 mechanisms for narrowing used by the left sidebar
-- the top few links used the hashchange mechanism, while the streams
links used a custom click handler.  Both were buggy -- the hashchange
one hadn't been updated to just select the first unread message,
whereas the click handler didn't change tabs.

Fixes #1141.

(imported from commit 8a8af974e78cc5c33937ac0078f04a9b5452b94a)
2013-04-03 14:15:07 -04:00
Tim Abbott 3a93c8cc90 Fix pointer jumps on unnarrowing after certain scroll events.
This appears to have been caused by our code for preventing the
viewport from being recentered if you move the pointer away from the
edge of the viewport from a position near the edge, which was being
run even when it was not triggered by a scroll event.

(imported from commit 0a4b3dcca75a6e5dbf1beb77a5249bd6a9c61341)
2013-04-03 13:38:41 -04:00
Tim Abbott 11ad134f7b Fix directional hotkey calculations for Home and End keys.
The old directional hotkey calculation system was fragile, and because
of this, didn't scroll when you used the home/end keys.

(imported from commit dca4786de13a4ed2864600dadbf4b1a5ba848074)
2013-04-03 13:37:23 -04:00
Leo Franchi 2f09492e71 Don't scroll to a message if there are no messages loaded
(imported from commit 8b881713595f60b3a989cb2c6875444e80c736d4)
2013-04-03 11:33:20 -04:00
Leo Franchi d8bed8dc08 Update integrations copy to mention %40 hack
(imported from commit 3b952309289204317a2a5ba57ba17e75ae9732ac)
2013-04-03 10:21:06 -04:00
Leo Franchi aef86a8d45 Use form POST data for beanstalk and add shim for incorrectly-encoded emails
(imported from commit b5debaa02a6a23c01aee1b2beb6fd83e70e50d65)
2013-04-03 10:21:06 -04:00
Leo Franchi 0055107cfd Use IANA's TLD list for auto-linkification detecting
(imported from commit 9103fdc92405b92300a793bd1d4f493df64b5b9c)
2013-04-03 09:58:17 -04:00
Leo Franchi a5643efa14 Allow @ in urls
(imported from commit cb2ffe4a8f050e732bb06ab4609997be35577417)
2013-04-02 18:38:38 -04:00
Leo Franchi d127d6f19f Support up to one level deep of nested parens in urls
(imported from commit 3f314b16a47b5267ddb0d18aa6c5456656895f77)
2013-04-02 18:38:38 -04:00
Keegan McAllister 191231ab3d bugdown: Whitelist URL schemes
(imported from commit 76e22cec3918c00faaa903baae74915cc5e64264)
2013-04-02 18:38:38 -04:00
Keegan McAllister 5d538d7a2a bugdown: Allow colons in URLs
(imported from commit b57fc21f4508f2bff3cbc32a6359de686aa3a96e)
2013-04-02 18:38:38 -04:00
Zev Benjamin c8acdfb228 Make the default for API-users be apply_markdown=False
This fixes a regression that was introduced when rebasing the event
system branch.

(imported from commit da575e96ebdb4dbcca3a658a10a0f81628f9317c)
2013-04-02 17:04:26 -04:00
Tim Abbott 51911d304d generate-fixtures: Run after schema changes even without --force.
(imported from commit 1daff2ee6746c4036c3cc71746ad59e18b5a331e)
2013-04-02 16:27:13 -04:00
Keegan McAllister 5ebd281f38 Serve only the runtime part of Handlebars in prod
(imported from commit 8e55cb99deff680c832502396625b8cb1054e0cb)
2013-04-02 14:44:27 -04:00
Keegan McAllister 9dd987be7e Precompile Handlebars templates in production
Fixes #908.

(imported from commit 30458e9bea8117d1fa15dc962bb1a495f22672cc)
2013-04-02 14:43:59 -04:00
Keegan McAllister 17d5406b55 [manual] Fetch Handlebars templates using Ajax
...rather than embedding them into index.html.

This is only acceptable for dev, but the next commit adds an alternative
mechanism for prod.

There isn't actually a manual deployment step here.  However, this commit won't
work on staging / prod without the next one (since we don't serve
zephyr/static/templates in prod).

(imported from commit dce7ddfe89e07afc3a96699bb972fd124335aa05)
2013-04-02 14:43:58 -04:00
Keegan McAllister 37c5e1acd5 Upgrade to Handlebars 1.0.0-rc.3
Not needed for any specific reason, but we will need the .runtime.js file
eventually, and we should use a version of the library that matches the
Handlebars compiler.

(imported from commit 5600bc8d44b681999e2e5bbf04b890e2bb8477a1)
2013-04-02 14:43:58 -04:00
Leo Franchi 8a9b125e11 Add github fixtures file
(imported from commit 41d4ad13e4c5720219b490abdd52b3b93070e586)
2013-04-02 14:21:58 -04:00
Zev Benjamin 369d9ab9e7 Add additional URLs for get_updates activity
(imported from commit 820f0f48abbe99d0ab4a769f8c2f4cafa56dc050)
2013-04-02 14:18:33 -04:00
Zev Benjamin 649119ead5 Allow specifying multiple URLs for a given query name in ActivityTable
(imported from commit 1a3313d27168447025d0c98d72d2f6ab0c32587e)
2013-04-02 14:18:33 -04:00
Zev Benjamin 99f98f77b6 Refactor activity data-gathering a bit
(imported from commit 6d36bf19c5ba70cc4d29bf7340e4c6a7349f1083)
2013-04-02 14:18:33 -04:00
Tim Abbott fa20696230 do_add_subscription: Don't unnecessarily fetch subscription from the database.
(imported from commit ffe2c8d2026b60a91dd54f10cfd9df0adbfd7acd)
2013-04-02 14:01:54 -04:00
Tim Abbott 2a46c46fa8 set_stream_color: Pass color to get_or_create.
(imported from commit 0d5f1fd227fd6dc337291d2d07ba24f96080e9e2)
2013-04-02 14:01:54 -04:00
Leo Franchi 1c4ca370f2 Add a test for our github service hooks
(imported from commit 400f1ca1e2eb16b0f496cb7f5598613e19ed3a83)
2013-04-02 13:43:13 -04:00
Leo Franchi e727caa4e8 Add integrations blurb about Beanstalk
(imported from commit e8f952dd9614fd050891275084e5b2f7be1471c4)
2013-04-02 13:35:43 -04:00
Leo Franchi a406aeadc8 Add beanstalk integration along with tests
Beanstalk integration uses webhooks that use http basic auth to authenticate
the sending user.

(imported from commit bd65f5b2d052a3c1eb04da64d055a3640a384892)
2013-04-02 13:35:42 -04:00
Tim Abbott 6448428a9e [schema] Remove User model.
(imported from commit bc182e6e947c3b3f09382e890e3751c2f4021a58)
2013-04-02 13:24:33 -04:00
Tim Abbott 1a4047cb95 Remove User migration tools.
(imported from commit 928124d5a8056d5cb1736cfc4c7158c228437c1b)
2013-04-02 12:57:15 -04:00
Tim Abbott 1cec86eb2d [manual] Remove now-unused User model.
I think all that one needs to do to deploy this commit is on developer
laptops, run `generate-fixtures --force`.

(imported from commit 34916341435fef0875b5a2c7f53c2f5606cd16cd)
2013-04-02 12:57:10 -04:00
Tim Abbott a8e89962d8 Remove remaining direct usage of the User model.
(imported from commit c494b4e32761e9ce57115da918a86a1d6a0b6971)
2013-04-02 12:07:08 -04:00
Tim Abbott 5dbe8b4c17 [manual] Authenticate using a user_profile as request.user.
When this is deployed to staging, we need to run

./manage.py logout_all_users --realm=humbughq.com

When this is deployed to prod, we need to run

./manage.py logout_all_users

(imported from commit d6c6ea4b1c347f3d9122742db23c7b67767a7349)
2013-04-02 12:07:08 -04:00
Tim Abbott 712d931350 Remove banish_broken management command.
The bug it addresses is long fixed, and it's buggy.

(imported from commit b198a30f56f950168e3662dcea2bab7d908631f9)
2013-04-02 12:07:08 -04:00
Tim Abbott 2fcbb31dcf Access the UserProfile's new is_active field rather than User's.
(imported from commit ed5bdaf3e3d6d20bfb741efdac48d30482ab9ef7)
2013-04-02 12:07:08 -04:00
Tim Abbott 1443edce00 Access the UserProfile's new email field rather than using User.
This is preparatory for stopping using the User model.

(imported from commit a1b0808c8cc2ddd19a25163f91c4f18620c9ce90)
2013-04-02 12:07:08 -04:00
Tim Abbott 3a35c5b00c Add management command to logout all users.
This is intended to be used logging out users during our deployment of
the UserProfile merge, but it could be useful for other things too.

(imported from commit bfe896d854f997f7a4d06e5bc0f19ec5b1aa5e69)
2013-04-02 12:07:05 -04:00
Tim Abbott 303e77c07d Fix clearing of user sessions.
Previously, we weren't clearing the users out of memcached (we just
killed them in the database), so in fact users were not logged out
when we deactivated them for an hour (when the memcached caches would
expire).

(imported from commit 0f0a2f70e003c184106c73b22b876f57c1ef3371)
2013-04-02 11:56:31 -04:00
Zev Benjamin 4a8d8e6fb4 Record statistics for event queues
(imported from commit 88f30a33f0717d5ad1b22a86cf311d7b67c69bf5)
2013-04-01 17:09:22 -04:00
Zev Benjamin a73e2975d7 Add simple function for outputting statistics for use with munin
Eventually we will want to replace this with statsd.

(imported from commit 64246e9f2d13d72f53d009a5e3e456bc6be6296b)
2013-04-01 17:09:21 -04:00
Zev Benjamin 0e0b95ce83 Fix event queue pickle file location
The associated function was moved into zephyr.lib, but the file
location was never updated.

(imported from commit 24c3348533324b0af7c52d6a121eef8b00615275)
2013-04-01 17:09:21 -04:00
Zev Benjamin 6cee57b356 Fix several bugs when register() applies events
(imported from commit 5cd284c59022700de5c5d12182d2056366bf8617)
2013-04-01 15:45:14 -04:00
Tim Abbott b82edb6fd6 [manual] Add User fields to the UserProfile model.
And keep the fields updated, by copying on UserProfile creation and
updating the UserProfile object whenever we're updating the User
object, and add management commands to (1) initially ensure that they
match and (2) check that they still match (aka that the updating code
is working).

The copy_user_to_userprofile migration needs to be run after this is
deployed to prod.

(imported from commit 0a598d2e10b1a7a2f5c67dd5140ea4bb8e1ec0b8)
2013-04-01 14:34:25 -04:00
Tim Abbott 659ccc2174 [schema] Add South migration for extending UserProfile to subsume User.
(imported from commit 1f93bd1fc93bb5f2b7f144d1631428e1c5e96292)
2013-04-01 14:34:25 -04:00
Tim Abbott bd27343eba Fix incorrect use of user_id as a Recipient type_id.
This should be a user_profile_id.

(imported from commit 3d63a986a4584ba8933c4f8872ed9bb5f3928983)
2013-04-01 14:34:25 -04:00
Jessica McKellar 33a9bae5d1 Tailor empty narrow messages to what you were narrowing for.
(imported from commit 876afce2a63d4d6a522ac5300349b2be8805405f)
2013-04-01 14:26:50 -04:00
Jessica McKellar 6977920493 Don't try to auto-scroll when composing.
It's distracting, and may push messages you care about out of view.

(imported from commit 585d013c18d392433e432fc37bc02b4055822915)
2013-04-01 14:26:50 -04:00
Zev Benjamin ee9f040040 Handle subscription events in the web client
This has the nice side effect of not requiring us to trigger the
events manually in the success callbacks of our subscribe/unsubscribe
ajax calls.

(imported from commit e8d9970b708e9832d22be4803570071bacb46792)
2013-04-01 13:07:48 -04:00
Zev Benjamin 73af933f1f Handle the result of subscriptions by Javascript events
(imported from commit 7b564b1bf076581034021052fa5e2da20cf405c5)
2013-04-01 13:07:48 -04:00
Zev Benjamin 2c08fcca3a Send an event when a subscription is added or removed
We don't yet send events on property changes, though.

(imported from commit 741e6aff7c6ce8b6a1fa48e4d95317d345c6993d)
2013-04-01 13:07:48 -04:00
Zev Benjamin bd81706558 Handle realm_user events in web client
We currently only use these events to change the autocomplete lists.
I figure that the presence list will be updated by presence events.

(imported from commit e9c1466659c4bfd463806656e0023984a4ea4177)
2013-04-01 13:07:48 -04:00
Zev Benjamin fe45b1c8ad Send an event when a user joins or leaves the realm
(imported from commit fcedba2d9a3e8968e93faa396113cddd5bf36a9d)
2013-04-01 13:07:48 -04:00
Zev Benjamin f5d3d15d6b Don't send notifications if we don't have a Tornado server
This is the case when running the backend tests.

(imported from commit 8c69c4b6ec72b36f0e90b06f75a010e993c46e03)
2013-04-01 13:05:57 -04:00
Keegan McAllister 33ac53b849 tests: Reinstate star tests
(imported from commit f61762b0296922ee72e1304718044d5df78abd12)
2013-04-01 11:03:17 -04:00
Keegan McAllister c1a0309bb4 tests: Test more ways of narrowing / un-narrowing
(imported from commit 470b9fb5fc7e418944fee577d510d4ee0a78cd68)
2013-04-01 11:03:16 -04:00
Keegan McAllister 50ef0a6edb tests: Move page console.log support into common.js
(imported from commit e875e67ad44ef10d9d84671a14a4d1755c0154df)
2013-04-01 11:03:16 -04:00
Keegan McAllister 0263bace8a tests: Factor out message checks in 02-narrow.js
In anticipation of testing several UIs for narrowing.

(imported from commit 9403be5550de4f4503933aa03dc45335a7f3fc63)
2013-04-01 11:03:16 -04:00
Keegan McAllister bd85af4d02 tests: Move narrowing tests into their own file
(imported from commit 673fb5f862d08de1dfff1abb8db5efb76039e1ba)
2013-04-01 11:03:16 -04:00
Keegan McAllister 5015c77b33 tests: Clean up code for sending multiple messages
(imported from commit 194490a764d05408e9849bd3a80552c7173f5112)
2013-04-01 11:03:16 -04:00
Keegan McAllister 7e348783e6 tests: Update comment about common.keypress
(imported from commit c58d850ba4fa291e62ffdf56d8e647688940a3ed)
2013-04-01 11:03:16 -04:00
Keegan McAllister 83f1071259 tests: Move more helper functions to common.js
(imported from commit 2a4e2acda367f087acee69f46b6542e3762f5000)
2013-04-01 11:03:16 -04:00
Keegan McAllister b2dea39fad tests: Remove initial dummy message workaround
I can't reproduce the problem this works around anymore.  If it comes back,
let's debug and figure out what's happening.

(imported from commit 26096405a93a530e449c9f1f60d8110b1bb0e96b)
2013-04-01 11:03:16 -04:00
Keegan McAllister 8e6587e92f tests: Use common.js in 00-login.js
(imported from commit b4f3150ee9bbb2c37c3bd5cb0032d8d210d8e976)
2013-04-01 11:03:16 -04:00
Keegan McAllister b09c829fd6 tests: Move common initialization into casper.start
Otherwise it fails when common.js is used by the very first test.

(imported from commit 5299072a62c63202c641b2a11b40aafb9c89e13e)
2013-04-01 11:03:15 -04:00
Keegan McAllister 0c3e21e4b2 tests: Split subscriptions and settings page tests into their own files
Delete star tests for now and restore them later -- it's much easier
this way.

(imported from commit 0572aa64b39d73fddb40b57db554e1f0f14973af)
2013-04-01 11:03:15 -04:00
Keegan McAllister d6810efc90 tests: Fix URL test for new event system
(imported from commit 07671e9a8b678a725b5f49ed755f008107734251)
2013-04-01 11:03:15 -04:00
Tim Abbott 7bae0bb75a populate_db: Fix User/UserProfile confusion in personals sampling.
We were incorrectly using User objects, rather than UserProfile
objects, for fetching Recipient objects for generated messages.

(imported from commit c3dfe52f4e0a68400e22ca49293b5bf2d6986402)
2013-03-29 16:18:38 -04:00
Tim Abbott dc5839f66d tests: Fix User/UserProfile confusion in filter_by_subscriptions path.
Our testing code had a number of places where it was using User
objects where it should have been using UserProfile objects --
e.g. using a User id as the type_id in a Recipient table.  This commit
addresses this in the filter_by_subscriptions code paths.

(imported from commit e305bc8e2a8bdbfd04c93c59d56955e7971552af)
2013-03-29 16:18:38 -04:00
Tim Abbott 9317035fc7 Add hashed_password argument to do_change_password.
This way we're not directly manipulating user.password() in random
management commands.

(imported from commit e6e32ae422015ab55184d5d8111148793a8aca36)
2013-03-29 16:18:38 -04:00
Tim Abbott 80747567c0 Remove test_deactivate.py management command.
It is a less-featureful duplicate of deactivate_user.py.

(imported from commit d40fe8cc30284745aa267601b4855572bbe0e26a)
2013-03-29 16:18:38 -04:00
Tim Abbott 198480ef99 Use get_user_profile_by_email more consistently.
The previous situation was bad for two reasons:

(1) It had a lot of copies of the code, some of them missing pieces:
  UserProfile.objects.get(user__email__iexact=foo)

This was in particular going to be inconvenient since we are dropping
the __user part of that.

(2) It didn't take advantage of our memcached caching.

(imported from commit 2325795f288a7cf306cdae191f5d3080aac0651a)
2013-03-29 16:18:38 -04:00
Tim Abbott 203e5e17ee Use prereg_user as local variable for PreregistrationUser objects.
(imported from commit 5beb09a8e589bee9e98d36059eb9e0b5ab3c4af3)
2013-03-29 16:18:38 -04:00
Tim Abbott 2223b60dc0 Switch functions like do_activate_user to accept UserProfiles.
Only a few of them took a User as an argument anyway.

This is preparatory work for merging the User and UserProfile models.

(imported from commit 65b2bd2453597531bcf135ccf24d2a4615cd0d2a)
2013-03-29 16:18:37 -04:00
Tim Abbott 9d82bb5318 event_queue: Add requests 1.x compatibility.
The previous version of our code only worked with python-requests <
1.0 (as is the case on our servers), the new version will work with
any python-requests new enough to have a .json at all.

(imported from commit 77ffe3e0d890fe88776c313e0e3289aee1bb30ea)
2013-03-29 16:18:37 -04:00
Leo Franchi e546161e8d Handle web hooks from JIRA for integration support
(imported from commit d4db0b850becf42dee6f0a9df7b19c692fef41f1)
2013-03-29 16:14:39 -04:00
Leo Franchi 9817ef3460 Remove url encoding from data-name attribute as we match via iteration
(imported from commit 737418c430991414124daff41b62383284e86dc1)
2013-03-29 15:44:21 -04:00
Zev Benjamin 36ac717872 Lower the server-side heartbeat frequency slightly so its maximum value is less than 60
(imported from commit d61e12a985d833843c9ae757465701f0057d5ee8)
2013-03-29 11:11:34 -04:00
Keegan McAllister b7bb598e02 Trim search operand from the end until URI decoding succeeds
Fixes #1137.

(imported from commit a23219d2cefdc2b739a165c88780fba409d4d878)
2013-03-29 10:37:02 -04:00
Leo Franchi a8816f81c0 Comment out blueslip scroll finish error to quiet emails
A ticket is filed and this error is not fatal to the UI but rather
a warning to investigate, which we will now do

(imported from commit 3f67ec2b503e91b3921e33b89febd97790e389f1)
2013-03-29 09:38:42 -04:00
Leo Franchi 199610fe7f Add tests for unread count in sidebar
(imported from commit dc10016258bf61599ceae434623040a2a7dd5946)
2013-03-28 17:37:32 -04:00
Jessica McKellar ce66bdec5b Remove unused hotkeys.in_scroll_caused_by_keypress.
(imported from commit 65223a036e72489a41130a83e4537d0ccb80b90c)
2013-03-28 17:08:25 -04:00
Jessica McKellar 3df47f2025 Do not try to recenter if you were already moving in the right direction.
Before this commit, if you try to arrow around when the selected
message is outside the pointer threshold for recentering, you get a
big jump, even if you are arrowing towards the center of the viewport.

(imported from commit 5c15d5ccccdf027a8bfa8b79bf519fccbfa971d8)
2013-03-28 17:08:25 -04:00
Jessica McKellar 0f02eb17f4 Reduce code duplication in process_visible_unread_messages.
(imported from commit 49c36f704d9937ff06129a0b737a7d9ef32e35ed)
2013-03-28 17:08:25 -04:00
Jessica McKellar f28fe19fa8 tests: add a comment that the pygments import is still necessary.
(imported from commit c17dfc9e3b8ecf207b4cb7f4d33443122b747905)
2013-03-28 16:59:59 -04:00
Jessica McKellar 39602a4437 tests: add frontend tests for starring.
(imported from commit 6a35286cf4a1e3db9adbc14f8d6c0aa0a05b24db)
2013-03-28 16:59:59 -04:00
Jessica McKellar f050f28e05 tests: add backend tests for starring messages.
(imported from commit 5b315ad06888c60523afb666dae95287609ffa52)
2013-03-28 16:59:59 -04:00
Jessica McKellar 08422009fe Add a `Starred messages` sidebar link.
(imported from commit 0109e64b412afcd8d0d58b5e027d30c82faa970c)
2013-03-28 16:59:59 -04:00
Jessica McKellar 07967e7257 Add the ability to narrow to starred messages with `is:starred`.
(imported from commit f1eb552ddd90a1822fa988b60dc13f88f04cfc79)
2013-03-28 16:59:59 -04:00
Jessica McKellar 3d683a93bf Add the ability to toggle a message star and save it server-side.
(imported from commit 6d9eda14cddee9ce65a85deadac57925b1864f94)
2013-03-28 16:59:59 -04:00
Jessica McKellar 1e9bb457a1 Show a bookmark/favorite star on messages.
(imported from commit af34abb353f3d5b5aace59c31c073d6426b0ff03)
2013-03-28 16:59:59 -04:00
Jessica McKellar 2f560a79db Expose the `starred` flag as a client-side message attribute.
(imported from commit 3046a44e1313d0a91a1aa6ce6d166e29311a0567)
2013-03-28 16:59:59 -04:00
Jessica McKellar f1645f5fc9 Add a `starred` bit to the UserMessage.flags BitField.
(imported from commit 3998edcdafbf6b452b05aa72db86bfaafdd83e01)
2013-03-28 16:59:58 -04:00
Zev Benjamin 00e5f904a3 Use do_events_register() in home() and pass the results to the initial page load
(imported from commit 532036c01bde1f5d49c43a96ce6aa496ca77cea9)
2013-03-28 16:57:48 -04:00
Zev Benjamin 3b5bcdf80e Move the guts of event_register_backend to actions.py so it can be called internally
(imported from commit 4747942b03406e8a92f319658fcecb9720226388)
2013-03-28 16:57:48 -04:00
Zev Benjamin 0caec89fc6 Use helper functions instead of importing event_queue.client and event_queue.user_clients directly
(imported from commit 653decf415e0026439dd5d323bed361732dac2e9)
2013-03-28 16:57:48 -04:00
Zev Benjamin 0624a97d8e Force a reload when the server has garbage collected a client's queue
We have to be careful about timing here.  If Tornado fails to load
existing queues on startup then all clients will reload at once.  On
the other hand, if we don't reload immediately then the client won't
get any events until the reload.  For now, I've opted for the
user-friendly approach, so we need to make sure that Tornado gets a
chance to dump and reload its queues correctly.

(imported from commit 51a6ab31cb461e1e3373486dcec2e57eb12a8077)
2013-03-28 16:57:48 -04:00
Zev Benjamin cec9c6f30d Send heartbeat events to all clients
This effectively implements a server-side timeout for get_events

(imported from commit 4151562358329a6a5662f219ab2a9241e54ad585)
2013-03-28 16:57:48 -04:00
Zev Benjamin c6df5af84d Import tornado ioloop directly instead of passing it from runtornado
(imported from commit ce901d7daca81bb1682827175bdcd83d3e5c2344)
2013-03-28 16:57:48 -04:00
Zev Benjamin 5b20dcf03c Add server-side event filtering based on type
Clients can now request to receive only certain kinds of events,
although they always receive restart events.

(imported from commit 1e72981f8fe763829ab2abde1e35f94cad5c34e4)
2013-03-28 16:57:48 -04:00
Zev Benjamin f2b1de7940 Apply events in register()
(imported from commit 4e30e52d968ceec596ecbabe71d4d9378cc8f7d9)
2013-03-28 16:57:48 -04:00
Zev Benjamin 7248659c4c Return initial data in register()
(imported from commit 5b510ef072790b9e44652542372e3fc88735c356)
2013-03-28 16:57:48 -04:00
Zev Benjamin 22134946a4 Require clients call register() before get_events() unless they pass dont_block=True
(imported from commit f2aee3b7185ffd4642aeb23891fe681115fb0895)
2013-03-28 16:57:48 -04:00
Zev Benjamin 4bc9152f71 Inform clients to reload via a 'restart' event sent on Tornado start up
(imported from commit 10bb45547ea0bf34e56fc620ecd7415bb8a825c5)
2013-03-28 16:57:48 -04:00
Zev Benjamin e4fba59538 Make event queues persistent across Tornado restarts using cPickle
(imported from commit 1434d1e9d394d725827b1740c0c07249d5e716ed)
2013-03-28 16:57:48 -04:00
Zev Benjamin 6cc70d94f6 Add register() call to event system
(imported from commit 0c9fbfec1866591b2169ce2da2bc2af6003f8f31)
2013-03-28 16:57:47 -04:00
Zev Benjamin b12715e3f2 Make web client use get_events instead of get_updates
(imported from commit 15c007fd89f02558b710e7146fc40b785934f76c)
2013-03-28 16:49:51 -04:00
Zev Benjamin 401fa6063e [manual] Add get_events URL routing
The new nginx configuration file needs to be copied to
/etc/nginx/humbug-include and nginx needs to be restarted when this
commit is deployed.

(imported from commit 6c43f3c2c7a6acee6a852c672c96a38bda01dd0d)
2013-03-28 16:48:52 -04:00
Zev Benjamin 8f4eaa63ad Initial event system implementation
This version has several limitations that are addressed in later
commits in this series.

(imported from commit 5d452b312d4204935059c4d602af0b9a8be1a009)
2013-03-28 16:48:14 -04:00
Keegan McAllister 5a58fb3c29 Don't try to use source map in the test suite either
(imported from commit c8392c1572a09128d8b31500b3e94bb9e8888122)
2013-03-28 16:47:11 -04:00
Keegan McAllister 28f9d51aa5 Don't try to use source map when DEBUG
(imported from commit e07fbe0e185df06c98cc38dfb943036f256cb877)
2013-03-28 15:28:58 -04:00
Keegan McAllister 7236c63008 Automatically decode JavaScript stack traces as we send them
(imported from commit 348c464102a43a44c91c79d498cd33e6405ed670)
2013-03-28 14:56:52 -04:00
Keegan McAllister 1ecc063d0f Split out source map processing into a library
(imported from commit 345efcc703dc1049e31fd38a6a062bf39a589eb6)
2013-03-28 14:56:52 -04:00
Leo Franchi 0a419e51d0 Fix ui.set_count not finding streams that require url encoding in sidebar
(imported from commit c363669806f56650c6aecb66f7208ea692bfd613)
2013-03-28 14:44:57 -04:00
Tim Abbott 7685e47f07 Fix Tornado idle time logging.
When we added rabbitmq usage within Tornado, we inadvertently caused
the Tornado ioloop to be initialized in runtornado.py's imports,
before we overwrote the _poll method.  The end result was that we
weren't running the our instrumented Tornado poll function.

Fix this by moving that code to its own file which we import at the
top of runtornado.py, and adding comments documenting the situation so
we don't break this in some future import reorganization.

(imported from commit 016717476f10566fef4ed2b656f29f865d2084db)
2013-03-28 14:40:49 -04:00
Luke Faraone 799e2873d3 Run decodeURIComponent over stream names before comparing them.
This resolves an edge case not handled in a previous fix to trac #1050.

(imported from commit 3fc142946b01de8955e1b52d4f4ebb36e584cdeb)
2013-03-28 11:24:38 -07:00
Leo Franchi 23802bc278 Filter out private messages in home view when counting in home unread
(imported from commit 6b42168e880269c8fe14f0e2eab98cf03b480f17)
2013-03-28 13:21:11 -04:00
Keegan McAllister 279f0b9842 Make it easier to find the source map for app.js
(imported from commit bca27c9838573fb4b74e2d269b253a48702c9e1c)
2013-03-28 12:11:23 -04:00
Keegan McAllister f42e841ffd Add a command to annotate a JavaScript traceback with source file locations
(imported from commit 1a4d656438990b1cbefbdecc5d403573d6c5dd06)
2013-03-28 12:11:23 -04:00
Keegan McAllister aa3c446665 Generate source maps from Closure Compiler
(imported from commit 0e4de860b1dba85aa43b60a2c819ac44403186c5)
2013-03-28 12:11:23 -04:00
Leo Franchi 5b2f4462fb Only count messages in home view when determining home_unread_count
(imported from commit 22a0a00bd242a4a12efc5dca723c13f7c9b47f2c)
2013-03-28 11:44:58 -04:00
Luke Faraone 85b4ffbf2e Change matching for client strings in /activity to use __startswith.
This way we can match prefixes, like "API: Foo".

(imported from commit 2acde88e31b4f2f4a418f3930975a5f3a4e9ef2d)
2013-03-28 08:11:37 -07:00
Luke Faraone 0d51e59fd5 Implement URLs for API redesign.
(imported from commit 2020491a737ec4c1e99a63f84eb6cfc594a2dd56)
2013-03-28 07:57:38 -07:00
Luke Faraone 09c9d92149 Refactor get_messages into the _backend pattern and add rest_ method.
(imported from commit 9b1ae464a882a6fa6da2a4cfd5a6543f5d2b3e51)
2013-03-28 07:57:36 -07:00
Luke Faraone 8bb944729d Switch get_old_messages to REQ and make the function signature uniform.
Previously user_profile was a kwarg, which was inconsistent with all other
_backend functions.

(imported from commit 6b857bcb2c3c978079af2f6edd367c1804d51988)
2013-03-28 07:53:39 -07:00
Luke Faraone 7eee9d4905 Implement generic REQ class which pulls from request.REQUEST.
This is to allow flexibility in functions that we think should be callable
via either GET or POST.

As part of this, POSTRequestMock was extended to populate the REQUEST
dict.

(imported from commit b9d32d2b65ff8a25885452992cf7dd37b9664246)
2013-03-28 07:53:39 -07:00
Luke Faraone 5d22ee9a76 Create update_subscriptions_backend to allow mass mutation of user subs.
This includes a process_patch_as_post decorator which enables this view
to be invoked as a PATCH on an object.

Hopefully this decorator can go away once POST values are correctly parsed
in Django for PATCH verb invocations.

(imported from commit 6cf9d69cfb9dea5354ea37408566146757b5be54)
2013-03-28 07:53:39 -07:00
Luke Faraone 08e379d23f Add method for retrieving the pointer only.
(imported from commit 2324d3c6cddca73dddca8a24dfa8d61d41236a54)
2013-03-28 07:53:38 -07:00
Luke Faraone a49c37917a Implement generic rest_dispatch method for new API.
(imported from commit 912ee803db03098f195d18648ab98401915fead6)
2013-03-28 07:53:38 -07:00
Luke Faraone 0c0f99ccc6 Split off json_stream_exists to the _backend pattern, rename paramater for consistency.
(imported from commit 61378e9abe716552f69cf11fc0f1fce61de0639c)
2013-03-28 07:53:37 -07:00
Luke Faraone 60075e596f stream_exists_backend now returns a 404 if the stream is not found.
Update tests and compose.js to handle the 404.

(imported from commit d9ba4fe59c34bd14d9198e3365a845888fa04f03)
2013-03-28 07:53:37 -07:00
Luke Faraone 825f59799a Switch foo_list_subscriptions to the backend pattern.
This slightly reduces code duplication and in the future the {api,json}_ methods
will hopefully go away, leaving only the _backend methods.

(imported from commit 82a6e4a2ff2ba5d272068e9ff043ea47a1a8d278)
2013-03-28 07:53:37 -07:00
Luke Faraone bfb741c9bb Factor out client extraction and API key validation from authenticated_api_view
(imported from commit b8e3fc2f956b4de07ea0fe9b6f596dd353013935)
2013-03-28 07:53:36 -07:00
Luke Faraone b63e5e3235 Refactor runtorando AsyncDjangoHandler URLs into a list.
(imported from commit f5c65f69dd2ccb5a0ba6339b28b8c486cde2c7ff)
2013-03-28 07:53:36 -07:00
Luke Faraone 2be8f80f47 Make request._client a public member, dropping the '_'.
(imported from commit 5fc7ab57157ceb40c8bca9b0c97a47d8fac6745b)
2013-03-28 07:53:36 -07:00
Luke Faraone 9519484c8f Remove 'client' paramater from update_user_activity
(imported from commit 906bf35c1b6d056170bdf3472146e38dabce53bb)
2013-03-28 07:53:35 -07:00
Luke Faraone b6ed350c55 Remove explicit "client" parameter from send_message_backend.
Instead we now rely on the request._client value, which we were previously
passing along to s_m_b in all but one case.

For that one case, we just modify the Request object to include the value
beforehand.

(imported from commit 542f38f94bc447149cd4d2efaa5e8f48f756725b)
2013-03-28 07:53:34 -07:00
Luke Faraone fc2a071314 Scroll subscription settings into view on click.
Addresses a complaint brought up in our usability study.

We now hook into the "show" event on .subscription_settings elements and
do some obnoxious math to move the scrollbar the way we want.

Closes trac #1015.

(imported from commit 5d9cee1ffc242eb7b743fdccd2bd76bf0a7ba060)
2013-03-28 07:50:49 -07:00
Tim Abbott 78f5c2e877 Use the update_fields option to Django ORM .save().
This can result in a significant performance benefit because we only
need to update the columns that changed..

(imported from commit 42bef1fcc58ad79bd864f89263fe82e90743ee5b)
2013-03-28 07:36:11 -04:00
Tim Abbott 7b968cd088 Revert "Revert "to_dict: Update rendered_content in the database after rendered.""
This reverts commit 745b4a98d0e3f67acaa207ba53e9250060dcfe06.

(imported from commit ea59de391b93b82b08c35d92620d7d8ae263f34d)
2013-03-28 07:36:10 -04:00
Tim Abbott a4383f8264 Remove batch_bulk_create helper function.
The behavior we require is now standard in Django 1.5.

(imported from commit 509adb0bd371081a2dad7d4a04d24fcffbda7cdc)
2013-03-28 07:36:10 -04:00
Tim Abbott e8aa77c9b4 Set timeouts for our memcached caches.
The policy this implements is:
* 1 week for most persistent data (Clients, etc.)
* 1 day for messages

(imported from commit d57bb2c6b9626ffa2155c6d0ef9b60827d1f2381)
2013-03-28 07:36:10 -04:00
Tim Abbott e2d010ef2d Fix most unnecessary database queries in huddle creation.
This saves 2 database queries per user in the huddle when sending the
first message to a particular huddle.

(imported from commit f71aa32df846fb4b82651a93ff9608087ffcaa5a)
2013-03-28 07:36:10 -04:00
Zev Benjamin 304899cd8a blueslip: Indicate whether users saw an error in the error emails
(imported from commit dd31976a3279df5ea5de2a0433387c82c8f80d41)
2013-03-27 21:53:58 -04:00
Zev Benjamin 4d30089220 blueslip: Only try to report a given error once every 5 minutes
This is in addition to only successfully reporting a given error once
per session.  Previously, if an error was triggered many times before
the ajax call to report the error returned, we'd end up making many
ajax requests to report the error.

(imported from commit 559179e3c8c3fbf03bbb091a67361d447c80b7bb)
2013-03-27 21:52:55 -04:00
Zev Benjamin d1b9ab9fd8 Move SERVER_GENERATION definition to settings.py
(imported from commit 4be2b912a63f49f525c66f46db0bc5c466ad364f)
2013-03-27 14:15:03 -04:00
Zev Benjamin 5b4536172c Allow @has_request_variables on functions that don't actually use it
(imported from commit 3cf6db06c16d3d107a0fc4b11fc8c0f0258fc306)
2013-03-27 14:15:03 -04:00
Zev Benjamin 203b0fcc25 Use json_to_bool instead of simplejson.loads
(imported from commit 0d045c606925379450215349a17d6fe04d3f1be9)
2013-03-27 14:15:03 -04:00
Zev Benjamin 2da4c0a4bf Remove extraneous SERVER_GENERATION definition
It looks like this was supposed to be moved in e0d9182c but was
copied, instead.

(imported from commit 094f43e9cfd4dde380a3d1ef79b1c273b54ce1a3)
2013-03-27 14:15:03 -04:00
Tim Abbott 4502e563d1 Reduce code duplication for coding filling memcached caches.
(imported from commit e7e053c6fa27fd7a1143696196e9ee974ec91c8f)
2013-03-27 12:59:24 -04:00
Tim Abbott 8fbc98601b Populate cache of Huddle objects on server restart.
(imported from commit 3214cfa70d0de01c42028a9d025f7607f609081b)
2013-03-27 12:59:24 -04:00
Tim Abbott 8b2cb6472b Cache the lookup of Huddle objects by hash.
This is used in the send_message code path.

(imported from commit 4d9a4d079fe5b10b94c11016e9ec8c5601addc2c)
2013-03-27 12:59:24 -04:00
Tim Abbott b2e76f50b9 Populate cache of Client objects on server restart.
(imported from commit 6d0ef309dadcd6c24fc9e17b0859becb053adccf)
2013-03-27 12:59:23 -04:00
Tim Abbott 36f09729e6 Run the memcached cache filling jobs in separate processes.
This will significantly improve the speed with which the memcached
caches are filled.

(imported from commit 445fec710a00b3d19b7962beddf89d4a75322eab)
2013-03-27 12:59:23 -04:00
Tim Abbott a774598a10 Populate cache of Recipient objects on server restart.
(imported from commit 752851c7c3ee565201dd59fb0455c82a8885d42d)
2013-03-27 12:59:23 -04:00
Tim Abbott cc065a3c90 Populate cache of Stream objects on server restart.
(imported from commit 131eeddc5ebe5cc0db2554514a730d2750078012)
2013-03-27 12:59:23 -04:00
Leo Franchi 79102044f4 Don't create a pika-connecting queue client if we have no RabbitMQ
(imported from commit 680e867abb61644cbc62a4280b4e47b03eb5abe7)
2013-03-27 11:06:10 -04:00
Tim Abbott 6fd4bf38c0 logs: Don't display database time when there were no queries.
(imported from commit 71297c920b63578ebc2770954345bfb9d4d8937f)
2013-03-27 08:19:27 -04:00
Tim Abbott 144987e581 logs: Provide total time passed for longpolled requests.
Also improve display of times passed -- we now use display short times
in milliseconds for easier reading.

(imported from commit 08e1e7e6acbef48453080864946f7602a3395e7c)
2013-03-27 08:19:27 -04:00
Tim Abbott 887389d16c logs: Output timestamps in milliseconds when less than a second.
(imported from commit 150038059a1d7c677004edf27d4af2e48bf41285)
2013-03-27 08:19:27 -04:00
Tim Abbott f3ad2d7a6b Centralize dispatch logic for which queue processor to use.
Previous we had around 4 copies of the logic for deciding whether we
should publish data via a SimpleQueueClient queue, a
TornadoQueueClient queue, or to directly handle the operation, which
resulted in their getting out of sync and buggy (see e.g. the previous
commit).

We need to add a lock around adding things to the queue to work around
a bug with pika's BlockingConnection.

I should note that the previous logic in some places had a bunch of
tests of the form "elif settings.TEST_SUITE" for doing the work that
would have been done by the queue processor directly; these should
have just been "else" clauses -- since we generally want that code to
run on development environments whether or not the test suite is
currently running.

(imported from commit 16bdbed4fff04b1bda6fde3b16bee7359917720b)
2013-03-27 08:19:27 -04:00
Tim Abbott 16574806f5 Don't initialize SimpleQueueClient inside Tornado.
Previously we had several files which initialized SimpleQueueClient()
for sending items to the UserActivity queue, even though those code
paths aren't used outside Tornado.  This resulted in slower Tornado
startup times.

(imported from commit ad97021ec18d3927233744037c548c22db33c321)
2013-03-27 08:19:27 -04:00
Tim Abbott 1df99937a9 Tornado: Fill the Tornado UserMessage cache using manual query.
The actual database query that we use to fill the UserMessage cache
only takes a few hundred milliseconds to run; however the process of
iterating through the results would take 3-5 seconds because the
Django ORM is not very efficient for small tables where we're only
interested in the integer values in a couple columns.

So we can save most of that Tornado startup time by just doing this
one query manually; I left the original query next to it in a comment
so it is easy to keep it all up to date as we change our product.

(imported from commit ac4675bcdda5d812ebfbe211450c85ee2787ee66)
2013-03-27 08:19:27 -04:00
Tim Abbott 4076704476 [django 1.5] models: Always return a string from __repr__() methods.
See http://bugs.python.org/issue5876 for an explanation for why this
is needed -- basically __repr__() needs to return a string, not a
unicode object in Python 2.

This causes problems on Django 1.5 because the more expressive
exception code in model.objects.get() will crash with a __repr__()
containing non-ascii unicode characters.

(imported from commit f44085e67d9d14629b821a29bbf65738f1794d6c)
2013-03-27 08:19:26 -04:00
Tim Abbott fde2243dbc [django 1.5] Update read flags handling to use new Django 1.5 syntax.
(imported from commit af1e2608b6d6d3677bf6266980d8dc77739aa4ba)
2013-03-27 08:19:26 -04:00
Leo Franchi dbb2157457 Make home view unread count only count messages newer than the pointer
(imported from commit 0f699ed23f59380b04606bd30600373956f89ae4)
2013-03-26 18:34:16 -04:00
Leo Franchi 9de2442bd9 Add infomation in JIRA integration in our integrations page
(imported from commit 2aef274c630cc918a6fde8fa33a4598ba8ee7f3f)
2013-03-26 14:14:47 -04:00
Jessica McKellar 297bc7f09b Don't hide the floating recipient bar when scrolling.
We made this change for performance reasons that don't exist now that
we only render a small portion of your messages, and it causes a
distracting flicker when you scroll through messages slowly.

(imported from commit 33379320f6b90d93ec8beac17323b287f8bb2485)
2013-03-26 14:06:27 -04:00
Jessica McKellar 9451451672 tutorial: streamline some sections, and bold user actions.
This may help with compliance.

(imported from commit 8ef250b07a0a1a7023bc74f89a46875c88fadef7)
2013-03-26 14:06:25 -04:00
Jessica McKellar 76dade3b6e tutorial: remove code formatting examples and just link to documentation.
Those examples make the tutorial feel much longer, and they aren't
relevant to people who aren't using Humbug to talk about code.

(imported from commit c3213775d26cf533b3d9bde691de08a53d427939)
2013-03-26 14:05:45 -04:00
Jessica McKellar 2fd56b3745 tutorial: de-emphasize that we don't auto-scroll.
It's not so black and white in a world where we auto-scroll at the
bottom, and we've observed that people trying Humbug over-focus on it.

(imported from commit 2057643f179d5d1666cb33438c5a513977197b37)
2013-03-26 14:05:45 -04:00
Jessica McKellar eaa2cc702e Autoscroll when you are at the bottom of your message feed.
(imported from commit 7ca92b13c874346f846aea8200a638a7914fe7d6)
2013-03-26 14:05:45 -04:00
Keegan McAllister 7309d57067 Output page_params as a single JSON object
This is a lot cleaner, and also cuts about 50-70 ms off of page load time in
local testing (with lots of users), presumably because there's less work to be
done by the slow Django template engine.

(imported from commit 257b700238ee5d9a4ae00a53011ed5bce018124c)
2013-03-26 13:51:21 -04:00
Keegan McAllister 6d9aca5f1a Move "page parameters" (email, enter_sends, etc) into a single object
(imported from commit 842b2371bf6364982f1358f1cd2d91118c7fb2bf)
2013-03-26 13:50:03 -04:00
Keegan McAllister 38ebefe68f Remove unused variables
(imported from commit c18d43165c1dbdee28107ef21e26e474b819c653)
2013-03-26 13:50:03 -04:00
Jessica McKellar cc8ee68514 tests: assert that text objects are instances of basestring, since they might be str or unicode.
This fixes tests that have been failing for me for, well, months, that
I've been ignoring:

======================================================================
FAIL: test_successful_subscriptions_list (zephyr.tests.SubscriptionAPITest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jesstess/dev/humbug/zephyr/tests.py", line 631, in test_successful_subscriptions_list
    self.assertIsInstance(stream['name'], str)
AssertionError: u'Denmark' is not an instance of <type 'str'>

======================================================================
FAIL: test_get_stream_colors (zephyr.tests.SubscriptionPropertiesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jesstess/dev/humbug/zephyr/tests.py", line 515, in test_get_stream_colors
    self.assertIsInstance(color,  str)
AssertionError: u'#c2c2c2' is not an instance of <type 'str'>

----------------------------------------------------------------------

The more comprehensive fix to this is going through both our API and
JSON calls and ensuring that we always return unicode objects,
documenting that, and then testing that more specifically. For now, at
least have passing tests.

(imported from commit ed1875ea1f66c1f1e89f80502c0d6abb323dc489)
2013-03-23 00:19:38 -04:00
Jessica McKellar 53ec385d0b create_user: ask for realm as part of user creation.
With open realms, you can't infer the realm from the e-mail address.

(imported from commit c05afa586f121a38673f9e62281cf26c8590570b)
2013-03-23 00:19:37 -04:00
Jessica McKellar f87ffd0703 create_user: fix missing spaces in options error message.
(imported from commit 25ea284b17dfb3160aca336e31203991f70994d8)
2013-03-23 00:19:37 -04:00
Jessica McKellar e5f1dad409 create_user: remove unused imports.
(imported from commit b2dd10f73fb0285c2c92ab56b1111cf9e859cedf)
2013-03-23 00:19:37 -04:00
Jessica McKellar ea11ce4ae6 create_user: Add Terms of Service warning.
(imported from commit bdb31aebad397e98db77d3ea95ef17ac9dd4737f)
2013-03-23 00:19:37 -04:00
Jessica McKellar 0c3382fabb Always give hashlib.sha1 and friends bytes.
This fixes an experienced bug where you couldn't subscribe to a stream
with non-ASCII characters (failing with a UnicodeEncodeError), as well
as many other potential bugs.

(imported from commit f084a4b4b597b85935655097a7b5a163811c4d71)
2013-03-23 00:10:10 -04:00
Jessica McKellar 55240e3de2 tests: test inviting someone to a non-ASCII stream.
(imported from commit d1788cf4712800c1b3445ad47510ac488e7935b0)
2013-03-23 00:10:10 -04:00
Jessica McKellar c4ceb2c276 tests: test inviting a new user with non-ASCII streams.
(imported from commit 049ae5a77c87eaaf0313b4b83d1dd038b14dcc22)
2013-03-23 00:10:09 -04:00
Jessica McKellar 9b89d7dc19 tests: add tests for sending non-ASCII messages.
(imported from commit 16093b2a080e7b00149129a9b53f308d8688def2)
2013-03-23 00:10:09 -04:00
Jessica McKellar 531ad235df tests: exercise non-ASCII login information.
(imported from commit 51a79a637a2d624c78627c84cd93d10cd700dff5)
2013-03-23 00:10:09 -04:00
Leo Franchi 378a8939ec Use TornadoQueueClient for activity queue when in the tornado process
(imported from commit 93ca4295403786ae26a2f70be17410674e6d053c)
2013-03-22 15:55:49 -04:00
Leo Franchi f64bc59dfb Automatically register consumer once asynchronous connection is completed
(imported from commit 3d860a9b79a42beffbd3b73f49aa2c25986dd3c6)
2013-03-22 15:55:49 -04:00
Leo Franchi 452105e393 Reconnect to rabbitmq in our queue client if the connection is lost
(imported from commit 82ed67f0c0f93e9f79ff65ef55b397815d20aaeb)
2013-03-22 15:55:48 -04:00
Keegan McAllister 4baeaaa532 TornadoQueueClient: Don't stop the Tornado I/O loop on RabbitMQ disconnect
Requires Pika 0.9.6 or later.

(imported from commit 316ab9f2a6b5c2a25ae8584e2604222b33e0dec3)
2013-03-22 15:55:48 -04:00
Keegan McAllister 6ffc2bbe65 TornadoQueueClient: Provide a callback when declaring queues
This is required by Pika 0.9.8.  We need at least 0.9.6 for the next
commit; I had been testing with 0.9.5 previously.  Anyway this way
seems more correct as well.

(imported from commit bfb9e9e78938073001f70c4d28a5e07cc4ebac32)
2013-03-22 15:55:48 -04:00
Leo Franchi c346abe6e2 Send Tornado callback notifications via RabbitMQ
(imported from commit 83814d8c6b78fe725aedea9d98fb588ed31123e7)
2013-03-22 15:55:40 -04:00
Keegan McAllister 23b8833ec5 Handle Tornado callback notify in a more generic, less HTTP-centric way
(imported from commit 85a74d1b40461236c4c95ad688e9796ab50f0bbf)
2013-03-22 15:51:23 -04:00
Keegan McAllister 8db92fd995 Split out the actual Tornado views from the callback handling / notification
(imported from commit 26d40556bf7f545d3606a01d83b16c7265bafb0e)
2013-03-22 15:50:35 -04:00
Keegan McAllister 591816d80e Use TornadoQueueClient in runtornado
(imported from commit cc4d5505987dc2826d177ff93d037b17f78072b8)
2013-03-22 15:39:07 -04:00
Keegan McAllister 373d3ece1c queue: Implement TornadoQueueClient
(imported from commit 2803bc91e42aa20d6e6dec87bfadd2f890268d05)
2013-03-22 15:39:07 -04:00
Waseem Daher 6760e68f94 integrations: Document Capistrano integration.
(imported from commit e26774e3657a71e8f21bf8ef2b1b1a9c289707da)
2013-03-22 14:37:54 -04:00
Leo Franchi 7837e36d0c Clean up some code by consolidating
(imported from commit 3978da70286174ad3666d08bcc8db2eb28446399)
2013-03-22 09:49:54 -04:00
Jessica McKellar 4f1bf1b2f2 realm_stats: restrict some usage stats to only active users.
They are more meaningful this way -- the fact that your bots that
never log in or inactive users don't have colored streams shouldn't
impact that statistic.

(imported from commit b39debda338cbbad06957bc969b42862a888026a)
2013-03-21 17:38:20 -04:00
Jessica McKellar 85086b6662 realm_stats: Also print enter-sends stats.
(imported from commit 34f9d9916e11ac2e2748ecbb8eb4f9a34a110340)
2013-03-21 17:38:20 -04:00
Leo Franchi 0184f31af0 Reprocess unread counts when subscribing to a stream.
This is required if the stream has unread messages in it
(from a previous subscription period). Otherwise the
unread count will be 0 until reload.

Fixes Trac #1117

(imported from commit 8f3d78eb52fdecb52456b0037cc89665c9027fbc)
2013-03-21 17:13:17 -04:00
Tim Abbott a8febf8fce Revert "to_dict: Update rendered_content in the database after rendered."
This reverts commit 4e5a370bc43defb5083cac3df45c649cf2366abf.

(imported from commit 745b4a98d0e3f67acaa207ba53e9250060dcfe06)
2013-03-21 10:30:23 -04:00
Leo Franchi 4edf85e730 Mark messages taller than the screen as read once we have moved past them
(imported from commit c142c2447a8f2b5ed40337a75c1afbaf05f9fecf)
2013-03-21 09:37:10 -04:00
Jeff Arnold a95b1a1a23 Revert "Automatically condense long messages"
This reverts commit 27244550d5d94980d7e33d8cc7c69708427dbbec.

(imported from commit e468051b8052d244beb09ba795605d70124254dd)
2013-03-20 18:45:12 -04:00
Jeff Arnold 795d968b91 Revert "Center the message condenser messages with respect to the message body"
This reverts commit da64f33551b500857bb91cb3ece959aafc9b1eb0.

(imported from commit 004f9a95cf5dfd4c4b8565d6eec15ceac27f7bf2)
2013-03-20 18:45:09 -04:00
Zev Benjamin e5c62d164c Center the message condenser messages with respect to the message body
Previously it was centered with respect to its enclosing div, which
looked slightly off.

(imported from commit da64f33551b500857bb91cb3ece959aafc9b1eb0)
2013-03-20 18:08:39 -04:00
Jeff Arnold c92d664b44 Automatically condense long messages
Addresses Trac #747.

(imported from commit 27244550d5d94980d7e33d8cc7c69708427dbbec)
2013-03-20 17:39:15 -04:00
Keegan McAllister 118cf4edec Modify encoding for URL fragment so Firefox doesn't decode it automatically
Fixes #826.

(imported from commit a4c0ada9559684db7e597686d9354219de742819)
2013-03-20 12:07:53 -04:00
Keegan McAllister e97c6f52ce Don't save narrow operators to the URL fragment if that's where they came from
In Firefox, prevents e.g. a slash in a stream name, which we wanted to store as
%2F, from converting back to a literal slash.

There is some appeal to normalizing the URL fragment after parsing, but in
general this way seems better.  It may decrease page load time on narrowed
views.

Doesn't yet fix #826; the URL is correct but the narrow is still wrong.

(imported from commit 32e3fa9e968139863f34b9698f1c8b39d06f0c14)
2013-03-20 12:07:53 -04:00
Keegan McAllister ae27deb30f Encode search operands using a cleaner-looking variant of URI encoding
Fixes #1098.

(imported from commit 1ed05248f3c6b69a48b9c74c0ce344621fe637b5)
2013-03-20 12:07:52 -04:00
Jessica McKellar 37e58b613d Truncate the tutorial stream name to fit the DB max stream name length.
(imported from commit e267656337f97d3ea14e14e957a405cf4fd2d06c)
2013-03-20 10:15:08 -04:00
Leo Franchi 6263c9ba1e Unify calculation of unread-count for notifications and use it in the title bar
Fixes trac #1004

(imported from commit 6f04d1d3ded198b46cc2ff1733b94b5c17beb581)
2013-03-20 10:09:40 -04:00
Tim Abbott 02554b28cb to_dict: Update rendered_content in the database after rendered.
This change could significantly load the database if pushed to prod at
the same time as:

    send_message: Save rendered message content to the database.

goes out.  So this should go out in a different prod push from that
commit.

(imported from commit 4e5a370bc43defb5083cac3df45c649cf2366abf)
2013-03-20 07:34:10 -04:00
Leo Franchi 2ce683421b Only show 'More Messages Below" if there are actually more messages below
This fixes Trac #1004

(imported from commit fa57936aaf5b5f4ec74569bee389d18b989d6b9f)
2013-03-19 16:21:36 -04:00
Jeff Arnold 8613f6052e In the actions popover, put the most basic/common actions first
(imported from commit b2de5c1accffc776abe651c2140643ad380bb1e8)
2013-03-19 14:35:11 -04:00
Waseem Daher e1e7978fae "Lead designer" job posting.
(imported from commit 1f9e00e45f69d47842524d715fe5e8a8a4a8b7df)
2013-03-19 13:28:53 -04:00
Tim Abbott 17e9e56899 Fix get_stream caching the DoesNotExist value of None.
(imported from commit bdef7438758517ba9083ecc8bf110e3caa1ec041)
2013-03-19 11:17:31 -04:00
Leo Franchi c6f9dbdd54 Only sleep if there is more work to be done
(imported from commit f8a1380e0045c9470909c088a9d262f8a714c86e)
2013-03-19 09:55:12 -04:00
Leo Franchi 6d6c3364dc Rewrite message flag handling to fork out to a subprocess for batch handling
(imported from commit 1ef846f542950cabf32f8b176f5591cf5794a0ff)
2013-03-19 09:55:12 -04:00
Tim Abbott 9977cdde54 send_message: Save rendered message content to the database.
(imported from commit e5bd224687d5420f556b341286f03d3829973a3c)
2013-03-19 08:09:26 -04:00
Tim Abbott b0dedfa310 [south] Add rendered_content columns.
See the next commit for the models changes.

(imported from commit 90e753661f8abfcfcdb78a5bbc15ebaf7f2eff9b)
2013-03-19 08:09:26 -04:00
Tim Abbott b38a538f8c Rename userprofile_by_foo cache keys to user_profile_by_foo.
(imported from commit ef398abc48c9b81a3d339ffdce00bae274246d28)
2013-03-18 16:15:11 -04:00
Tim Abbott 8034980cc4 create_mit_user_if_needed: Check memcached before querying database.
This will save at least one database query whenever MIT users send
messages.

(imported from commit 9fd644885a380463d841762b8fafe928431e1263)
2013-03-18 16:15:11 -04:00
Tim Abbott 97d7d31b68 Rewrite internal_send_message to use check_send_message.
This will automatically fix bugs such as one in which
internal_send_message didn't properly strip() the subject argument
before sending a message.

We change the recipient_type argument to internal_send_message to take
the recipient type name (e.g. 'stream') both to better fit the API and
also because the previous code incorrectly handled huddles.

(imported from commit 78c2596d328f6bb1ce2eaa3eed9a9e48146e3b6a)
2013-03-18 16:15:11 -04:00
Tim Abbott bb80d1c58c Move check_send_message and helpers to actions.py.
(imported from commit d74c90e25bd63931955d2ad9b3890be53d674a48)
2013-03-18 16:15:11 -04:00
Tim Abbott ab04d6f403 check_send_message: Don't use json_success/error directly.
This is preparation for using it from internal_send_message as well.

(imported from commit 000784be7b40e0c93b38a5a916a4a915335ea821)
2013-03-18 16:15:11 -04:00
Tim Abbott fb77af8f10 Refactor send_message_backend to do checking in new function.
This is preparatory for using this new arguments checking function in
internal_send_message as well.

(imported from commit 578e09c50b8a700c019c7dd235b2d9527af34e39)
2013-03-18 16:15:11 -04:00
Tim Abbott 14efaea0bb send_message_backend: Reorganize subject argument checking.
(imported from commit 80daa46f47e7e5279f746db89b3632eeadb27325)
2013-03-18 16:15:11 -04:00
Tim Abbott 9909c8dc19 send_message: Use a memcached for the UserProfile-by-id cache.
This cache should save 2 database queries whenever we send a private
message.  However, previously it was per-process (which meant it was
mostly useless) and also buggy (it never stored anything in the cache,
so that it was completely useless).  Switching this to our standard
memcached setup will address both problems.

(imported from commit 1d807f30704bccf28de33a80523488aedc58a9be)
2013-03-18 16:15:11 -04:00
Tim Abbott c1d3a5b5e5 Use more caching of UserProfile objects in views.
(imported from commit 3abcceeb4fac1cfa5a9944a6455c60f6512dce6e)
2013-03-18 16:15:10 -04:00
Tim Abbott a23f6be28d Cache the results of Recipient queries in our memcached cache.
(imported from commit a6ba25a9c62d2738e4738b076370e4b2bc0ffaba)
2013-03-18 16:15:10 -04:00
Tim Abbott 3c143db01a Add memcached caching for get_stream lookups.
(imported from commit a089c8a99eaa1fa28ce401859cac1bdf0eb92a69)
2013-03-18 16:15:10 -04:00
Tim Abbott 9c2a9eb288 send_message: Avoid querying the stream object twice.
(imported from commit c23aab232a40195d92ae4b0e68af390c3b6b20ad)
2013-03-18 16:15:10 -04:00
Tim Abbott c0fece1cbd get_stream: Fetch the realm object as well.
(imported from commit 065ae574cb933cfc48371efd4327e70d37184dd4)
2013-03-18 16:15:10 -04:00
Tim Abbott c6c3cda089 do_send_message: Save a database query on message sending.
(imported from commit c5dc3d9888f9b1867e8d20d84795dde32cf95583)
2013-03-18 16:15:10 -04:00
Jessica McKellar 1ca2f6fa7f Add a management command to reset your stream colors to the default.
(imported from commit f6891ad40088bf34686a7d8a2d910a9a0f3be7c2)
2013-03-18 15:49:39 -04:00
Keegan McAllister 45eb9bcf47 tests: Disable tutorial through the server side variable needs_tutorial
This fixes a nondeterministic test failure for me.

The first message sent in the test suite appears to get dropped.  I don't know
why this is, and I'm pretty sure it was an existing bug.  This message used to
be the one disabling the tutorial, which might explain why that didn't always
work.

Regardless, this commit at least makes the test suite usable, and we can work
on fixing that bug later.

(imported from commit 063e40871b9883e3a6dab93a4e0a51c5b2dae4b7)
2013-03-18 13:46:46 -04:00
Waseem Daher 797b5ee63f Add page describing our Humbug apps.
(imported from commit 2e071782a13a497e57225b2a84c41d58f5e120b5)
2013-03-15 19:16:44 -04:00
Tim Abbott 9ae583b910 Use the User/UserProfile caches for Django requests too.
Previously we only used these caches for Tornado requests, because we
were not updating memcached when e.g. the user's pointer changed, and
so functions like update_pointer would not work correctly.

Now that we are updated memcached when the User and UserProfile
objects change, we can use these for all requests.

This saves 2 database queries on every Django request to the server.

(imported from commit aa5bffd885d14bde38b95e80a226bd5ab66f253d)
2013-03-15 18:09:34 -04:00
Tim Abbott 1e6ed16c23 Flush the User cache when saving User objects too.
(imported from commit e595209fe1190e2f3e0d55ad3b9bae0997b91d1a)
2013-03-15 18:09:34 -04:00
Tim Abbott b6f42cb1e1 Update UserProfile objects in memcached when we save them.
(imported from commit 59426e19eeeba131f363a4bc5f74f59b6dbe1066)
2013-03-15 18:09:33 -04:00
Zev Benjamin b08dbdfe48 blueslip: Send the user agent string back with the error report
(imported from commit ed77877465b1497cd3d78753c3398329302075ff)
2013-03-15 17:30:07 -04:00
Zev Benjamin 53a68144e0 Don't do processing for a get_old_messages if the message list it was for goes away
This was biting us before when the user would leave a narrow before a
get_old_messages call associated with it finished.  Specifically,
search.maybe_highlight_message() would assume a message was in the
DOM when it wasn't any more.

We also have to hide the 'loading more messages' indicator when
reseting the 'load more' status because otherwise it wouldn't get
hidden like normal in the load_old_messages() continuation, causing a
load_more_messages() not to fire when re-entering a narrow.

(imported from commit 4a136dd01305b039c0970f897b07e603b87d5d8e)
2013-03-15 16:40:05 -04:00