Commit Graph

1443 Commits

Author SHA1 Message Date
Keegan McAllister 2a619a0054 tests.py: Allow skipping generate-fixtures with --skip-generate
(imported from commit ca3de89fc5cd71e3a60b173275edf7cf74d65cdf)
2012-11-16 15:33:38 -05:00
Keegan McAllister a2750943e3 Use a custom Django test suite runner
This allows us to define new command-line arguments for 'manage.py test'.

(imported from commit 11cf24694a54a3b717256903b7582ddec9a85587)
2012-11-16 15:33:38 -05:00
Keegan McAllister 172386d9dd tests/frontend/run: Complain if the test server dies
One way this can happen is if run-dev.py --test is already running.  In that
case the one we launch will die with "Address already in use", and we should
alert the user that test results may not be accurate.

(imported from commit 078091cace2cff777b444668b03f96dc208f22fc)
2012-11-16 15:33:37 -05:00
Keegan McAllister 5344c9dcc5 frontend/tests.js: Wait more intelligently to receive messages
(imported from commit 4bd6ad72cbde8f0cb8bdd3b20883d1449435bb29)
2012-11-16 15:33:37 -05:00
Keegan McAllister b8f0599c7c tests/frontend/run: Avoid leaking test server on exception
(imported from commit 4c8ab0db991655a6647bd9861cc2fb95b21c1be4)
2012-11-16 15:33:37 -05:00
Keegan McAllister 0e6ce16172 tests/frontend/run: Wait more intelligently for the server
(imported from commit c3e26d7a85bca85921270d7927c0243df6586a2a)
2012-11-16 15:33:37 -05:00
Keegan McAllister 1ea92c0953 Manage file locking using the 'with' statement
This is clearer and more exception-safe.

(imported from commit b67641b05da9dbf8e5a887f398bac81ab5985cf3)
2012-11-16 13:43:44 -05:00
Keegan McAllister af36b437b6 log_event: Use 'with' for files
(imported from commit d49b46ecd8aa74679ade3820004d10cb42940ad3)
2012-11-16 13:43:44 -05:00
Keegan McAllister ccf14b89c2 log_event: Don't flush the log file right before we close it
There's no need.

(imported from commit 8c3b933b7fddfb858ee4dc201b63b6fe921dc8e9)
2012-11-16 13:43:44 -05:00
Keegan McAllister f132cd311b log_event: Close the lock file after we're done with it
(imported from commit 023e50e1aeeafee334f9b55e12ab91aa84a7872a)
2012-11-16 13:43:44 -05:00
Waseem Daher bf1d6f4aa4 Don't linewrap the user's full name and ellipsize if it gets too long.
This should address the catherio/tibbetts feedback of the name
breaking oddly across the middle of their name.

One notable change introduced by this commit is: If your name is very
long, e.g., "Waseemio Daherioian", it gets cut off. (On Firefox, it
gets rendered as "Waseemio Daherioia...", and on Chrome it gets no
ellipsis at all.)

The current behavior is that the long name actually overflows into
the main text area, which I think is worse.

(imported from commit 668cb30bc2326c255b229f4f19f29be473bdc1e8)
2012-11-16 11:00:14 -05:00
Waseem Daher 79abd7cb5c Make searchbox shrinking idempotent.
The existing code shortens the searchbox each time it receives focus.
Unfortunately, this means that if it receives focus twice in a row, it
shrinks twice in a row. (For some reason, the '/' hotkey does this).

So, instead, make it idempotent -- if we're already shrunk, don't
shrink us again.

(imported from commit 8179963bbd00822d15d92609d89f572d2de7800c)
2012-11-15 22:13:52 -05:00
Waseem Daher 5fa0b8d9d0 Allow searchbox to grow and shrink more flexibly.
This is nearly perfect, modulo two things:

1. If you have a search active and you resize the window, the search
   box resize doesn't take effect until you exit the search.

2. In super-narrow windows (<380px), the searchbox overshoots
   the message area slightly.

I don't regard either as huge issues -- I'll probably fix #1
eventually.

(imported from commit 4900fb9783cc9f447315b0892bd3505f5c31ce15)
2012-11-15 17:23:00 -05:00
Tim Abbott 50995dc6b7 Fix showing the subscribe-and-send dialogue when you're subscribed.
This doesn't fully fix the problems related to not syncing
subscriptions to browser clients, but it does fix the instance that
everyone experiences.

(imported from commit be2bc31a7c4443c1678321f1a938496e2632c0d3)
2012-11-15 17:15:59 -05:00
Jeff Arnold a68efd9ce2 Handle loading of older messages in narrowed view
(imported from commit 2fe1377736322a44e8682c69dd5e4312d5f46ca4)
2012-11-15 16:32:00 -05:00
Tim Abbott 2ed1917a10 api_get_old_messages: Use @has_request_variables.
(imported from commit 98862197e7b2f57e64ac4d906251cb81f582f5d1)
2012-11-15 15:39:14 -05:00
Tim Abbott 00cd30ff97 Use @has_request_variables in json_remove_subscription.
(imported from commit b08b7672959f8773db1ff7e40b53648926b47a09)
2012-11-15 15:39:14 -05:00
Tim Abbott 1c0832583c send_message_backend: Use POST() for the forged variable.
(imported from commit f2ca2a1adf1c71aa2e92e13a5f9396dfb091a8ef)
2012-11-15 15:39:14 -05:00
Tim Abbott 5467678a2e send_message_backend: Return error on messages with no recipients.
(imported from commit 4cf9bac8eb6e35dde0510afe4efb8ba70c86b566)
2012-11-15 15:39:14 -05:00
Tim Abbott 17f55441b5 Filter out empty string recipients in extract_recipients.
(imported from commit 0a4168e36ea2fe40bde281d2690adcf40bb15abe)
2012-11-15 15:39:08 -05:00
Tim Abbott 1ea1cdcdfd Call extract_recipients using a POST() decorator.
(imported from commit 135c465251a7af688b4354d0bd57763fd8ce282e)
2012-11-15 15:38:18 -05:00
Tim Abbott 03e52767ff Don't lower-case recipient email addresses in extract_recipients.
(imported from commit 7dd150dae659cc68aa6c8f1bad39f7be32384a95)
2012-11-15 15:36:23 -05:00
Tim Abbott 5230382e4d mirror: Check whether the user is a recipient by id.
(imported from commit e50f0b00d8e3cb00fdc7af3872b5adc38c432dcc)
2012-11-15 15:36:23 -05:00
Tim Abbott 4fe089e1ce Refactor arguments to create_mirrored_message_users.
(imported from commit 1a0954018585514c391dd0a6d5d2d382cb8e37ab)
2012-11-15 15:31:48 -05:00
Tim Abbott eddc516d5f send_message: Allow list-form "to" for sending to streams.
(imported from commit f1d8c694b5d89d09222d4f303f68841aede64385)
2012-11-15 15:31:48 -05:00
Tim Abbott 5faf18754e Decrease code duplication in create_mirrored_message_users.
(imported from commit d299124aa1eaa9afac62278c6b98208a14d2cdb1)
2012-11-15 15:30:09 -05:00
Tim Abbott 411a7f6b4f [manual] send_message: Rename recipient/stream fields to 'to'.
This commit changes APIs and requires and update of all zephyr
mirroring bots to deploy properly.

(imported from commit 2672d2d07269379f7a865644aaeb6796d54183e1)
2012-11-15 15:30:06 -05:00
Tim Abbott 6f10d27f3b send_message_backend: Eliminate unnecessary sender argument.
(imported from commit 64c1b9e2973e47a1d6af355cef0617c9abbff946)
2012-11-15 15:20:52 -05:00
Tim Abbott b219be06d3 Use @has_request_variables for client_name extraction.
(imported from commit b2ba8edaa680c69c82258bfc3f93a9e8028f2cfa)
2012-11-15 15:20:52 -05:00
Tim Abbott 542f8695ad Add 'try now' link when not receiving messages.
(imported from commit f52a376a62f2aed213d641e31a6f4c0380057d12)
2012-11-15 15:09:25 -05:00
Zev Benjamin 4497ef1493 Basic API tests
These tests don't have the same coverage as the json test on the
theory that the backend is shared by the two views and that
differences are mostly on the way into the backend functions.

(imported from commit ddd21135565122dae8cbe90846d1aee7e4a2f56e)
2012-11-15 13:42:17 -05:00
Zev Benjamin 3bc47bc44a Make @asynchronous's added 'handler' argument be keyword instead of positional
Adding a positional argument caused a problem when
@authenticated_api_view started using @has_request_variables
internally.  The 'handler' argument used to be passed through
positionally to the wrapped function, but when using
@has_request_variables, the wrapper inside @authenticated_api_view
had to take additional arguments.  The handler argument was then
assigned to one of those parameters instead of being passed through.

(imported from commit 66240bd465c803ddcbf4a603509051fca7381468)
2012-11-15 12:52:46 -05:00
Zev Benjamin 720d04a98b Use request variable decorator in @authenticated_api_view
(imported from commit ec46ec307cfb34275ebc33e429663172d3f2d169)
2012-11-14 17:35:38 -05:00
Zev Benjamin 012840108f Give more informative error messages for API authentication failures
(imported from commit e86495853c615915ca39be48128bd8f9bc312e5b)
2012-11-14 17:35:38 -05:00
Tim Abbott 4198dc74f1 Fix banish_broken tool.
(imported from commit 505c4a86ab106abab4c36af7c5f67c955f143c1d)
2012-11-14 16:57:21 -05:00
Waseem Daher 834c812a14 Rename "send_message" to "send_message_form" for clarity.
(imported from commit 25d9bde3390e47390724a8d4b3fd1fe95b44bd71)
2012-11-14 16:19:56 -05:00
Waseem Daher 3cf29025ec Prevent composebox form-handling code from running on all forms.
(imported from commit aee10dac671b1da83295d9e197eec4d3a0a7ceeb)
2012-11-14 16:14:48 -05:00
Tim Abbott 7ae73fabd4 Log how long requests take to process.
(imported from commit 89915f859e4493ff04a34d198ac6df5541b743cc)
2012-11-14 15:52:57 -05:00
Waseem Daher b7a9e17b67 Rename 'search' input element to 'search_query'.
If we don't do this, we get all kinds of nasty shadowing where
references to 'search.whatever' seem to be references to the
HTML input element, rather than our search.js module.

(imported from commit 4e4b562ddf895baea9619316d9fab27ae5e9fc4e)
2012-11-14 15:29:18 -05:00
Waseem Daher a1c4aa6865 Modularize search.js.
(imported from commit 72f00f832846124d833071fdd46b026c99189512)
2012-11-14 15:29:18 -05:00
Tim Abbott b22249d861 Helper scripts to fix some buggy users.
We have a lot of forged users that have bad fullnames due to
historical versions of our fullname computations; this function will
clean those up.

Also, we have a bunch of users with emails like foo|mit.edu@mit.edu
that were the result of a mirroring bug that we want to get rid of
from autocomplete -- putting them in a useless realm name will do.

(imported from commit 6e305093653ca9d327e9e28491636e99d16cfe1d)
2012-11-14 15:03:49 -05:00
Tim Abbott 2ab8af0b91 Clean up now-unnecessary extract_sender.
(imported from commit c504838bec7ec14be8fb660015445c9bc20a2a88)
2012-11-14 15:03:49 -05:00
Tim Abbott 7227cb32f8 zephyr_mirror: Compute zephyr mirror fullnames server-side.
(imported from commit 9e6f6f9fe49d60ed30753582480e592613feb3c8)
2012-11-14 15:03:46 -05:00
Tim Abbott 0971b3d8e6 Add proper transaction handling in create_user_if_needed.
(imported from commit cab9cb4886acf61f36a0b0bc80d87ed9037cc414)
2012-11-14 14:33:31 -05:00
Tim Abbott 979560d2fe mirror: Make check for duplicate messages more exact.
This should fix the problem where only one of pairs of identical
messages sent to two different zephyr classes by bots will make it
over.

(imported from commit 37005417e2e1f737501c9524b95b044eefbfe235)
2012-11-14 14:33:31 -05:00
Keegan McAllister ce49595a00 reload: Remove dead variable
(imported from commit d3ec0d7c422990606817efcc47e7eb18c221ca25)
2012-11-14 14:18:05 -05:00
Keegan McAllister 6f2bbe5917 Set and check csrf_token for #reload
Fixes a message forgery bug (#335).

This works because Django will not generate a new CSRF token if a valid token
cookie is already present (see django/middleware/csrf.py).

(imported from commit 23222cb0bb62ae8a2f8ac7fb3f24bbc866103454)
2012-11-14 13:35:24 -05:00
Keegan McAllister 122281553a Make csrf_token global
(imported from commit 734d9c886c3a77d2ba40bd449cb089a00807a656)
2012-11-14 13:35:24 -05:00
Zev Benjamin 585210feaa Fix the "load more" button disappearing after the first time it's clicked
I think this broke during a rebase.

(imported from commit 1b8d28b72127b47fbca7d4c44bab77bec1e3d053)
2012-11-14 13:01:28 -05:00
Jeff Arnold d473292f5c Make enter not submit the form in private message compose box
Fixes regression introduced by 97a438

(imported from commit 2da31fb7a742a317c9d6839ef7a1a5f887746dd3)
2012-11-14 10:27:52 -05:00