Commit Graph

1293 Commits

Author SHA1 Message Date
Keegan McAllister 6e63ac926e Add rows.get_table()
This checks against the table name whitelist before building the jQuery query.

(imported from commit b296f117cdd2707aeb626328f8b0f9e00c723d59)
2012-10-26 21:03:52 -04:00
Keegan McAllister 138721ebbb ui.js: Wrap an extremely long line
(imported from commit e8bef501249cc11655780ab87c425c91e2ad4db5)
2012-10-26 20:41:08 -04:00
Keegan McAllister 19d4631e6f search.js: Call .each on the jQuery match rather than $ itself
(imported from commit cff239b483a8ef1a7997a1430f40a7fda11739b1)
2012-10-26 20:41:08 -04:00
Keegan McAllister a0eea37fd4 search.js: Wrap extremely long line
(imported from commit c5b76e2da4ebb8322b5a69bf0679fa7700bb7bd1)
2012-10-26 20:41:08 -04:00
Keegan McAllister 58ca5b3e24 Harden rows.get against bad input
(imported from commit af0283323089f6ed4edb4cb732fe1cc821fb5dd5)
2012-10-26 20:41:08 -04:00
Keegan McAllister 3ebee51ce0 rows.js: Use full module pattern
(imported from commit 770741958798317401e918a7b8331cfc2f73bf77)
2012-10-26 20:41:08 -04:00
Keegan McAllister 6bd2087d89 zephyr.js: Combine get_huddle_recipient{,_names}
(imported from commit dcb4c32250f4ff3a3cf32d999d6469916b17b06e)
2012-10-26 20:31:52 -04:00
Zev Benjamin 5413f74a7e Allow API users to update the pointer and receive pointer updates
The get_profile API call now returns a client_id, which an API user
can pass to update_pointer and get_messages (note that clients still
need to pass a pointer argument to get pointer updates).  This
client_id is currently the equivalent of the website's session key,
but the website might get client_ids in the future to distinguish
browser windows.

This commit differs from 88f6cf0033c849af88d1b99da3bdc2148dfbb6fe in
that it uses request.POST.get("foo") instead of request.POST["foo"].
For some reason the latter triggers CSRF errors.

(imported from commit b2a4a7322d16dbf241cd6eef146621c79d84cafc)
2012-10-26 17:17:09 -04:00
Zev Benjamin b36f1702fc Revert "Allow API users to update the pointer and receive pointer updates"
This reverts commit 88f6cf0033c849af88d1b99da3bdc2148dfbb6fe.
It seems to have broken API users.

(imported from commit 2f861ebc016076547092421f87dbcac00a65e2f6)
2012-10-26 16:19:57 -04:00
Keegan McAllister faa7565a75 Clean up duplicated code in setup.js
(imported from commit 86566f194497b618dff0be6ea2bc829204d03366)
2012-10-26 16:08:18 -04:00
Keegan McAllister 80ef222a60 Get the CSRF token from the DOM rather than a cookie
This simplifies the code, and lets us set the CSRF cookie as HttpOnly, which
adds a little bit of security.

(imported from commit 9d5923a1acf19bd27e6e1d55cf627049526de245)
2012-10-26 16:08:18 -04:00
Zev Benjamin a4fd478e3d Allow API users to update the pointer and receive pointer updates
The get_profile API call now returns a client_id, which an API user
can pass to update_pointer and get_messages (note that clients still
need to pass a pointer argument to get pointer updates).  This
client_id is currently the equivalent of the website's session key,
but the website might get client_ids in the future to distinguish
browser windows.

(imported from commit 88f6cf0033c849af88d1b99da3bdc2148dfbb6fe)
2012-10-26 16:06:41 -04:00
Waseem Daher 22e6a8ac1d Revert "Hide additional search buttons when not in use."
This reverts commit 074011dfe7dfa4d3cb331b32fc6cf465f98d095f.  For
some reason this introduces some buggy behavior, and if anything I
should debug it more locally first.

(imported from commit 182193e6bb466a5668c2bb64e41712a793fa7ca2)
2012-10-26 15:41:38 -04:00
Waseem Daher b0406ee1d2 update_floating_recipient_bar: Don't loop infinitely if no message selected.
(imported from commit a75cfd41ed8a8ce5256d1caa29f6c5bc0689e7d2)
2012-10-26 15:10:30 -04:00
Waseem Daher 9274437eb5 Hide additional search buttons when not in use.
(imported from commit 074011dfe7dfa4d3cb331b32fc6cf465f98d095f)
2012-10-26 14:55:42 -04:00
Waseem Daher 44a6a2b8a4 Have search bar always take on color of main area.
(imported from commit 85f6db17ca2fd616e4c7b63a98b80332cbddc1c0)
2012-10-26 14:31:05 -04:00
Waseem Daher e365b94a27 Restyle searchbox to look more consistent/bootstrappy.
(imported from commit 2d381fb6ea7f27846d583e27dda0fd1a6df77fab)
2012-10-26 14:31:05 -04:00
Jessica McKellar 92593b7cc8 Add basic up/down search functionality, including across narrows.
(imported from commit c82acad95e97733b87d65287c685caf7533a774e)
2012-10-26 14:31:05 -04:00
Jessica McKellar 74a75eea0c Add search bar and buttons above narrowbar.
(imported from commit 7def7d5824714a44c65d6a8e6699b2d8cda31418)
2012-10-26 14:29:30 -04:00
Jessica McKellar 14388baf4b Add jQuery highlight plugin, for use by search.
(imported from commit b596d0435db11f0369e2e6903714e2e1346b006b)
2012-10-26 14:29:30 -04:00
Zev Benjamin 652c524777 Try loading older messages after user is idle
(imported from commit bb3c39f9b5a9b7befb353647af75001ec168fc8d)
2012-10-26 13:31:14 -04:00
Zev Benjamin 807303a325 jquery.idle: don't allow the active handler to fire as a result of the user going idle
(imported from commit 28793228e50449b096dfe999a8cd17b7fa9e347e)
2012-10-26 13:31:14 -04:00
Zev Benjamin ec389c5c83 Non-asynchronous API calls only take two arguments
(imported from commit 39f21892e38b0f8c2369d77ffcfb077f1006863e)
2012-10-26 11:53:01 -04:00
Zev Benjamin 6ed1d38743 Show persistent pointer on narrow again
(imported from commit c871ec931ffad4bc692a908e687bb21c6cb2e7e9)
2012-10-26 11:44:28 -04:00
Zev Benjamin 9c838c44a1 Scroll to the correct message when narrowing
(imported from commit c6f11f3315f1d168b85f80ab524f322b399f5a85)
2012-10-26 11:44:28 -04:00
Zev Benjamin 8a66d52228 Expose get_old_messages to API
(imported from commit d3b86a049440c54b52d96c27f8925a73496eaffe)
2012-10-26 10:42:11 -04:00
Zev Benjamin ec9e0a4b9f Have get_updates include an "update_types" array in its response
This is similar to the previous "reason_empty" variable, but captures
why we've returned from the call even when there are updates and all
the reasons if there are multiple.  For now, it's useful for debugging.

(imported from commit fd8d9e859660e51b57178d066b184f831b71a0b6)
2012-10-25 18:12:11 -04:00
Zev Benjamin 51a39fdb0a Remove unused variable
(imported from commit 5a2a100aa3d9a577cde2517be3d9bacc2147fa7e)
2012-10-25 18:11:23 -04:00
Zev Benjamin 1c904e8607 Only start get_updates call after we've gotten all old messages
(imported from commit 8af46008a3abcdacb59e6223f38742a94a87b125)
2012-10-25 18:11:23 -04:00
Zev Benjamin a9583f6889 Fix get_updates missing messages between calls
(imported from commit 2b84df2a35a9a006b8548904ebf145a351a2e92b)
2012-10-25 18:11:23 -04:00
Tim Abbott f2c6347471 Return to failing clients immediately the first time.
(imported from commit b29df3165030ffd95dfe89b6471aeb74c06b6126)
2012-10-25 17:53:30 -04:00
Waseem Daher 44547e4e36 Properly check stream/subject lengths.
(imported from commit 1432266d8db1122f561e9e2f997071a19fb0f190)
2012-10-25 17:07:32 -04:00
Waseem Daher 98d7116ee8 Delete some dead code in signup workflow.
(imported from commit d07fffd4c0efdaaf4a233c1dbc9d09bc5ec03ad3)
2012-10-25 16:59:37 -04:00
Waseem Daher c894bab738 Compute a user's realm from the verified email address, not a user-passed field.
(imported from commit 5c220a7b9e4b137b5c98b286e409004318565137)
2012-10-25 16:50:00 -04:00
Waseem Daher 29d94b60b6 Add an "I agree to the terms of use" checkbox inside signup workflow.
(imported from commit 6d3320e71e189f4577da464fade9c8f7f5838f78)
2012-10-25 16:05:28 -04:00
Tim Abbott 0c54fab1e2 Check for too-long stream/subject names.
(imported from commit 6d37dff9af7e471e1e6a1ba77a9500bf5bb4ba7d)
2012-10-25 16:04:47 -04:00
Tim Abbott 7c8bde5d90 Add log/restore for fullnames and passwords.
(imported from commit 048ca3c86b9f077fcbccd5df4a509191a545da4c)
2012-10-25 15:52:26 -04:00
Zev Benjamin a798e14d86 Remove more unused code related to get_updates not returning old messages
(imported from commit d2cc795634c46d8a595ed15c093cfbfc113e6d10)
2012-10-25 15:48:35 -04:00
Zev Benjamin 47eeae0d36 Restore the "load more messages" button disappearing when there are no more
(imported from commit 4f46d49c88d9d0dadefe3e770868b6844dc80d64)
2012-10-25 15:45:14 -04:00
Zev Benjamin cf1d35fd62 Remove unused variable
(imported from commit 0636d51527ea9cac8b1ba5490bf5836cd4e79269)
2012-10-25 15:45:14 -04:00
Keegan McAllister 1d4f339eae bugdown: Hide alphanumeric characters in exception logs, for privacy
(imported from commit 39481494b7910307f56e566035c1b464c83d196e)
2012-10-25 15:40:01 -04:00
Zev Benjamin 451a041919 Remove the ability to fetch old messages via get_updates
Clients should use get_old_messages, instead.

(imported from commit 67847ef67d8ad4bf4af3f6082f85f0c76a41944c)
2012-10-25 15:31:27 -04:00
Keegan McAllister eef027560a Remove unused imports
(imported from commit eb576627ff72e57fee0e3a4c357f51ad74cd6c86)
2012-10-25 15:22:18 -04:00
Keegan McAllister 9629e7111b already_sent_mirrored_message: Reduce code duplication
and eliminate extremely long lines.

(imported from commit 29a08b1757c1bb3af1f82222fd7150db05f86034)
2012-10-25 15:22:18 -04:00
Keegan McAllister f8540dcdae Wrap some other extremely long lines
(imported from commit e7d55f318c8865ca953bf4520d1b07f7e84a4aeb)
2012-10-25 15:22:18 -04:00
Keegan McAllister b0462ebef7 Wrap extremely long lines in HTML
(imported from commit 4a18013ae001223709d91b7433128f8e75ebf399)
2012-10-25 15:22:18 -04:00
Tim Abbott 8c4a834206 Add function for activating MIT users.
(imported from commit 0de45fc341249332909d5a0ecef4d49918658a1a)
2012-10-25 14:46:58 -04:00
Tim Abbott 722249a9fc Use a variable for repeatedly referencing old_message['type'].
(imported from commit 1b8e8fef61582dab06ffbb9a9b71c83c2629f0f2)
2012-10-25 14:46:43 -04:00
Tim Abbott 6e1ec1a2ec Move our various bots into api/bots/.
(imported from commit f5803441b9b84872b942dff8e1c0ad1100788bcd)
2012-10-25 13:53:34 -04:00
Zev Benjamin c047502840 Use get_old_messages in client instead of get_updates for loading initial messages
(imported from commit 169b3720c1fa10606f2351039cac9655bb5165b4)
2012-10-25 12:10:44 -04:00
Zev Benjamin c4189d1029 Add get_old_messages json call
This new call only allows fetching of existing messages.  The idea is
to remove this functionality from get_updates to simplify the backend
code.

(imported from commit 1345db2f1707e208e7c0bd08b7d444932c68b6a2)
2012-10-25 12:10:44 -04:00
Zev Benjamin 07263f3a0e Rearrange functions
(imported from commit 814f2acbf574bf1eeb32e23ab28e76fc94f877ce)
2012-10-25 11:26:53 -04:00
Waseem Daher 22a32c09c4 Add a shortcut to pull up the shortcuts dialog.
(imported from commit 0d6d3ba78a06f0eb1ecba8e6a571b79709980cef)
2012-10-24 18:31:44 -04:00
Waseem Daher 50da6b14d1 Add keyboard shortcuts dialog.
(imported from commit 1adb18597739dd71f4739dcf0c2da34c82598bd6)
2012-10-24 18:31:44 -04:00
Keegan McAllister b5cc259f5b Set input/textarea font to match the rest of the page
(imported from commit 69b7d6399e6db46dc5a4f777395e3cd636427023)
2012-10-24 17:16:43 -04:00
Keegan McAllister 26c97729d4 bugdown: Generate HTML, not XHTML
Our pages are declared as HTML5:

    <!DOCTYPE html>

The markdown library only supports HTML4, but that's probably closer than XHTML.

(imported from commit c78be9ae9bccf029def8d94d3647b0ccce8b2252)
2012-10-24 16:02:15 -04:00
Keegan McAllister ab34200648 Make sure that Markdown rendering really happened, if requested.
This is a security issue because it's where we escape HTML.

(imported from commit 10dea1899eb6d7e0e40128ae1a4787abad38fa73)
2012-10-24 15:43:46 -04:00
Keegan McAllister b30b5f396e to_dict: Include the content type with each message
(imported from commit 413ce08029832c6bed2a43f27a1caf809fb962b6)
2012-10-24 15:43:43 -04:00
Keegan McAllister 734411369b format_updates_response: Default to apply_markdown=True
It's the safer default to prevent introducing XSS holes.  And in our current
code, we always provide this parameter.

(imported from commit 73897f5315ba54a5d3fa95dd19efb9d20c081a8a)
2012-10-24 15:32:12 -04:00
Keegan McAllister e8dfb41f70 Return messages from return_messages_immediately, rather than calling handler.finish
(imported from commit 0da3356c6712614cf1816d330b891e8f6d13bac7)
2012-10-24 15:32:10 -04:00
Keegan McAllister 7da2ddea8e Reorganize to[_log]_dict
(imported from commit 2f811cf6a42e5b5661679158c0053dd4ebb40dbd)
2012-10-24 15:07:14 -04:00
Tim Abbott 75d150efc7 Fix being unable to send messages with a trailing comma in recipients list.
(imported from commit 5c075c4aa1da8c2a153b33ed4d061fac88de48e7)
2012-10-24 14:25:55 -04:00
Keegan McAllister 9e7e4fda91 Explicitly size Gravatars in message bodies
Should make the page jump around less on load.

(imported from commit a4b52a545b84117d149a2d5852ea0ddb71862748)
2012-10-24 01:02:10 -04:00
Keegan McAllister f3f9fb545d Narrow by recipient when the user presses 'S' on a huddle
(imported from commit 7e7c3d27b0824a60f7e8379c282ec05704d842f6)
2012-10-23 23:04:42 -04:00
Keegan McAllister 8fa0e687ae Disable manual compose box resizing
Vertical resizing is controlled by Autosize, and horizontal resizing is just
weird.

(imported from commit ff0b0e5d26678abfad1bec82fb5cf17b846160eb)
2012-10-23 22:20:13 -04:00
Keegan McAllister 143665a22c Enforce a maximum compose box textarea size
The Autosize plugin reads and honors this value.
Nicely done, Autosize plugin!

(imported from commit 554149afd7cc6cd436590bd8c5ef77608645ea07)
2012-10-23 22:13:52 -04:00
Keegan McAllister 899e6d1042 Resize the compose box on show
It doesn't work to do this immediately after we clear the contents, for some
reason.

(imported from commit b24e2464afc7a4703d4a679ab0b51ac150f1ce89)
2012-10-23 22:08:47 -04:00
Keegan McAllister b976aa621c Set a starting height for the compose box
(imported from commit a70a473523a2ab97996230ecf29e3ecd86341246)
2012-10-23 22:08:47 -04:00
Keegan McAllister af065005fc Automatically resize the compose box
(imported from commit 7e9cb632bdca47fee6ad0897a55d1d3c004c34b3)
2012-10-23 22:08:44 -04:00
Keegan McAllister 3c4ddfdaf9 Import jQuery Autosize
http://www.jacklmoore.com/autosize

With line endings converted to UNIX format.

(imported from commit bb23cb01a9587df842af60e67dd85bf34abab9c0)
2012-10-23 21:49:24 -04:00
Keegan McAllister eaecaab7f4 Rename narrow.all_personals -> all_huddles
(imported from commit 6258ddd1548b6ee8cf20c28c9b18e229ebf4e720)
2012-10-23 20:43:23 -04:00
Keegan McAllister f0bebe1cc0 Change 'p' hotkey to 'h', for 'huddles'
(imported from commit 3415f1d3f679be41cb5b92827036b09829a99734)
2012-10-23 20:41:54 -04:00
Waseem Daher 8ce8a083bb Slightly hackish way of stripping out &nbsp; in narrowbar tooltips.
(imported from commit 414738408cd1e4e53f0268b0851c903c6a1a9eda)
2012-10-23 20:30:58 -04:00
Waseem Daher feff1d811d Allow icons in narrowbar without putting their HTML in the title text.
Before this commit, a hover read "<i class='icon-whatever'></i> All huddles with..."

(imported from commit e5a20678b87355d6709ec3b8776469114c92b2f6)
2012-10-23 20:21:51 -04:00
Waseem Daher 689014fe23 Don't allow userinfo popover contents to overflow.
In particular, long email addresses.

(imported from commit 3ee9121c577e01277ac7888bed13bdb654ef77b9)
2012-10-23 20:18:20 -04:00
Keegan McAllister 718018bbf6 select_message_by_id: Fix return value when already selected
(imported from commit c86509f6cf040d6acb771764d7fe2b40afa72fe3)
2012-10-23 19:34:54 -04:00
Keegan McAllister 20ae526963 [third] Bootstrap: Slightly lower threshold for widest responsive layout
...from 1200 to 1180 pixels.

The monitor I use for Humbug is exactly 1200px wide.  With the scrollbar I come
in just under the original Bootstrap threshold, so I get a scrunched-up nav
sidebar next to a bunch of empty space.

It's annoying to do this in our own CSS because we basically have to duplicate
the whole @media block to make everything fit together.

I don't love editing third-party files like this, but if it gets reverted by a
later update, the consequences are minimal.  If we have important hacks like
this (or just a lot of them), we should decide on a better way to manage them.
For now I have just tagged the commit subject with "[third]".

(imported from commit ef3022b7eb0fdfc8862083bdbb1fb805fbeba2c7)
2012-10-23 18:31:45 -04:00
Tim Abbott bcfe06c69c Don't show floating recipient bar when narrowed to huddle/subject.
(imported from commit b7cbd83035292ed447a3da666df9326d75aac35e)
2012-10-23 18:29:54 -04:00
Keegan McAllister 0c477fac47 Always display the scrollbar
When the scrollbar appears/disappears, it changes the window size for the
purpose of responsive layout.  This made the nav sidebar jump around as you
switch tabs.

(imported from commit 8174a8571131ddf2b195cf9bfb5e427cd07b4378)
2012-10-23 18:13:48 -04:00
Waseem Daher 037f523990 Hide unimplemented, currently-greyed-out options in navbar, etc.
(imported from commit f33c3949979530b691743e29fb05f54808111b4e)
2012-10-23 18:07:04 -04:00
Tim Abbott f1e4a27106 Optimize populate_db's common code for setting up real users.
(imported from commit 074b30ac88101f8e00ddcb60b5b05defc0a11998)
2012-10-23 17:52:10 -04:00
Tim Abbott 1b67b6b711 Don't deliver messages to "fake" Zephyr users created by populate_db.
(imported from commit c88760a88382ffc07cf5f79f3093a2bfec429d53)
2012-10-23 17:52:10 -04:00
Keegan McAllister afdd3af1b6 Handle having no selected message more gracefully
(imported from commit ba00c012061b35dfe490bf1312b3fa78a4f6582f)
2012-10-23 17:03:31 -04:00
Keegan McAllister 0744332658 select_message: Reliably return success or failure
(imported from commit 5e6b4066bd53a9b958ec0e752550feb423e52de5)
2012-10-23 17:03:31 -04:00
Waseem Daher 0af3a0cd19 Typo fix.
(imported from commit 1ed0841b5ff5eea44ad064062942183db266d104)
2012-10-23 16:59:42 -04:00
Waseem Daher 9440c356da Don't highlight "You and" on-hover in the composebox.
(imported from commit 901b7a2a943a7e60bb71e38d3ce53180aba9c93f)
2012-10-23 16:53:25 -04:00
Zev Benjamin d4c2fd6cb6 Don't update the pointer on the server when the client receives messages
(imported from commit 54a0d10e94d2f4d39a29d4c8596bf4712c1eb45b)
2012-10-23 16:39:05 -04:00
Zev Benjamin 8a39292b5d Fix bouncy pointer from pointer updates
The previous code path was buggy.  We now do separate pointer update
checking for the cases where get_updates returns immediately vs. when
it returns from a callback.

(imported from commit f236a80cd0b94bc097dbd17f113d7a9d27368025)
2012-10-23 16:39:04 -04:00
Zev Benjamin 5ee6982a7e Use a different format function when we don't respond to a get_updates immediately
For now, the new function, format_delayed_updates_response, just
calls format_updates_response.

(imported from commit dd332125fe0d47cb3990373f74e85e64604f58a3)
2012-10-23 16:39:04 -04:00
Zev Benjamin c8dd5229ed Rename updater_session to pointer_updater
(imported from commit 7646b8e636393d64ef07d0251f8c83beecf114aa)
2012-10-23 16:39:04 -04:00
Zev Benjamin 6c4b56517f Revert "Temporarily disable pointer sync"
This reverts commit 7d8f673559ca6359923aa0bdd48edebe0955e921.

(imported from commit 32f7ad925cc4df72220a191602487620a9970f43)
2012-10-23 16:39:04 -04:00
Keegan McAllister e7746e97e8 select_message: Fall back to the last, not first, message
This seems more likely to be what people want when e.g. viewing all huddles.
Later we can get more clever and select the nearest huddle, or something.

(imported from commit 8ec1aa02c050dd25eb868b1e317d114743525c7b)
2012-10-23 16:31:05 -04:00
Keegan McAllister 37ac9d2a91 select_message: Misc cleanup
We can safely call .is(':hidden') on an empty jQuery result and get false.

(imported from commit a73932f63b8fec7c43d8603fca95adcd4f164317)
2012-10-23 16:28:40 -04:00
Keegan McAllister d34bebc584 select_message: Properly fall back to the first visible message
Our old selector here was picking up the floating recipient label, or
something.  This was breaking narrow-to-all-huddles when on a stream message --
you get no selection and the code is sad.

(imported from commit d25fab03bd6d745df6d787c0b1b6452c8c539e32)
2012-10-23 16:28:40 -04:00
Keegan McAllister b049749cb2 New hotkeys for narrowing
- s for stream or huddle
  - S for subject
  - p for all personals (still buggy)

We've eliminated the 'g' prefix entirely.  And the old 'g-a' un-narrow sequence
has no new equivalent, but you can still use Esc.

(imported from commit 6bdaacce9639e3f749418e06622a317937e7d014)
2012-10-23 15:28:07 -04:00
Zev Benjamin ce3ea9f019 Temporarily disable pointer sync
(imported from commit 74e6bb347e0b8c01b6450914a50448b78b9749c9)
2012-10-23 15:24:00 -04:00
Waseem Daher f69bd6ad4b Fixup display of huddle messages.
(imported from commit 981fc7998c695b8e6a75d7b00da0a63e0cc4164a)
2012-10-23 13:55:34 -04:00
Waseem Daher cd62827158 Fix issue with border on huddle messages.
(imported from commit 6a671dee15bb407207d34f7495987cbcd012d9a0)
2012-10-23 13:31:52 -04:00
Keegan McAllister 86159813df Hide the "Load older messages" button in narrowed view
Ideally this would be part of hiding zhome, but right now zhome/zfilt are
assumed to the tables themselves, and changing that seems unfortunately
invasive.  And it's not crazy to think of the "loading controls" as a logically
separate thing that we might show/hide independently.

Longer term, we may want an indication in narrowed view that there could be
more messages on the server.

(imported from commit eb72d720da7c03f6f1378ae18ab6e973bf98247f)
2012-10-23 13:28:08 -04:00
Luke Faraone a139f8b6b2 Fix incorrect references to userprofile in the API
(imported from commit 77c062b54c545185aee28189726f61a874a1fe77)
2012-10-23 12:05:56 -04:00
Zev Benjamin fca4cade34 Ignore long-poll successes with no data
The server will occationally return successfully with no data during
a restart.  Previously, when we would get such responses, the page
would stop working because of JS errors.

(imported from commit 39b89907dc5ae9a9eb54ebf60d0069281e401786)
2012-10-23 12:03:56 -04:00
Tim Abbott 9779ca9e5c Shorten get_updates timeout to under a minute.
(imported from commit fcc87011051c25051861e3c36e442398cd3ca3c0)
2012-10-23 11:31:32 -04:00
Tim Abbott 386b48e80f Don't log tabbott/extra test messages.
(imported from commit 8e1adecca14e5440298fd93b41e1a43da37c807f)
2012-10-23 11:08:27 -04:00
Tim Abbott fdeab96b4c Add a default client name for the API.
(imported from commit a14b2f8bd9ff604c5f522c85842d296be38d33e6)
2012-10-23 10:54:36 -04:00
Zev Benjamin ed05e28e55 Update server when selected message changes via scrolling
(imported from commit a763baf064e73d358632f3754aba940d188f733d)
2012-10-23 10:30:59 -04:00
Tim Abbott a9667d81a8 Fix performance regression caused by last commit.
(imported from commit f0abf93dbab92c5627903284fafad310de039fe6)
2012-10-22 22:01:55 -04:00
Tim Abbott 8c16295301 populate_db: Fix replaying personal messages from logs.
(imported from commit 685a426fe59fa240c8ae5cf357a43d4df0a3f05d)
2012-10-22 21:36:32 -04:00
Tim Abbott 846469c39c [schema]: Rename userprofile to user_profile.
(imported from commit adfb6152b7ec32557e3465d961695eb870506d5a)
2012-10-22 18:55:45 -04:00
Keegan McAllister cec9649b0d Brighten the hover color for huddle recipients bar
The Bootstrap default color is too dark against a black background.

(imported from commit 2a0b320564d004ddc606856d004864ba21763a94)
2012-10-22 18:34:12 -04:00
Tim Abbott 93616039bc Use the new client data model to deduplicate mirroring.
(imported from commit 6ac38534aea11b1e7f8f332e76251f9501f9ab3e)
2012-10-22 18:31:36 -04:00
Zev Benjamin 899d5c776f Check reason_empty on client when there are no new messages
This fixes a problem where the client would never stop asking for old
messages (bug introduced during rebase)

(imported from commit eef9f19e1e9982b1e0a954eb36a81e1b7ee5b564)
2012-10-22 18:19:14 -04:00
Tim Abbott 1b1d5cb577 Fix all mirrored stream messages appearing to be from me.
(imported from commit 777f98a564d3f169d3c69fcda980ce5993910d88)
2012-10-22 17:59:21 -04:00
Keegan McAllister 4ca720a0cd bugdown: Install autolink pattern after link pattern
This fixes explicit links.

(imported from commit 6867d271344d35c2c8d54b3393219113a095bc4f)
2012-10-22 17:48:48 -04:00
Tim Abbott 2b1902dcc7 Return a user_profile from create_user_if_needed.
(imported from commit d71a9b1f326f783e387bb70b5215c934799fb5f2)
2012-10-22 17:47:05 -04:00
Keegan McAllister 05c08b41c4 bugdown: Disallow ()[]{}<> in linkified URLs.
This allows us to handle messages like

    my website (available at http://google.com)

(imported from commit 51330507947fc039b6f29f06dfa1c6d21f779aa4)
2012-10-22 17:32:39 -04:00
Keegan McAllister 1c4bbd6a49 bugdown: Start a URL with a word boundary, not a space
This fixes the bug where we were eating the preceding space.

(imported from commit 9eca01e6ad828ccc31ad10693339f381333e76a7)
2012-10-22 17:32:39 -04:00
Zev Benjamin 0f474285bf Up idle timeout for reload
(imported from commit 7d9c7dbd77f49865d7e1922ddcee08cd963f4abf)
2012-10-22 17:30:26 -04:00
Tim Abbott bce793005d Fix mirroring of personals.
(imported from commit 91ae9e6bb20389a708bd6b1945c898b98b96ee4a)
2012-10-22 17:21:07 -04:00
Zev Benjamin f817bf6144 Pass the session that updated the pointer from Django to Tornado
This allows us to check whether the session that updated the pointer
is the same as a session that is doing a long poll to avoid sending
new pointer information when that information is coming from the same
session.

We still return from the long poll early, though, which is sub-optimal.

(imported from commit 7d4be0956f112eacefb7d198ea929957cd2b05e3)
2012-10-22 17:16:47 -04:00
Tim Abbott d17db6687c Improve validation of zephyr mirror data.
(imported from commit 9ebc43d17d1f4040da2deff271ba7e158908a29b)
2012-10-22 17:08:09 -04:00
Zev Benjamin 732ca19729 Synchronize the pointer across sessions
The client may now optionally send its current pointer during
get_updates and the server will return the latest pointer if it
differs and was updated more recently by a different session.

(imported from commit e43b377d7dfb52f83cefb0b1003863d5407caf80)
2012-10-22 16:44:57 -04:00
Zev Benjamin 7e4b7fb881 Add message selection option to not update the server
(imported from commit a5ef9506be24fee7652cd5479cb74789aa365216)
2012-10-22 16:06:38 -04:00
Zev Benjamin bb64eb717f Make select_message and friends take an options argument
The select_and_show_by_id function is now subsumed by select_message_by_id.

(imported from commit 3dbe9cf9d253b64733f269b6dc78c144100927ca)
2012-10-22 16:06:38 -04:00
Zev Benjamin 35bb3613cd Rate limit pointer updates to avoid hammering the server
(imported from commit e1add1b64779f3d0caf5426eb99233e78de278ae)
2012-10-22 16:06:38 -04:00
Zev Benjamin 66d7678423 Add UserProfile callback for pointer updates
(imported from commit bfa9c15d82f092a1810cfcee1a88e1e292bc4cb8)
2012-10-22 16:06:38 -04:00
Zev Benjamin 2a4c3b5bff Abstract the callbacks table in preparation for more kinds of callbacks
(imported from commit 695d5bceb4657ef25ba5983212082ee0c76b9d33)
2012-10-22 16:06:38 -04:00
Zev Benjamin 7ac0625e39 Add model field indicating which session most recently modified the pointer
(imported from commit 819ab358d9fa6f22ad8ccee56fe723ea7711ebc5)
2012-10-22 16:06:38 -04:00
Keegan McAllister fcc21bec21 5xx: Reformat text
(imported from commit eaafd17560714729b23df8947a94ebd1815cec23)
2012-10-22 15:22:49 -04:00
Keegan McAllister ba85e3babf Add a static 5xx error page, for nginx
(imported from commit e0ca9ba4e88f4825954c3b70c7b1acadb5b37779)
2012-10-22 15:16:04 -04:00
Tim Abbott b353fd4abd Use sending_client to check whether messages are mirrored.
(imported from commit 6202739e21dfb308ed551656a8a0cdf7311972f7)
2012-10-22 14:52:08 -04:00
Tim Abbott a695732bda Seed the populate_db random number generator.
This makes it not to produce 10 copies of each message.

(imported from commit 35ab5f14ec104b4ea52137dac4fa2840194f3777)
2012-10-22 13:59:46 -04:00
Tim Abbott f26a614bb3 Fix Client handling in the test suite.
(imported from commit 56841a00052c3aa85f2eeb45133439a46f3caf82)
2012-10-22 13:23:16 -04:00
Keegan McAllister 7cf8f842f7 Allow in stream names any character classified by Unicode as alphanumeric
Also correct a comment.

(imported from commit 5c03032b90dbaf38d880651004733e4399b422ee)
2012-10-22 12:58:39 -04:00
Keegan McAllister 189d42428a bugdown: Log Markdown parser failures
(imported from commit 9e225a32b71edbfd9007cc2fbae32be31896233d)
2012-10-21 23:07:03 -04:00
Keegan McAllister 4a0cf8e608 bugdown: Disable builtin 'autolink' feature
This only linkifies inside angle brackets, per

    print md.inlinePatterns['autolink'].getCompiledRegExp().pattern

We have our own linkification extension.

(imported from commit 20cab11aaafee075e0caf933d8d197717976988c)
2012-10-21 21:03:18 -04:00
Keegan McAllister 00a4da5f9b bugdown: Disable automatic mailto links for <foo@bar>
This feature was throwing exceptions on input like

    <@`x`>

Reported upstream as https://github.com/waylan/Python-Markdown/issues/155

(imported from commit 6b14a65599def0346f76cf017be66dd80f42db49)
2012-10-21 21:03:18 -04:00
Keegan McAllister 4db8587805 bugdown: Decrease code duplication
(imported from commit 40158134b60e477d8a353d050fa62c9ded0e9e9f)
2012-10-21 21:03:18 -04:00
Keegan McAllister 649cd15415 bugdown: Linkify using a Markdown extension
This prevents trying to linkify inside code blocks.

(imported from commit 97dd20ecee19f41650aa98e68aa8e9908ece5b33)
2012-10-21 21:03:15 -04:00
Keegan McAllister d72aea25f2 bugdown: Use named match for Gravatar email
(imported from commit 778c4b6d754f975c89a91336593d2f62e49249d5)
2012-10-21 20:16:07 -04:00
Jessica McKellar f5f3ffc6a9 Expose an API method for updating the pointer.
(imported from commit 66d49c149e0bbc60e82a5967b77aff69629b09e7)
2012-10-21 13:33:14 -04:00
Jessica McKellar 0fb836538d Add an API request for getting profile (specifically pointer) data.
Mobile clients need it.

We are going to need to sit down and think about how much power we
want to give our API users, though. For example, should they even get
to know about your absolute pointer value (maybe they should only be
able to make requests relative to your pointer), or be able to request
very old ranges of messages?

(imported from commit 1680655f0d9a670bc0da0ddb92fbbd5cf851d3dd)
2012-10-20 21:59:59 -04:00
Tim Abbott 7530163fb8 Fix stream Verona's Recipient being created twice.
(imported from commit 710572ff8681530c52f861d9e5607eaf8390c657)
2012-10-20 20:06:43 -04:00
Tim Abbott d3a693080e Fix receiving messages on the ShakeSpeare streams.
(imported from commit 4ce60d57e66363da1bd3c2b93fcf008eee795769)
2012-10-20 19:54:29 -04:00
Tim Abbott 6a7cbaf4b1 Add some more defensive lower-casing when creating streams.
(imported from commit 25a62b0105ce7b6b871b7570d087970fed7c6d9b)
2012-10-20 19:52:01 -04:00
Tim Abbott dab25bdff7 populate_db: Be a little more defensive about message types.
(imported from commit fe23365180847065a9a3292f7873dcb36bb277db)
2012-10-20 19:48:05 -04:00
Tim Abbott 55d9c08c83 populate_db: Fix case bugs importing old messages.
(imported from commit dba8e3419f5827344a42f28c31798fdaff7cf002)
2012-10-20 19:43:06 -04:00
Keegan McAllister 03dcd8ab2e Restore default formatting for <code> inside <pre>
(imported from commit c9c23b8b7709e9edc6cf1bf2f88811bdf511d2ac)
2012-10-20 19:26:53 -04:00
Tim Abbott dcfef6b1a9 Fix restored personals going to the wrong user.
(imported from commit 362c9f3d833c96a5f3530138a0e9360bff183cbf)
2012-10-20 19:20:48 -04:00
Tim Abbott edf9a8e7e5 Fix incorrect setting of initial API keys in bulk import.
(imported from commit ec492c787a5575f1f7b2fe68986999bbdd072a04)
2012-10-20 18:48:12 -04:00
Tim Abbott 7b3b4362dd [schema] Add a Client model keeping track of the sending client.
(imported from commit 31a430b1de14ce973addafd5d13ace049a8f8091)
2012-10-20 18:41:54 -04:00
Tim Abbott 2c89103b23 Actually update current subscriptions based on changes in logs.
(imported from commit b36637562dd0e358f1718d38778c735bb75fd77a)
2012-10-20 18:41:51 -04:00
Tim Abbott 1fcb4c0576 Fix error handling for removing subscriptions.
(imported from commit b95a706ed9499e96c4ff27ca583ed10dab674736)
2012-10-20 18:26:21 -04:00
Tim Abbott a8e4c818c6 Make logging of new subscriptions conditional on changes.
(imported from commit fff72906a52838bba144a960c0bc6a3487bef41b)
2012-10-20 18:26:21 -04:00
Tim Abbott 56dab6cb26 Log changes to subscriptions and replay them in populate_db.
(imported from commit d3055eb44326bdc59a6bc96d00b5b0bc6da86059)
2012-10-20 18:26:21 -04:00
Tim Abbott d68cf3696b populate_db replay: Use bulk_create to create objects.
This cuts the time required to import 38000 messages (with 140000
message receipts) from about 10 minutes to just under 40 seconds on my
laptop with sqlite.

(imported from commit d53b0d1360408c77f38353b58fbb25875262cb40)
2012-10-20 18:26:18 -04:00
Tim Abbott b2ce9aaa18 populate_db replay: Parse the json from old messages first.
(imported from commit bdd900b7618ce85d27eebe4d2a745c4d2734cb85)
2012-10-20 10:44:50 -04:00
Tim Abbott bf007776ce Fix selecting huddles using the mouse type-tabs.
(imported from commit 6b9981cf6d5a5aaf9d644a18cc04397f3cf0dead)
2012-10-20 10:35:39 -04:00
Tim Abbott a8ee0ecc69 Fix bug allowing subscribing to a stream twice.
(imported from commit c49b7c8ec49fd71bb1e1f1226d9e126d4d0987df)
2012-10-20 10:15:12 -04:00
Keegan McAllister 61a33f4c4d bugdown: Disable line numbering of code blocks
Pygments renders these using tables, which breaks our client's assumptions
about what <tr>s mean.

(imported from commit 46d37395785e06fb183d17b08afed4c6f5957baa)
2012-10-19 23:54:10 -04:00
Keegan McAllister dc8bc9e1af codehilite: Allow the caller to disable line numbering
(imported from commit 4257cc1b8b1e2a78cb36d4fdf105a5864c1b20fa)
2012-10-19 23:54:10 -04:00
Keegan McAllister 0edbc80616 Use our local copy of codehilite
(imported from commit bc9704a19017061d55ff0e16589d57ee0c46caa5)
2012-10-19 23:50:32 -04:00
Keegan McAllister 5e1654b9b5 Import GitHub version of Markdown codehilite extension
(imported from commit 166f85fabf8a80858240c2610437002e49f98278)
2012-10-19 23:30:47 -04:00
Keegan McAllister 086e1b1c33 Make bugdown able to contain sub-modules
(imported from commit 6fa5a6cd8f972e3afb21b65bdfca927e824194aa)
2012-10-19 23:30:14 -04:00
Keegan McAllister 0d05557ffc notify_new_message: Allow request to have come from IPv6 localhost
(imported from commit ef477ced6695f866f8d265d980f8401670b3c95c)
2012-10-19 22:34:46 -04:00
Keegan McAllister 86b4da9d83 Put a new user's pointer at the bottom
(imported from commit 65ae2483d6bcfb96cc97bdb689d8174737bde5b0)
2012-10-19 20:44:09 -04:00
Zev Benjamin 33c40bd9ba Don't reload the app after sending messages
(imported from commit 0985a3e7d13b1be00ae0b190914aeb3647ba196a)
2012-10-19 18:25:57 -04:00
Tim Abbott e434fa141e Use .objects.create and .objects.get_or_create.
This eliminates a bunch of unnecessary code and also fixes a bunch of
places where we were improperly not using transactions.

(imported from commit f194ae9226f9229fc56a0b1b21615534f486ea0c)
2012-10-19 17:42:14 -04:00
Keegan McAllister 5b13f9192f Load more messages when the user presses the "Load more messages" button
(imported from commit 060e6f67b13fd67b56f80f913eb6b835860a8115)
2012-10-19 17:13:14 -04:00
Keegan McAllister 7693695fc0 Tell the client why we are returning an empty list of messages
(imported from commit cc17ed2d8389f6be1170081e70c1d8a7f0556ac3)
2012-10-19 17:13:13 -04:00
Keegan McAllister 3dfed7b6a1 Add a "Load more messages" button
...which currently does nothing.

(imported from commit 185b35c2bf651779bfcdba44524d1bcb8af74f27)
2012-10-19 17:13:13 -04:00
Keegan McAllister fa011c108c Factor out restart_get_updates
(imported from commit 03755dccbbe296e8c5208c460d80645c0fa17e14)
2012-10-19 17:13:12 -04:00
Keegan McAllister c67e7035aa Limit the number of old messages the client requests
(imported from commit 6bff6aa0b48d46b98aa68c6e29eb569cf41f4989)
2012-10-19 17:13:08 -04:00
Zev Benjamin a80e08fbf3 Fix typo
It was preventing the right text area being focused on huddles

(imported from commit 8ebe457b4e5bce723e3afd9f396f97eeb0e97c46)
2012-10-19 17:04:28 -04:00
Zev Benjamin 9c2da407e6 Update the current composition type on toggle
This was preventing huddles from sending because clients thought they
were still sending a stream message.

(imported from commit 694b06cbc43adc9563327ebffccb7fa37aa36bac)
2012-10-19 17:00:27 -04:00
Zev Benjamin 337836ef54 Fix initial focus on new messages
(imported from commit 4553f6209362f684110b34e92fdba2046cfbb08e)
2012-10-19 16:17:29 -04:00
Zev Benjamin 9de73b5a91 Be intelligent about which input box is highlighted in compose.start()
(imported from commit 37268601d569fdb510415ebfae594804817c0e3a)
2012-10-19 16:09:13 -04:00
Zev Benjamin 2a98045406 Fix responding to messages (broken by rebase error)
(imported from commit 1fac8d8757ee7f9b79c35e884edaa37e5cca0120)
2012-10-19 15:59:03 -04:00
Zev Benjamin 88e09c6166 Only reload the page when the user is idle
Also, clean up reload-related function names a bit

(imported from commit 4c2e17c06d7567e71b92f6e1b04a44aeff419bff)
2012-10-19 15:53:05 -04:00
Zev Benjamin ae08f512dd Enhance the jquery.idle plugin with functionality we need
The following things were changed
* The list of events it listens to by default was expanded
* It now supports canceling timers
* Calling .idle() on an element now returns a control object that can be used
  to manipulate the timer
* Small tweaks to variable names, arguments, jQuery usage, etc.

The code probably still needs some cleanup, but I'm sick of looking at it
right now.

(imported from commit 6868cb6fd97ab994a871f5ed6951995b254e340e)
2012-10-19 15:53:05 -04:00
Zev Benjamin 9752ec8963 Add a jquery module for tracking idle time
(imported from commit 553a7600ab817330ea862dee9887ba08595e0c4d)
2012-10-19 15:53:05 -04:00
Zev Benjamin 1b47cd58f1 Rename compose.message -> compose.message_content to avoid confusion with new API
(imported from commit cce8baba49a4176bdb900a83006db3bf23bcd82b)
2012-10-19 15:53:05 -04:00
Zev Benjamin 08b4bd0d9c Determine whether the user is composing based on a flag instead of element visibility
The flag is set to the kind of message being composed in
start_composing() and set to false in finish_composing().

This avoids the problem where composing_message() will return true
when the animation is still running.

(imported from commit 4c2e7e1fad2e6b2123825bd51d5b24ae41bccd45)
2012-10-19 15:53:05 -04:00
Zev Benjamin 621909df6b Add custom jQuery events to the compose abstraction
(imported from commit 3ff10baafd0825ed8b7ed50a8b668080d1e9f303)
2012-10-19 15:53:05 -04:00
Zev Benjamin 7a44a3b05a Use the new compose API
(imported from commit fb91febbd5c257aea15292d8071da69a3e6b9a99)
2012-10-19 15:53:05 -04:00
Zev Benjamin 746897b36a Add a compose API for starting, canceling, and finishing messages
(imported from commit 372e1c2ae19a72bcbb989fa2be5c510a1278fc69)
2012-10-19 15:53:05 -04:00
Zev Benjamin ab382040c1 Make get_updates reload_pending request parameter an integer
This fixes a bug where the server wasn't returning from get_updates
immediately when the client needed a reload.

(imported from commit 1d854eb1c7061f468d091e103f10074f4c7231d8)
2012-10-19 15:53:05 -04:00
Keegan McAllister bbb67f61cc populate_db: Indicate progress on --replay-old-messages
(imported from commit 1f1043bca0952650c744d6012b11d607f2eb3cde)
2012-10-19 15:17:34 -04:00
Keegan McAllister ec0bbdc1df Hide horizontal scrollbar on .message_list
(imported from commit 09600ce19074546285173f8ab8317322d4d0e417)
2012-10-19 15:17:33 -04:00
Waseem Daher 17d44be14a Display huddles as 'You and...'.
(imported from commit 35fe0e56751b1a2993bd99181e8bbd57e8c3ce81)
2012-10-19 15:11:13 -04:00
Waseem Daher 647f3c1220 Hack to make narrowbar line up a liiiiitle bit with real bar.
(imported from commit 83f0066def43b2a35e2d8aa089f5962617cf5546)
2012-10-19 15:07:08 -04:00
Waseem Daher 7fdac68787 Tone down some of those icons.
(imported from commit efd22df34b87ccb0603b73fed85b10f08bbd47b0)
2012-10-19 14:53:31 -04:00
Waseem Daher 92045f2c9e Experiment: Use icons in more places (instead of the word Huddle).
(imported from commit 6e27da4e54634c1f2fe05e2bffac24dc00576d2c)
2012-10-19 14:42:43 -04:00
Keegan McAllister 4c269c4f7f Don't line-break <code> tags
(imported from commit 35be9fe8c70d3e233708bb7ffdb5ce91eca75c77)
2012-10-19 13:37:42 -04:00
Keegan McAllister 299a298bfb Fix variable name typo in narrow.by_recipient
(imported from commit 87954f2d9007ebdd9d6da8a71584d2677c19ad4d)
2012-10-19 13:02:25 -04:00
Keegan McAllister 5d0fdd1958 Clean up narrow.by_recipient
(imported from commit ca6665f29847077d6038d3f48821c4be02e95ff1)
2012-10-19 13:02:25 -04:00
Keegan McAllister 390c9a26c1 Explain why target_id exists
(imported from commit af2235d80ada47e95806a8a2f807261da583e39e)
2012-10-19 12:57:34 -04:00
Keegan McAllister e6d42f60f1 Use narrow.by_recipient in message template
(imported from commit 147eb8b652d7b4dee3ad6415b6c8e23e04067d15)
2012-10-19 12:57:34 -04:00
Keegan McAllister 3c00b828b0 Use target_id in narrow.by_recipient
Following 958ce29.

(imported from commit e52e9628f85d83ef02bef393f6b10697a7d4eec4)
2012-10-19 12:57:34 -04:00
Keegan McAllister 2439d69209 Get rid of helpers by_personal, by_huddle, by_stream
These make assumptions about the current message type.  We should just use
by_recipient externally.

This reverts commit ad2123f99ce91361ab907c308bfecec4efd722a4.

(imported from commit b7945896568c4c5c31a9d5bddb0e9ade8eef859b)
2012-10-19 12:57:34 -04:00
Tim Abbott 79fbb23356 Return a max_message_id when returning no messages.
This is needed for an API client to setup a nonblocking subscription.

(imported from commit d978c28994c5e3af4312ffba32c4040e8314c247)
2012-10-19 11:37:20 -04:00