Commit Graph

1443 Commits

Author SHA1 Message Date
Zev Benjamin 8a0bef6c42 @has_request_variables: don't apply the converter to default values
(imported from commit 44fecac26268c4c1b7f69b4d5013cfbff2010744)
2012-11-09 12:27:40 -05:00
Zev Benjamin 472480a4b6 Move @has_request_variables decorator from return_messages_immediately to get_updates_backend
return_messages_immediately's return value is not returned, so the
argument validation in @has_request_variables didn't work correctly.
@has_request_variables would return a json_error, but
send_with_safety_check expects a dict.

(imported from commit 86b6bccb7861dbf523c06b606b87374e339059a4)
2012-11-09 12:27:40 -05:00
Zev Benjamin fd51cf343b Make client_id parameter in api_get_messages optional
(imported from commit a3221fe73f63c2cfa8f87b6059283a9aa0e8b8e4)
2012-11-09 12:27:40 -05:00
Jessica McKellar 3df5d0faf3 Don't disable hotkeys on buttons in general -- just the send button.
The original check has become too broad now that we have more buttons,
and specifically this lets you use the search hotkey to start a new
search after you've been searching up and down.

(imported from commit 0e691ff55ff9d4be8d406d1eb47fc2062758d28b)
2012-11-09 11:44:06 -05:00
Tim Abbott 9e9438153c [schema] Store analytics on usage of our product.
(imported from commit 4fbf8215225fc8f505b9c749ccf80c556af13e87)
2012-11-08 18:00:57 -05:00
Tim Abbott de4548dcb5 populate_db: Don't give huddle senders 2 UserMessage rows per message.
This bug was caught by our new unique_together constraints.

(imported from commit 5392c12cdc8e5c9603652ba2a32ae4400375f14b)
2012-11-08 18:00:46 -05:00
Tim Abbott 2be66f0e8a populate_db: Don't create huddles with 2 copies of the same person in them.
Bug caught by our new unique_together constraints.

(imported from commit 37c1fc459b98050417e907653a5a4fc97004903b)
2012-11-08 17:59:31 -05:00
Tim Abbott 5ab0cccf41 Pass the user's user_profile to authenticated view functions.
This change substantially increases the number of view functions where
the API and JSON versions are actually identical code.

(imported from commit 2eee55a8943cf9a684bec2ba1f6d7afcb2b91948)
2012-11-08 17:59:31 -05:00
Zev Benjamin 506a5b729b Add note to @has_request_variables about when it is inappropriate to use
(imported from commit 952341aad07e07d762ea3ec66a5b167bcb40ecea)
2012-11-08 16:40:07 -05:00
Zev Benjamin 95cd3f8ee6 Use the new @has_request_variables decorator
(imported from commit 2aa99140bf19e7e236f872960abd1b84b6a713be)
2012-11-08 16:40:07 -05:00
Zev Benjamin 27cf7e09d3 Add magic request variable extractor decorator
Functions with the @has_request_variables decorator can have some of
their arguments extracted from the HTTP request.  For each such
argument, its default value should be an instance of the POST class.
The arguments to the POST constructor control the request variable
name that the function parameter should be populated from (it
defaults to the same as the parameter name), whether the value should
be converted before being passed, and whether a default value should
be supplied if the parameter is missing from the request.

(imported from commit ba1c25d73ba3980e44abec1458e6496807fcdaa4)
2012-11-08 16:36:14 -05:00
Zev Benjamin dc8c54e6db Move view decorators into decorator.py
(imported from commit 737cff552b395493f44864ac06e901b0ba17fa29)
2012-11-08 16:35:31 -05:00
Zev Benjamin b278db110f Move json response functions into their own file
(imported from commit 91a786849bfa30dcacecef6b8339d8f1a9365156)
2012-11-08 16:30:57 -05:00
Zev Benjamin 7bbde14d78 Use functools.wraps on the functions returned by our decorators
This lets Django report the correct view name in errors

(imported from commit b21347e7af39cda439125355f99f4fc63fc3bd2f)
2012-11-08 16:30:57 -05:00
Zev Benjamin 0ca46d5abe Correctly construct tuple
(imported from commit f85ae7b0e4c335548cbe7254e5d820ced17a50a9)
2012-11-08 16:30:57 -05:00
Keegan McAllister c5035dade0 Remove unnecessary intermediate list
(imported from commit 037000d1c7c84d976866b9a8cef6eb3a69baecb9)
2012-11-08 15:13:20 -05:00
Keegan McAllister b0d395b0c1 Use generator expressions with sorted()
No need for an intermediate list.

(imported from commit c8ccdf2399155876b6cbf1f768ad3ec303730757)
2012-11-08 15:13:20 -05:00
Keegan McAllister ac1edd05fa parse_named_users: Rephrase odd for loop
(imported from commit daf77ceccb7eabf27946836841a34d5fa703b3ac)
2012-11-08 15:13:19 -05:00
Keegan McAllister 0fbb33c33f already_sent_mirrored_message: Clean up query
No need for an 'if' if we're just returning a boolean.  And using
QuerySet.exists() should be a little more efficient.

(imported from commit 69ec3cc9f2fe904ec40ea3b8a8687a06cd03f3f3)
2012-11-08 15:13:19 -05:00
Keegan McAllister e94c6fdf86 return_messages_immediately: Remove dead assignment
(imported from commit ef5583c292db3c3087af4949a0b0b255cf098cd1)
2012-11-08 15:13:19 -05:00
Keegan McAllister f2ac76aeac get_stream: Use try/except
For consistency with the rest of our code.

(imported from commit a2df17facad1a4e3b9e5e1dc4d33b64010cee939)
2012-11-08 15:13:19 -05:00
Keegan McAllister 8df247708c Rename login_required_*_view -> authenticated_*_view
login_required_api_view is misleadingly named.  It accepts neither a Django
login session nor login credentials (username / password).  The intent here is
authentication, whether stateful (login) or stateless (API key).

(imported from commit 7e9be552168396b399116737655bd7267fd5c1a3)
2012-11-08 15:13:19 -05:00
Tim Abbott 9a14073dda models: Add unique_together constraint on UserMessage table.
(imported from commit 79fcc1c9db11cc89a300b9d78a3c2f8cccb0917c)
2012-11-08 15:10:34 -05:00
Luke Faraone 3928f763e9 Make unsubbing an undoable action.
(imported from commit 713fdad5aa5d138b9e95a14dccaeba0d9d612c1c)
2012-11-08 14:42:50 -05:00
Waseem Daher 055d18b484 Add a "New private message" button.
(imported from commit fd15f26b73d0fedb536763d51fb4f0b50b2912bb)
2012-11-08 13:54:16 -05:00
Tim Abbott 1ef33bc5ea Remove starnine@mit.edu from API super users.
(imported from commit 67019a1e2a298a56b0efe598d4492f4b0f8dee87)
2012-11-08 13:34:32 -05:00
Tim Abbott f74bf4da92 is_super_user_api_key: Make tabbott/extra@mit.edu a super user.
(imported from commit a8bb8356c3d3ca37eb8de9ab705f400942389429)
2012-11-08 13:04:47 -05:00
Keegan McAllister d52728e3ae Recipient: use a dict to name types
(imported from commit 35ab065e7def38cb684672e48f2ca10f5f6479ad)
2012-11-08 10:48:34 -05:00
Keegan McAllister b57270322a models: Always pass a tuple to string %
(imported from commit c2881ef8f60fd7be2f70138868214d42d41b492d)
2012-11-08 10:48:13 -05:00
Keegan McAllister 979d997cf8 bulk_create_huddles: Use a set for existing_huddles
(imported from commit af66c6e4e87109feafbafdc6e84cf02903ca93ca)
2012-11-08 10:48:13 -05:00
Keegan McAllister 246c0a37bc Get rid of bare 'raise' outside 'except'
Within 'except', 'raise' re-raises the current exception.  But outside, it produces

    TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

which is pretty confusing as a generic "something has gone wrong" exception.

(imported from commit 9fcd003a952b82df67726c26161dced079978a32)
2012-11-08 10:48:11 -05:00
Keegan McAllister 5933a902c7 Remove unnecessary line-continuation backslash
(imported from commit afabcea50432b0e00f17e7a4cc4cb6c4a0c19cf2)
2012-11-08 10:47:09 -05:00
Keegan McAllister a70d82b8fc Use comprehensions more consistently in bulk create
(imported from commit f6b67b9ce74b379004e5fde6c99368c077a77f7b)
2012-11-08 10:47:09 -05:00
Keegan McAllister 51a96484f9 Consolidate callback code
(imported from commit e79ea42df3506bedd2077dcc63a45d32fe7b73de)
2012-11-08 10:47:09 -05:00
Keegan McAllister 9b9373d2ba Make callbacks_table class data rather than global
(imported from commit 39699304255b475ccab8a4760b155f3307cfe5d9)
2012-11-08 10:47:09 -05:00
Keegan McAllister f89366f5dd Use a new-style class for Callbacks
For consistency with the rest of our Python code.

(imported from commit 02659914f50b488039fe8c65bd1de796e2a16e65)
2012-11-08 10:47:09 -05:00
Keegan McAllister 3b8dbbc7d7 Use django.utils.timezone.now consistently
(imported from commit f223d9c1f6c77012db342b8be7aaed964b9f18c6)
2012-11-07 18:51:33 -05:00
Tim Abbott 218588ead0 models: Comment the IntegrityError code in get_client (#326).
(imported from commit 85c3580084dcd4c28f319a19d684e5a5af7069c7)
2012-11-07 18:22:32 -05:00
Keegan McAllister 205d839a58 context_processors: Rename misleadingly named unused parameter
(imported from commit 45fcb3e349747f430372767c21a50660cbb19228)
2012-11-07 17:46:46 -05:00
Keegan McAllister 0d538d91ac test: Fail if generate-fixtures fails
(imported from commit b13167ad04837cfeb64989ff43fec2e6ae890a33)
2012-11-07 17:46:46 -05:00
Tim Abbott 573cc4db33 models: Add unique_together restrictions for various tables.
(imported from commit 30957d465d5e7bc728e854b8b99f6ad99b98dba6)
2012-11-07 17:31:16 -05:00
Tim Abbott ff369373bf populate_db: Strip whitespace from stream names.
(imported from commit a33b4983994040060f8d7631238250297f4d152e)
2012-11-07 17:30:50 -05:00
Tim Abbott 02b7bcf1a4 populate_db: Make double-unsubscribes not a fatal error.
(imported from commit 4dadb28f9c310659ddd780e98da70da55ace7187)
2012-11-07 15:49:45 -05:00
Tim Abbott 95c39cbc76 bulk_create: Use a (large) batch_size with MySQL.
(imported from commit 529fef7dd55bb8a5f4e286f7c896f4b14b0d1b8d)
2012-11-07 15:49:45 -05:00
Tim Abbott e7abe13cd6 The empty string shouldn't be a valid stream name.
(imported from commit 1fa878d7d51d3c3444ac75edf08b32f886683964)
2012-11-07 15:42:32 -05:00
Keegan McAllister a815a253f7 get_profile: Return max_message_id
(imported from commit 5b5c853e667e47ff46ff14558f1e27f619f77cd7)
2012-11-07 15:34:44 -05:00
Keegan McAllister d461453250 Remove max_message_id from updates response
(imported from commit 1d8ce12a4d32dfb761617b4c2aa8e9fbe3ad2994)
2012-11-07 15:34:44 -05:00
Jessica McKellar 9077d51d54 For now, allow all characters in stream names.
We've had multiple requests from MIT zephyr users to allow
non-alphanumeric stream names, and we haven't decided what we want to
allow, so for now allow everything.

Note that the web client and mirror script limit stream names to 30
characters, which is our database limit.

(imported from commit 2acb5ee04e5ee7c40031ac831e12d09d04bbb2e6)
2012-11-07 15:12:03 -05:00
Jessica McKellar 1801292320 Update autocomplete lists only on case-insensitive new additions.
That way your autocomplete isn't polluted by multiple casings of the
same subject.

(imported from commit 0f28029be45bb48981f2e29ccb9f1490c1a56c94)
2012-11-07 14:51:51 -05:00
Jessica McKellar a2c6975ca2 Be case-insensitive about subjects when collapsing and narrowing.
(imported from commit 0baf20179c037c3eac82d8db20c6ec8062bb136a)
2012-11-07 14:51:51 -05:00
Keegan McAllister 3b78280786 search_button_handler: Remove unnecessary id lookup
(imported from commit e6da0cfa0b39e48c63464eaf91673c3133ad4cd4)
2012-11-07 11:51:03 -05:00
Keegan McAllister 3de0a0d1dd Use rows.id consistently
(imported from commit 58098986b90609484e4a7c10688eeb27f2c126b2)
2012-11-07 11:51:03 -05:00
Keegan McAllister 644702892b Return an int from rows.id
I believe this is more correct for our one existing user,
update_selected_message.

(imported from commit a2f1a20c0d885a4e6de49c69d930844177549cbe)
2012-11-07 11:51:03 -05:00
Luke Faraone 8bcbe55238 Clarify line in hotkey.js per trac #253
(imported from commit d5bacdd4cef2f62ba22e3a47d25c3a656cf601c0)
2012-11-07 10:43:42 -05:00
Keegan McAllister bbb70b496b send_pointer_update: Use an absolute path for /json/update_pointer
(imported from commit 8711df3f705023e763cf916a7dfbf43054d4823f)
2012-11-06 17:04:10 -05:00
Keegan McAllister 3923e2eca6 subs: Use an absolute path for /json/subscriptions/list
(imported from commit 82a2de5373e9170b27f4157c566e7ee23ba1f278)
2012-11-06 17:04:10 -05:00
Keegan McAllister 5f20d71065 Rename people_hash -> people_set
And use 'true' for consistency with stream_list_as_set.

(imported from commit 1cfb0a64eae368388cb2e0e57162d3b3d5ef88c1)
2012-11-06 17:04:10 -05:00
Keegan McAllister 22dc487a72 Rename stream_list_hash -> stream_set
This makes the intent more clear, since the values are all 'true'.

(imported from commit 1f1d6e206af9f2258b55bc77e7722158c2ffac98)
2012-11-06 17:04:10 -05:00
Keegan McAllister 651566ba16 Use an Object for associative stream_list_hash, not an array
From the Google JavaScript Style Guide:

    If you need a map/hash use Object instead of Array in these cases because
    the features that you want are actually features of Object and not of Array.
    Array just happens to extend Object (like any other object in JS and
    therefore you might as well have used Date, RegExp or String).

(imported from commit 048e7a640137f3919c0097a421b7b6c366b65cfe)
2012-11-06 17:04:10 -05:00
Keegan McAllister 4f53457f2f show_all_messages: Use .empty() instead of .html("")
(imported from commit 8df159bee6512856fd61eb5038e4b12470724553)
2012-11-06 17:04:10 -05:00
Keegan McAllister d6d34075ab Remove duplication in message validation
NB: this does change which error will be flagged if multiple conditions apply.

(imported from commit 080bf7d764f1f16ad57b365ad9aa6bc48f3cff72)
2012-11-06 17:04:10 -05:00
Keegan McAllister 366ca546e8 compose: Remove duplicated code in getters / setters
(imported from commit 3a17ef6fbcf9b8b4a31a54656152a1d37dea4fa0)
2012-11-06 17:04:10 -05:00
Keegan McAllister fcf21177fe compose.start: Reformat default opts
(imported from commit e0266265dbe81d19f3a666b2f822dffd2d8793d5)
2012-11-06 17:04:09 -05:00
Tim Abbott 6a690d4d4a Create our various bot users without subscriptions.
(imported from commit 9f9249cdb295f147d8b8b5cef17709c9aaa66418)
2012-11-06 16:59:28 -05:00
Zev Benjamin 58684965da Don't show the 'load more' button when the user has no messages
(imported from commit f763535480e5efcf0d345f22e076a97ba1f5809c)
2012-11-06 16:40:52 -05:00
Zev Benjamin c21a255b37 Hide the 'load more' button sooner if there are no more messages to load
(imported from commit ac046851c3a74a6f053e5f3c3b2950526a49cc46)
2012-11-06 16:40:52 -05:00
Zev Benjamin 39db8bf5d5 Use symbolic name for constant
(imported from commit cafb513c082b1ff1cf2169d90c3e4a77a9af5a9e)
2012-11-06 16:40:52 -05:00
Zev Benjamin 9875164908 Select the first ever message the user receives
(imported from commit 0fd6fa03175d9787a5e5a93d6172309a5eb47bfc)
2012-11-06 16:40:52 -05:00
Zev Benjamin df10d184a7 Only load initial messages if we know we will have some
(imported from commit af6bec8bdcd5dc1a643662e7531a3ec75298ffa0)
2012-11-06 16:40:52 -05:00
Zev Benjamin b5cd40723f Start long-polling immediately in get_updates if the user has no messages
(imported from commit 02f883c58513f3bb705b248320cd9cfb7abd6417)
2012-11-06 16:40:52 -05:00
Zev Benjamin 8464e45507 Set the response status to 400 in send_with_safety_check if there was an error
(imported from commit 11fd082bb88be271b268d60cc797318386c9d778)
2012-11-06 16:40:52 -05:00
Jessica McKellar 4cad5f6e96 settings: Update name and gravatar without a reload.
(imported from commit 961c9f64d7c39b4345ece036062854e8d474d2c0)
2012-11-06 16:33:22 -05:00
Jessica McKellar 7dcd8a5a3c Don't have clicking in the blue background on a row update the pointer.
(imported from commit 384c91454b15ddf3ce80e71603a594916c2916d4)
2012-11-06 16:33:22 -05:00
Jessica McKellar 0700b96f37 Hover the sender name on gravatar and e-mail hovers as well.
This clarifies that clicking on any of those three pieces of
information will pop up the user info tooltip.

(imported from commit 1e57550d66acbb2e8d5d244d2997bbd394c334c3)
2012-11-06 16:33:21 -05:00
Waseem Daher c654520c73 Display email on currently moused-over message.
(imported from commit ae27dc6068fefa9df7b5a03992df0253da9ec61a)
2012-11-06 16:33:21 -05:00
Waseem Daher 9e090b2d28 Make sender name more obviously clickable.
(imported from commit e75a6a051c939dd780d4815385b9c1eef0a07255)
2012-11-06 16:33:21 -05:00
Tim Abbott f342217700 Add timestamps to our various non-message logged events.
(imported from commit 65102419ac0032ccedcbdb342dbea9b91bbe3e13)
2012-11-06 14:12:19 -05:00
Tim Abbott a6cd21a1b8 Log events to a file named after the current server.
Merging these log files together is future work.

(imported from commit 54abf1ed41c2d8ba220fd3af0d997256c2718db0)
2012-11-06 14:12:19 -05:00
Waseem Daher ce2023b348 Make 'v' the new hotkey for "Show all private messages".
(imported from commit a7299633bf363cf832ff7099c963bc56abfdf734)
2012-11-06 13:37:24 -05:00
Waseem Daher 6b149af91d Rename 'huddle'->'Private message' in user-facing strings.
(imported from commit d3bdccc37a4fb7b373c6c1c69091353f39fecafd)
2012-11-06 13:37:24 -05:00
Keegan McAllister e9c81a4a8b runtornado: Don't apply response middleware twice
This was causing us to log some requests twice, and might have more serious
consequences as well.

(imported from commit 0bb2d7207ee3e4e04679215a7f5ae637cd26aa19)
2012-11-06 13:15:49 -05:00
Keegan McAllister 8259059119 runtornado: Remove ability to run without specifying exactly one port
The zero-port case never actually worked, because addrport wasn't an optional
parameter in run_one.  And multiple ports was implemented using the
multiprocessing library, which is just bad news.  Since we have no need for
this, remove it before it can cause trouble.

(imported from commit 9d913924701f30d23ebe878b76c8f1f0da2800e2)
2012-11-06 13:15:49 -05:00
Keegan McAllister 43af871759 ui: Fix punctuation in a comment
(imported from commit 9ca5317cd73485891c136876d4e19e986f04c579)
2012-11-06 11:25:11 -05:00
Keegan McAllister 54e8df4393 Fix missing newline at end of reload.js
(imported from commit 30faacb6b3c0d6d57265c464459c2c088cd9244f)
2012-11-06 11:25:11 -05:00
Keegan McAllister f1809b8f9c add_display_time: Note unescaped variable
(imported from commit 17d683e2bf0e5eabfb1cb2cdb6a1db18d140b5c9)
2012-11-06 11:25:11 -05:00
Keegan McAllister 080c169e90 same_recipient: Fix spacing
(imported from commit 75247bbbb496870236ab26f827daeb3fbe7bb7f3)
2012-11-06 11:25:11 -05:00
Keegan McAllister b56446513f Don't set default opts in select_message_by_id
These are set again in select_message and we don't use them before then.

(imported from commit 9d1f5ebd7f87890817d6cb4411d62f1e7d1cd053)
2012-11-06 11:25:11 -05:00
Keegan McAllister f9b346666a Comment use of .outerHeight(true)
(imported from commit 1b0f8da2c76dc5bc7504b4d4aa026351d1ab6627)
2012-11-06 11:25:11 -05:00
Keegan McAllister ca25c4d4a5 Consolidate report_{message,success,error}
(imported from commit 21deb6a41438bf7697bd8a3c46a428ca0034f2b0)
2012-11-06 11:25:11 -05:00
Waseem Daher 807fab6760 Make composebox look more 'on top of the page'.
Hopefully fixes https://trac.humbughq.com/ticket/126

(imported from commit cd9f74dbc29b918c4a81d2c2c53554586134477b)
2012-11-05 18:39:20 -05:00
Waseem Daher 8e6aa3d2d7 Use "huddle" consistently.
(If nothing else, because it will make the inevitable rename easier.)

(imported from commit 5077b04412ba9d5f885bf2c2e898bfd702adbe6c)
2012-11-05 18:39:20 -05:00
Zev Benjamin b9c86ca49c Be more robust and aggressive about cleaning up recipients in the huddle compose box
(imported from commit 6fe4ca445b6559e91a9b23088f3effdde4f18d7b)
2012-11-05 18:09:11 -05:00
Zev Benjamin fc9a47a26f Factor recipient splitting out into a function
(imported from commit a00b090d0446dc9b80a33a92c68e37cd9aece251)
2012-11-05 18:07:11 -05:00
Zev Benjamin dc95a2b8f3 More regex robustification
(imported from commit 1f7c7c660b0446f0724ff339b9326b9b8a5fe5a0)
2012-11-05 18:07:11 -05:00
Jeff Arnold 986b780c69 Increase the bottom line.
(imported from commit c1ac8a3be566713b61f971fb1da0214d2c1aef9c)
2012-11-05 16:03:50 -05:00
Keegan McAllister eac7040bd0 hotkey: Reduce keydown/keypress duplicated code
(imported from commit 9d279166607105cffca6b18bdce9324be91be9f4)
2012-11-05 15:38:23 -05:00
Keegan McAllister 94a635a379 hotkey: Rename keydown_handler -> current_key_handler
Since it's used for both keydown and keypress.

(imported from commit 23ac169b20ec33d961f982a7deb0fa721b8173f7)
2012-11-05 15:38:23 -05:00
Keegan McAllister 288fc6f2ee hotkey: Implement and use the contract on key handlers
The comment on keydown_handler says that these functions should

   "return a new handler, or 'false' to decline to handle the event."

(imported from commit 8cd23ee69ef900fcb7c7c211fe6ad36f54f02ba9)
2012-11-05 15:38:23 -05:00
Keegan McAllister 14f7f46c24 hotkey: Document more clearly what key 13 is
(imported from commit a91ca23d9586374defbe5cc29fd9b1969a99be09)
2012-11-05 15:38:23 -05:00
Keegan McAllister fed4d6f69e hotkey: Expand on forward declaration comment
(imported from commit f23414655dbf3caa2220b938cd93959753eae8fe)
2012-11-05 15:38:22 -05:00
Keegan McAllister 3b66748967 hotkey: Use $.each instead of 'in'
This is simpler and more consistent with the rest of our code.

(imported from commit 5188b8047952fe4e6556a26f10ab93123d67e03f)
2012-11-05 15:38:22 -05:00
Keegan McAllister 4cd5cdbcd6 Revert "Clean up how we deal with the message type tabs"
This reverts commit 429e055d3eca65af8bc0fe58481a7becf9ced66a.

There is some inconsistency between the names 'huddle' and 'personal' that is
breaking things.

(imported from commit 4c81853fca9d88d13ce8f23e2d6884c33cdc57d2)
2012-11-05 15:01:49 -05:00
Keegan McAllister 89b667ba20 Cleanup whitespace in CSS
(imported from commit ffd0d4715977b1655ee9df84db4fe014d67216bf)
2012-11-05 11:49:01 -05:00
Keegan McAllister 477bad9536 Clean up how we deal with the message type tabs
(imported from commit 429e055d3eca65af8bc0fe58481a7becf9ced66a)
2012-11-05 11:49:01 -05:00
Keegan McAllister db845350ad Clear password change boxes when switching tabs
Fixes #256.

(imported from commit 32a2528f299aea8f2d28cce807f60eb81a75e26d)
2012-11-05 10:46:46 -05:00
Jessica McKellar 15ca35e961 views: remove unused imports.
(imported from commit 1c44a1b23bb020b82bae99a75a12218c3e708e26)
2012-11-05 10:32:42 -05:00
Jessica McKellar 9eb86df03a tests: Unbreak registration, which was missing the new TOS field.
Also remove unused fields.

The registration tests should be revamped for our new multi-stage
signup, but for now just get the test suite passing completely.

(imported from commit 481f420cf99341e44e71942ae563e3f9a1270d3e)
2012-11-05 10:32:42 -05:00
Zev Benjamin 7b6eb243ed Make the regex that removes trailing commas in the huddle recipient box on blur more robust
(imported from commit ff71c802c5590a96c6649aa9a5e7c841bed82e1f)
2012-11-05 00:47:22 -05:00
Jessica McKellar 4396f1bf35 Don't unnarrow if you click the Home link from another pane.
This makes the Home link modal (when on the Home pane, it unnarrows
you; when on a different pane, it returns you to your feed in whatever
state you left it).

Fixes Trac #5.

(imported from commit 3181f17035d78a9916ab7a3ad336f34cb66d3cdf)
2012-11-04 11:17:48 -05:00
Waseem Daher 39dbc23660 Rename function for clarity.
You're not necessariy getting the last email, you're getting
the last recipient the user typed in.

(imported from commit f7ab4153a5b2497bc31a42d3ac5aea0636daaf60)
2012-11-03 02:03:51 -04:00
Waseem Daher 5d43328d1e Make typeahead autocomplete more reasonable when composing huddles.
This attempts to tackle the issue where Cordelia always gets
accidentally CCd, with the following as a reproducer:

wda [tab] [backspace] [tab or enter] sends a message to wdaher and cordelia

(imported from commit fbbd722173584e50c34878b7d6249b09564fb172)
2012-11-03 02:03:09 -04:00
Waseem Daher a52e4fafc9 Cause huddle autocompletes to highlight after the first one.
(imported from commit da660998d771ba350a793d058938737af2b9ae84)
2012-11-03 01:50:15 -04:00
Tim Abbott 1993ee403d Remove @asynchronous on notify_foo views.
(imported from commit 79e3f99450deb3efa0c4154465a692ef01306ce4)
2012-11-02 20:55:31 -04:00
Tim Abbott 517c8e298a Remove now-unnecessary check for 'time' in json_send_message.
(imported from commit aa177e13c16a43a5914227142a4e2589e2bd92bb)
2012-11-02 20:55:31 -04:00
Tim Abbott 1adc54185f Fix unnecessary usage of realm ids creating new users.
(imported from commit 5870b583efffa4a5280c81125eefecc23978cf11)
2012-11-02 20:55:31 -04:00
Keegan McAllister 2b1ecd1ad8 Fix name of login_required_api_view in comment
(imported from commit e278256da19c3abd4ee05bd6c4318a482a25cee0)
2012-11-02 14:57:38 -04:00
Keegan McAllister ac6a74bd73 test_public_urls: Fix docstring
(imported from commit 18bf6595386ca65e0a928c9e0b60e8e0a46f77e2)
2012-11-02 14:57:38 -04:00
Keegan McAllister 02aa92a604 Correct comment on filter_by_subscriptions
This isn't dead code; it's used by tests.

(imported from commit ce6cfc049d2cb8050aff1fef1b77a3778b7ceacb)
2012-11-02 14:57:38 -04:00
Waseem Daher d545ae4884 Bugfix: event -> e.
The fact that we're inconsistent about this in our functions
is definitely going to lead to more bugs of this form
down the road.

(imported from commit 907badcb28c0834729e21436c621255fa6584d44)
2012-11-02 14:31:16 -04:00
Keegan McAllister b87a35c1ff bugdown: Disable + as a bullet character for an unordered list
Fixes #272.

(imported from commit 8afaf14965ed1f6a4bb3ccfc9d4c2d807148666d)
2012-11-02 14:04:09 -04:00
Keegan McAllister 7a6fe207c5 bugdown: Disable ordered lists
These get automatically re-numbered, which will do the wrong thing when people
split their lists across multiple messages.

Fixes #241.

(imported from commit 7f6f2c36a6ab27cef0a34008f304fc0fe25c8bd0)
2012-11-02 14:04:09 -04:00
Jessica McKellar 296f707aef Blur search buttons before hiding them, so they don't interfere with hotkeys.
We currently disable hotkeys if the focus is on a textbox or
button. Hidden buttons can still be in focus, so blur the search
buttons before hiding them.

(imported from commit 5fdab34ad9931ea5ea2ad1827b36dfe4c02d8797)
2012-11-02 12:00:31 -04:00
Jessica McKellar bd822bebcd Disable arrows when you have no more results in a direction.
(imported from commit 824f541fd0b71bf0a9887cb94bb9585059a5413b)
2012-11-02 11:04:16 -04:00
Jessica McKellar d91ddf9359 Hide search arrow keys until a search is active.
(imported from commit 2f6a11ccc410633157502e8beebb4acf32eca2b6)
2012-11-02 11:04:16 -04:00
Jessica McKellar c1cc9f0742 Don't re-focus on the search box after ending the search.
(imported from commit 35bffb245ad9dc58b394a1c5228b32db4830f2bd)
2012-11-02 11:04:16 -04:00
Jessica McKellar 336e4ac5a6 Add a '/' hotkey to initiate a search.
(imported from commit 893865b73ddef0202da8b2f57e341fb1dc0f4fa0)
2012-11-02 11:04:16 -04:00
Jessica McKellar 7877507fe6 Re-enable the search box.
(imported from commit 6fee7e6853e9608bcb5ef211939309eca46801c8)
2012-11-02 11:04:15 -04:00
Tim Abbott 3aa7cc521f Workaround missing keyup event when user types ctrl-f.
(imported from commit ad37e0c9069ee29dd8159e020682cc05738b300b)
2012-11-02 10:50:59 -04:00
Waseem Daher a6dbb88d0a Three autocompletes for subject, for consistency with stream.
(imported from commit 08e12fa2cfbe37b53a06888b879babbcf12733bf)
2012-11-01 21:56:37 -04:00
Waseem Daher 41290f3e23 Fix XSS issue in composebox typeahead.
Whenever we use a typeahead, we should use the escaping highlighter
unless we're explicitly going to put sanitized content in it.

(imported from commit 33086327fe56a7bcbbbf8a08fe3f39800b195e75)
2012-11-01 21:56:37 -04:00
Waseem Daher 69b534c0ba Move composebox typeahead code into its own module.
This also cleans up the autocomplete source specifications,
making the three typeaheads all look fairly consistent.

(imported from commit e72655d715db74cfc9ab45b51e7e2ff9e8ea84c5)
2012-11-01 21:56:33 -04:00
Waseem Daher e72279d6a8 Reintroduce XSS issues in composebox typeahead.
This makes the diff a bit cleaner.
Revert "Interim measure: Escape fullnames as well."
This reverts commit a634e6ac39ea337be499889b3ff64b3c4f4fcccb.

Revert "Interim measure: Escape subject names before they go into the typeahead."
This reverts commit 806bc719ab296ec0fe299b33c7aa6767a0c71b9d.

(imported from commit 5a579e3535846b2bc612cf03e43c562c83119812)
2012-11-01 17:16:27 -04:00
Zev Benjamin 6178cd830a Return the error if return_messages_immediately returns an error response
We previously started long-polling.

(imported from commit 5860e484c63088ed34226f39f5aeb74e3ed43f91)
2012-11-01 16:02:28 -04:00
Tim Abbott 08b76126b4 Make the mouseover date string always include a timezone.
(imported from commit 5b4a98c6e0cdfc87ba57f6d6454488fff2810603)
2012-11-01 14:07:10 -04:00
Tim Abbott 7c3a189c03 Combine api_subscribe and json_add_subscriptions.
(imported from commit 1a5df7c88beb2c27a048b1880136b9c7cb4451b2)
2012-11-01 13:05:52 -04:00
Tim Abbott 7e0cbd1c8b Change json_add_subscription to use the same interface as api_subscribe.
(imported from commit 9b9eb0284ad262ce9701ef81162d954544435d52)
2012-11-01 13:05:52 -04:00
Tim Abbott 27867b0022 Rename add_for_send to subscribe_for_send.
(imported from commit 19f6a0710a84bf8204b81957ca49b09ec9174188)
2012-11-01 13:05:52 -04:00
Tim Abbott aca815d727 Don't add duplicate entries to subscriptions_table.
While we're at it, fix the fact that we're currently not adding
entries to the subscriptions_table at all when we do
subscribe-and-send.

(imported from commit 99bf574a4a296463e562a44186e2282654464542)
2012-11-01 13:05:52 -04:00
Tim Abbott 01bf0868a9 Rename new_subscription argument to streams.
(imported from commit 8024f47564fe580734d5e452f5092520870003a7)
2012-11-01 13:05:52 -04:00
Tim Abbott 0120b2b239 Don't show a user-facing error when subscribe-and-sending and already subscribed.
(imported from commit 7262740e8d967bf69a61fb9fddd74270a3211f5f)
2012-11-01 13:05:52 -04:00
Keegan McAllister cb9cdf22c3 tests: Correct documentation on test_message_to_nonexistent_stream
(imported from commit 76176083c1a0494856a3507214e2cfc3844d1fc1)
2012-11-01 12:08:38 -04:00
Keegan McAllister b81ef9cca7 Replace template variables static_{third,public} with hardcoded paths
So that the 500 error view will render properly, even though no variables are
set.  We keep the variable static_hidden, which by design is not used on the
500 page.

Fixes #240.

(imported from commit 3c7534f896479b7d7edbe5ef13958481e169a13c)
2012-10-31 18:43:44 -04:00
Waseem Daher f0fd80a294 Interim measure: Escape fullnames as well.
I'm sure this problem exists in a latent way with stream names and
email addresses as well. Once I figure out a general way to fix this,
I'd like to go back and handle these three cases in a cleaner,
symmetric way, but this'll do for now.

(imported from commit a634e6ac39ea337be499889b3ff64b3c4f4fcccb)
2012-10-31 17:49:19 -04:00
Waseem Daher 4d83aa96ff Interim measure: Escape subject names before they go into the typeahead.
This is problematic because if your subject name is <b>hi</b>,
selecting it from the typeahead comes back with:
 &lt;b&gt;hi&lt;/b&gt;
which obviously isn't really OK.

(imported from commit 806bc719ab296ec0fe299b33c7aa6767a0c71b9d)
2012-10-31 17:26:13 -04:00
Waseem Daher 765aa833bc Clean up jQuery selectors for the composebox send button.
(imported from commit 6bf7ee00f23290ae5e254b4964db3ed51527368b)
2012-10-31 16:36:22 -04:00
Waseem Daher 1e34e46a2e Make Tab-Enter work as a "send message" shortcut in Safari.
(imported from commit 2eccaea06594a7c3d3e8c6d3c00a20c4c94116a2)
2012-10-31 16:36:22 -04:00
Tim Abbott 22bb5a5830 Fix longpolling on messages to nobody.
This is what caused our server to hang when receiving certain messages
over the last couple days.  It was introduced by me making in the
assumption that doing the same thing we did after validate_notify
failed was a correct way to immediately return from
notify_new_message, which it was not.  The code of validate_notify
actually finished the handler in the event that validation failed,
which isn't "correct", but did not manifest in a visible problem.

The correct way to trigger an immediate response from a tornado view
is to just return the value, not call handler.finish() and then return
None.

Similarly, the correct way to trigger longpolling from a tornado view
is to either return None (or equivalently, / drop off the end of the
function) or return a generator.

(imported from commit 5b931248b4650fc88d5d68f5936a95f19e097af9)
2012-10-31 16:35:30 -04:00
Keegan McAllister 5a7b307d71 Create the narrowbar using a Handlebars template
This fixes an XSS hole (#249).

(imported from commit 5f70c0bc23e0d992f2d85889e2ba9157f1b73b3a)
2012-10-31 16:02:17 -04:00
Tim Abbott 5a3d52baa7 Make the narrowing tooltips a bit more verbose.
(imported from commit ab2cbaa7bfe4eeb0b1d1dd00b6db6aa76574cbff)
2012-10-31 14:06:35 -04:00
Tim Abbott b33c0c4eee Send the stripped stream name to add_subscriptions_backend.
(imported from commit c3bbb9bd200629020fe7e60d42644beaab30bff5)
2012-10-31 14:06:35 -04:00