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
Zev Benjamin
150a800b95
Don't reject mirrored stream messages because they don't have a recipient field
...
(imported from commit 1677ad91dc2e470c02a01a553d9d07789199a8d9)
2012-11-13 20:22:37 -05:00
Keegan McAllister
42a5ea9d2e
Specify requests.post data as a dict
...
These were lists of pairs because we were going to repeat keys, but that didn't
work anyway.
(imported from commit 687b3f7b8a2821d057719c725f1f39db3992ae5c)
2012-11-13 17:33:41 -05:00
Keegan McAllister
f82e8fc4d1
Move Markdown rendering out of the Tornado server
...
(imported from commit fc726939aa1061c40b292899dbbc9ade3b29ea01)
2012-11-13 17:33:41 -05:00
Zev Benjamin
9c99e00228
Normalize the sender email while we're at it
...
(imported from commit 1c245156809da77b4bef7a4396e8c0bee5724490)
2012-11-13 17:25:13 -05:00
Zev Benjamin
57bc0e0b8d
Normalize recipient list on the server-side send path
...
This was causing Zephyr mirroring to break because
create_mirrored_message_users was returning False due to the
same_realm_email check failing.
(imported from commit e6a63160f34ec056461038650b5f8027718e6c63)
2012-11-13 17:25:13 -05:00
Jeff Arnold
d78d7619a8
[third] We no longer need the tabSkips option
...
(imported from commit 18a292f05a6a0d473b02b1817de116e1c3d66202)
2012-11-13 16:15:43 -05:00
Jeff Arnold
db34090f1f
Now that we have proper escape support, tab can autocomplete
...
(imported from commit 28faff5416301dbc168e6ffcd0045df582961c9d)
2012-11-13 16:15:43 -05:00
Jeff Arnold
1d818db995
Make escape close just the open typeahead on Firefox, not the compose
...
(imported from commit 59dc10dbf9deb1b42240ae534da4ccc1ec2ef7df)
2012-11-13 16:15:43 -05:00
Zev Benjamin
bb534f7a5f
Missed a usage of the old get_old_messages API
...
(imported from commit 15d3e4bb40f9aa64e976de636a5bef6e694e00c9)
2012-11-13 16:06:46 -05:00
Zev Benjamin
534a1fd2ec
frontend-tests: Click on the buttons the user would for sending
...
Previously we bypassed the big buttons on the left bar and clicked on
the anchor tag inside the compose box. This bypassed the
compose.start() call.
(imported from commit 2b627825596c8d3c21441e58db895b8e488e624b)
2012-11-13 15:40:53 -05:00
Zev Benjamin
f851d9437d
Turn 2-person huddles between the sender and other user into a personal on the backend
...
(imported from commit 959e7ea8101dc1d469d62ea2c7c7a65854679833)
2012-11-13 15:40:53 -05:00
Zev Benjamin
195bdb07c9
Unify huddles and personals into private messages on the send path
...
Personals are now just private messages between two people (which
sometimes manifests as a private message with one recipient). The
new message type on the send path is 'private'. Note that the receive
path still has 'personal' and 'huddle' message types.
(imported from commit 97a438ef5c0b3db4eb3e6db674ea38a081265dd3)
2012-11-13 15:40:53 -05:00
Zev Benjamin
0c1cccc880
Use plain $.ajax instead of jquery.form for sending messages
...
(imported from commit 46651224dfb0b1b3b4903b30cba5385025da173c)
2012-11-13 15:40:53 -05:00
Zev Benjamin
33c23c0113
Use a JSON array for recipients in send_message
...
(imported from commit e2184f92b708cc2e8ef3e9ae79ee4241c0aa12a1)
2012-11-13 15:40:53 -05:00
Zev Benjamin
b948473a45
Simplify get_old_messages API
...
It now takes an anchor message id, a number of messages before, and a
number of messages after. The result always contains the anchor
message.
(imported from commit 84d070dc8091161c86d4bbeafbdc299493890a2a)
2012-11-13 15:40:53 -05:00
Zev Benjamin
69598e2b0b
Don't return server_generation in get_old_messages
...
(imported from commit de2b22fa51c645b7f1b92229bc15b1d0c4b4a8e4)
2012-11-13 15:40:53 -05:00
Keegan McAllister
c0204ea5b3
get_display_recipient: Sort huddle recipients by email address
...
We need a deterministic order for the client test suite, and it seems like a
good idea generally.
(imported from commit cc8fc555611f2d2f1b21e63ce6860d446baa3410)
2012-11-13 15:09:15 -05:00
Keegan McAllister
a954277647
get_{display,log}_recipient: Use a join query
...
(imported from commit 1278f46655760842e21a62ca5add891515ee1945)
2012-11-13 15:09:15 -05:00
Waseem Daher
c8e87e0e6a
Unbreak ctrl-click and shift-click in Firefox.
...
We had this problem where clicking a hyperlink bubbles up and causes a
click on the message, which causes the composebox to open.
We "fixed" this by setting cancelBubble (or, even better, calling
stopPropagation()).
Unfortunately, on Firefox, this fix breaks Ctrl-click and Shift-click,
because those are (apparently) implemented by adding an event listener
on link clicks, and stopPropagation prevents them from being called.
We instead work around this by handling this case in the click handler
of the parent element. (This allows the normal URL click AND Firefox's
bound event handlers for Ctrl and Shift to run.)
This resolves Trac #374 .
(imported from commit 16fb3aa6fc582f1fba5009812e0b1178ce7c5bb7)
2012-11-13 13:44:31 -05:00
Keegan McAllister
a91947fdde
Add a command to run the frontend test suite against a testing server
...
(imported from commit f72604e5be3e3342cf95bde8bedc4d1733e24d79)
2012-11-13 10:59:02 -05:00
Keegan McAllister
23bdc74863
Add a client test script
...
(imported from commit c31ba54ed0e15b1eab5a731471f40cfa1c87152f)
2012-11-13 10:59:02 -05:00
Keegan McAllister
9bbe12c6cd
Pause for 25 ms in between successful get_updates calls
...
(imported from commit e86c0b653669cf86b0d8956c2c85eb7610fc342f)
2012-11-13 10:59:02 -05:00
Keegan McAllister
31496e9189
Generalize Tornado-related settings
...
(imported from commit 76a1338a87e1a6663aa7602a499e2d769814bf08)
2012-11-13 10:59:02 -05:00
Keegan McAllister
921f7832c5
Import CasperJS 1.0.0-RC4-0-g8c798c7
...
(imported from commit b24184d9de034ecf4054dbc72cd6c28b49309182)
2012-11-13 10:59:02 -05:00
Jeff Arnold
488370b681
Fix various compose box bugs involving typeahead and field navigation
...
(imported from commit 08fe92794d566163bd935d43ec5bd7eb69978f90)
2012-11-12 18:04:31 -05:00
Jeff Arnold
bff933e0e2
[third] Modify bootstrap to help fix various compose box bugs
...
(imported from commit 6737adac5c09c41643210f4f0ae537304e0f87ae)
2012-11-12 18:04:31 -05:00
Waseem Daher
d7f146ed4f
Standardize on 'e', not 'event', within hotkey.js.
...
Mixing these two in this file is bound to lead to a world of hurt (and
has, historically). At some point I'd like to do this across the
entire codebase.
(imported from commit 9ff029597587f9c37a0bd9f32c25a769aa1a7a20)
2012-11-11 17:56:46 -05:00
Waseem Daher
cdb31303fc
Remove unused function.
...
(imported from commit 81ba1f66128f1e7f132ae3e1da3d81ad14d7ebe0)
2012-11-11 17:56:45 -05:00
Waseem Daher
c5f3018431
Simplify hotkey handling when combinations are involved.
...
This makes the "handle hotkeys" code path a lot simpler, and also
fixes the "copy not working" issue we were seeing on Firefox 17.
(imported from commit 8ab96d12895da2876f60da58f373372612f4ba32)
2012-11-11 17:56:41 -05:00
Waseem Daher
d76442c7e4
Process the whole key event through the hotkey handler, not just the key code.
...
(imported from commit c356dd09f7c2620c45d5bada61c0a5b261768888)
2012-11-11 16:35:45 -05:00
Jeff Arnold
5c7419307c
Fix style mistakes we didn't catch the first time
...
(imported from commit ae1ca10ea8559702e4e73481715239ff456eca4b)
2012-11-11 13:24:44 -05:00
Jeff Arnold
e7807742cb
Pressing "enter" in the compose box fields should not submit the form
...
Resolves Trac #333
(imported from commit 2a824c5d38a6b53a425c72f5eb3534fe26d75faf)
2012-11-11 12:28:26 -05:00
Waseem Daher
da571f16ff
Fix "resizing window breaks in Firefox" issue.
...
So, in Firefox, $(window).width() does not include the width of the
scrollbar. However, the CSS media-query max-width DOES include the
width of the scrollbar -- so the Bootstrap change and our change do
not happen at the same time.
window.innerWidth does take into account the width of the scrollbar,
though, and seems to have reasonable cross-browser support, so we use
that instead.
(If we wanted to be slicker, we could use a media query a la
https://developer.mozilla.org/en-US/docs/DOM/window.matchMedia ,
but that's not supported in IE <10.)
This resolves Trac #35 .
(imported from commit ca35321c02d5e79e4f9c439a662805c016a333ed)
2012-11-10 14:52:53 -05:00
Zev Benjamin
c3a17de14c
Don't switch to the not-composing state if the server did not accept our message
...
This fixes #349
(imported from commit 4e54f3ab3e9c91c5f23ccf22269775b01550f757)
2012-11-09 18:08:31 -05:00
Zev Benjamin
d41fde7d92
Rename parameter for clarity
...
(imported from commit c69a5a57467664631ba812c5237641e0203e1aaa)
2012-11-09 18:08:31 -05:00
Zev Benjamin
d980afcf25
Actually convert to JSON instead of hacking it with string concatenation
...
Old browsers might not have the global JSON object, so we may have to
include something like https://github.com/douglascrockford/JSON-js
for old browsers in the future.
(imported from commit e30a291d1212f2a00b543551b3a77082c7406eec)
2012-11-09 18:08:31 -05:00
Jeff Arnold
c800186553
Make tab not autocomplete on the compose box subject field
...
(imported from commit 7b305a3ca5ae5864255c4eca5464560f92b708b0)
2012-11-09 17:57:20 -05:00
Jeff Arnold
ef585cf1f6
[third] Create a Typeahead option tabSelects for whether tab autocompletes
...
(imported from commit d1602e998b54d39eb515d0866e7ed2d158fe97d8)
2012-11-09 17:57:20 -05:00
Waseem Daher
cb0f48b59d
Restyle subscriptions 'undo button' slightly.
...
Some stylistic tweaking to the solution to Trac #127 .
(imported from commit 5f9a84c91716e6e57cce2cef1d8ca0915e4b135f)
2012-11-09 17:13:15 -05:00
Jessica McKellar
d6ad978c1a
activity monitor: style tables and make them sortable.
...
(imported from commit 03c5002e6a289ca123b47f99c065b41cfc013762)
2012-11-09 16:45:18 -05:00
Jessica McKellar
a800904183
Add sorttable JS library.
...
(imported from commit a60799d0301a590a599fe70f1058006e1398faa9)
2012-11-09 16:45:17 -05:00
Jeff Arnold
7e3536960a
[third] Make tab move to the next field without autocompleting
...
(imported from commit 232d3662a0a910d8056ba838d7f07c8e774b23a1)
2012-11-09 15:50:05 -05:00
Luke Faraone
ed1caec147
Document the selctors in signup.js per trac #327
...
(imported from commit b21f5c4dbdc1b4dc5dbdc5a3152fdc8cbbb872ef)
2012-11-09 15:03:08 -05:00
Tim Abbott
30b43ebee2
Uniformize /json/ and /api/ URLs to end with no trailing slash.
...
(imported from commit c35b30bcc43982db3a2f774ea69269e5424a6159)
2012-11-09 14:30:10 -05:00
Zev Benjamin
565edc3c5a
Fix tests failing due to changes in error message text
...
(imported from commit 1b0a869d427b33a0e8fcec4e2aa083bd94eee640)
2012-11-09 14:21:06 -05:00
Zev Benjamin
50b3cdd637
Make failures parameter in get_updates_backend optional
...
This was causing our tests to fail and would have also
affected API users not using our Python bindings
(imported from commit 2d81496892e9042e328279edea94be8ee4d21c1b)
2012-11-09 14:21:06 -05:00
Tim Abbott
831316c6a6
Fix tests failing due to new activity tracking.
...
(imported from commit 9c7ddfd4ad40cd2dfd38ac41537e058e02797085)
2012-11-09 14:16:52 -05:00
Jessica McKellar
3af5e246be
Don't cache your personal gravatar across gravatar updates.
...
(imported from commit 06f82faaa350db8a64cebef24b738b5e93bebb98)
2012-11-09 12:44:09 -05:00
Tim Abbott
85423bc010
Add a /activity page displaying data on user activity on the site.
...
(imported from commit 3877be49e4e0b89cadfead88b5c51f955759a996)
2012-11-09 12:28:38 -05:00
Zev Benjamin
1e91310ee6
@has_request_variables: tell users what their bad value was in the error message
...
(imported from commit 0e5e576da74c6492c2f9189bcf725c336cd9b2d7)
2012-11-09 12:27:40 -05:00
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