Commit Graph

4110 Commits

Author SHA1 Message Date
Steve Howell 2442edee9e Add the "static" directory to NODE_PATH for unit tests.
I added our "static" directory to NODE_PATH for our JS unit tests.
This eliminates most of the verbosity in our require statements, but
it still requires us to explicitly call out "js" or "third"
subdirectories, which should make it a bit easier for folks reading
the tests to distinguish modules from js, third, or node itself.

(imported from commit b77a5283135d388d46f4b7e511acc59986f1a8ba)
2013-08-01 17:58:25 -04:00
Steve Howell 44e59dfaea Quiet Tornado's polling instrumentation in dev.
In dev, only show the message "Tornado X% busy over the past Y seconds"
if we've been more than 20% busy.

(imported from commit 2775e6151ccf03ba0cb2a1f96e4f4839774a870f)
2013-08-01 17:18:07 -04:00
Tim Abbott b317f0899b Add a management command to render all old messages.
I'd like to minimize the probability that we'll actually run the code
in the "messages not rendered yet in database" codepath since it might
perform poorly, and it seems like the best way to do that is to just
run a loop that renders them all.

(imported from commit 247cb85fffa6cbc95958b9feda97462792a542c2)
2013-08-01 14:41:25 -04:00
Tim Abbott 70a7e90646 zephyr_mirror: Disable most markdown patterns for mirrored messages.
(imported from commit 09bfa2583ec037b78bcb12c44ca78d213ba5d102)
2013-08-01 14:10:28 -04:00
Tim Abbott 802b3dc3b2 Add API endpoint to render some message content without sending a message.
(imported from commit e1604b3bf4fc65e958db22f280eba1b5d2ba1e90)
2013-08-01 14:01:58 -04:00
Tim Abbott 365db42a6e Return a proper JSON error on HTTP authorization errors.
(imported from commit da0249b4e8585d8adbd9c769e3ba85dc4b9d28de)
2013-08-01 14:01:58 -04:00
Zev Benjamin 39a44cc661 Fix migration 36
It was not regenerated after being rebased.

(imported from commit b4555b05813201943f5991552dd4a0d53f7ae005)
2013-08-01 11:26:33 -04:00
Steve Howell f7ca0117e6 Allow users to upload new avatars for their bots.
(imported from commit 9d7895a658740815f454c8bba400d7cff821b7f9)
2013-08-01 11:05:40 -04:00
Steve Howell ab23c534b9 Use POST, not PATCH, for patching bots.
This is a temporary expedient measure to work around our
PATCH not supporting file uploads in our current Django setup.

(imported from commit c3146b23d5d7d134c2b80507eb87033ca375a4db)
2013-08-01 11:05:39 -04:00
Tim Abbott 7803cadd66 Prevent realm_filters from breaking apart Markdown links.
E.g. if the Zulip realm, if you ever put "#15" in a Markdown link, you
surely don't want it to be auto-replaced with a Trac link.

(imported from commit 2e117a7bbbd9c82f8c0ba4d390472770f4425589)
2013-08-01 10:48:11 -04:00
Zev Benjamin 905354f7a1 For mit.edu, include .d instances in narrowed views
(imported from commit 502b36d1a62f3f8f7b956c701fd10f580e1927d7)
2013-07-31 18:30:28 -04:00
Zev Benjamin a637fadd18 Fix regexes for MIT narrows that include un- and -.d streams
The previous regex didn't escape the period in '.d' and was doing a
case-sensitive match to find the base stream name.

(imported from commit 43ef13733987e50dcead06b7bd3e768cb4395998)
2013-07-31 18:30:28 -04:00
Waseem Daher a563776978 Don't Trac-linkify #1 - #9.
If you really want to link to those tickets, tough.

(imported from commit 54fccbe793662fade2b8f0f53d3f0e6cfa997398)
2013-07-31 16:32:08 -04:00
Tim Abbott d6acd8fce9 Add support for narrowing to a single message ID.
This is mostly useful for sending someone a link to a single Humbug
message.

(imported from commit b0994a2bf503c84690b13ce89bbcf5bab829bf0c)
2013-07-31 14:59:05 -04:00
Tim Abbott ed6f5ac470 Fix time travel by adding new near: operator.
(imported from commit 727a68016090164b586cbe59e692676a00e8cd3a)
2013-07-31 14:59:01 -04:00
Zev Benjamin 394deb4a72 Remove stray debugging 'print' statement
(imported from commit 261b3b6ee93ec596a1a971494761d92e7c27891d)
2013-07-30 18:29:33 -04:00
Zev Benjamin a3a1e8f351 [schema] Update our full text search vector and index asynchronously
We now write the fact that a message was created or updated to a log
table and actually update the tsvector asynchronously from a worker
process.

This also means that when running locally, one now needs to run the
process_fts_updates script in order to have new messages indexed for
full text search.

(imported from commit ebb11b08d30be2a45242dafe146e8e861a0f050a)
2013-07-30 18:13:05 -04:00
Tim Abbott d05ddce624 Remove unused client_id argument to get_updates/messages.
Note that it's still handed out by get_profile since the Android app
expects it.

(imported from commit dc7222449192bff363399d1a5f01652988b3f475)
2013-07-30 17:59:46 -04:00
Tim Abbott ba20221df8 Fix whitespace in request_event_queue.
(imported from commit ee9c63a25db765a4b879e6047a27027ae69ebacb)
2013-07-30 17:59:46 -04:00
Tim Abbott 53e06a0bb5 Use rest_dispatch for accessing Tornado URLs.
(imported from commit f129f5e3dc9e83f40fa9ea1b95d97a9b9f5a6831)
2013-07-30 17:59:46 -04:00
Tim Abbott eff18f46eb Refactor apply_markdown code to avoid nested @has_request_variables.
(imported from commit ad331bd62b8b576167f30aa49a7a85c90f057e65)
2013-07-30 17:59:46 -04:00
Scott Feeney ec58dcfa4e Add missing newline to unminified stacktrace output
(imported from commit 6abc3d1aced29de546a890b40fdbe486c6e80aed)
2013-07-30 17:59:10 -04:00
Scott Feeney c5045b64f2 Generate API keys in a more secure way
The documentation for the Python `random` module explains that it "is
completely unsuitable for cryptographic purposes." This new way of
generating API keys replaces use of the random module with
`os.urandom()`, which is intended to be suitable for such uses. As a
bonus, the code is simpler and clearer.

(imported from commit cc3697a5048f2da53f0fce6689167f9d1cbb6466)
2013-07-30 13:54:50 -04:00
Steve Howell d82ccb6243 rename tests
(imported from commit cd98a86a5e07765f753ac1904e45ccd1213d6d67)
2013-07-30 09:05:49 -04:00
Steve Howell 998a22eabb Created test_search.js. (unit tests for search.js)
(imported from commit 8127c04ccc68a9ac106e5684a7ea9a621cb1831f)
2013-07-30 08:55:44 -04:00
Leo Franchi 4b94b99c17 Send recipient id also for PMs
(imported from commit 704f604cc10cc3205420af6dca1e093ec15c3874)
2013-07-29 16:13:57 -04:00
Leo Franchi e0374cf761 Add sender_id to sent messages
(imported from commit 5ed87152143fbc2c5936ee3903b6dbef4f1c9e32)
2013-07-29 15:26:47 -04:00
Scott Feeney 85ce86c4fd "Already using Humbug" -> "Already using Zulip"
(imported from commit e05812ed3bae64f9daa7d60a7d5b2404edb306fc)
2013-07-29 14:53:16 -04:00
Scott Feeney 9e2e857a88 Fix narrow test calling .then() in a callback
As Kevin points out, un_narrow() itself calls casper.then() so should be
called outside of a callback, not inside one.

(imported from commit c5f02a14c750045697558aeafb070227e3a9d24c)
2013-07-29 14:51:40 -04:00
Scott Feeney c2ce181203 Fix race conditions in 02-narrow.js tests
(imported from commit 6a4b22992c35cdebc86194282d6a348ee9c4b810)
2013-07-29 14:51:40 -04:00
Steve Howell a004a15ff5 [important] Fix paths related to recent zephyr/static changes.
This fixes the previous commit to master.

(imported from commit 43637dcf0832a4e91de9fd98ebb777c77a3eee19)
2013-07-29 14:02:20 -04:00
Steve Howell 46c4a6a9b3 Add unit test coverage to unread.js.
This covers most of the module's functionality, with special
emphasis on lines that use underscore.js (_.each and _.filter).

(imported from commit 074181a0273286a258504be634bdd1cead2eecd5)
2013-07-29 13:47:57 -04:00
Steve Howell 09bd52fff4 [third] Add underscore.js
(imported from commit ee17cc1d1dff2a6f816a81bb33fa04ca5562a441)
2013-07-29 13:47:56 -04:00
Tim Abbott 3bba0cc927 Move zephyr/static to just static.
It's not really a part of the server (aka the rest of zephyr/).

(imported from commit 27f6b6b064938ad927075a68d873e4b68710d279)
2013-07-29 12:11:26 -04:00
Tim Abbott ffc2f05cbb Rename zephyr.css to zulip.css.
(imported from commit 094580c1563fa05ecff58d6fb86bf2338a32b1a6)
2013-07-29 12:10:54 -04:00
Steve Howell a9da6e28e7 Made minor changes to test_message_tour.js
I added a comment at the top, and I made it run the test
more automatically.

(imported from commit db6e382d766d0cc35eed28d589608645253f23e8)
2013-07-29 10:28:14 -04:00
Waseem Daher b6d2682abf Remove inelegant gear menu hack.
Rather than play elaborate games to strip off the 'active' class, we
just neutralize it by making it the exact same as the inactive class.

(imported from commit d26a02ca0edef6ee86affa2fa5daee0426eb5f8a)
2013-07-26 18:37:07 -04:00
Waseem Daher 474a42a9bb Typo fix: mox-shadow -> box-shadow
(imported from commit ba8931c232d25d3bc5cd4e46110b923c1a9f63a9)
2013-07-26 18:36:40 -04:00
Steve Howell 04df44f91f Allow a backdoor for styling dropdown hovers in bootstrap.
We had to turn off hover styling to make typeaheads work properly, but
some plain dropdown menus might need it, like our gear menu, and they
can set a class of actual-dropdown-menu to be unaffected by the
typeahead patch.

(imported from commit af41c1cfa6da3ff90ca4245a12c47993c65e6766)
2013-07-26 18:12:05 -04:00
Leo Franchi d68df4f142 Don't infinite loop if trying to bankrupt while pointer update is in flight
(imported from commit e23be332ff86239283b9568e8e4c92edf0c59f75)
2013-07-26 17:32:49 -04:00
Steve Howell b8794e1a9d Revert "[third] Mouse-enable naturalSearch option in typeahead."
This reverts commit 02318d3d830e7e28d638efee0ef27023a73f52f7.

(imported from commit b6e48772dbef127a9e25e5ea5042d250cce6fed1)
2013-07-26 17:11:43 -04:00
Tim Abbott ab74c5d0d2 Add error handling for process_user_activity bot.
(imported from commit 367e2c76d1d6de634bbbb70c9b1c1b8c82027c9e)
2013-07-26 16:06:59 -04:00
Zev Benjamin 603f0d7ace Speed up subscription table rendering
Previously, we'd render all the rows of the table except the first
(which is for creating new subscriptions) and append them all to the
table.  This ends up being really slow.  We now instead render the
entire tbody element and replace the existing tbody element.

When profiling on my laptop, this reduces the rendering time for a
few thousand streams from ~62 seconds to ~2 seconds.

(imported from commit 83a48e0e1f776f7663343662157298e89165ece3)
2013-07-26 16:01:13 -04:00
Zev Benjamin c87a58b27e handlebars: Add alternative partial support
Regular Handlebars partials require pre-registering.  This allows us
to treat any template as a partial.

(imported from commit fff785d4fa944547b7ad4c3a620ef9400777ec87)
2013-07-26 16:01:13 -04:00
Steve Howell f258ce2127 Created test_message_tour.js.
I haven't hooked this into test-all yet, but I did modify
message_tour.js to accomodate the test.

(imported from commit e58f595f4fe1160f539c18ec09dbe22eebf1f104)
2013-07-26 14:52:32 -04:00
Scott Feeney a8c749f62b Use normalize_recipients() when adding message metadata
This change also adds comments to make it clear what the function does
and why it's used.

(imported from commit 68382abaf2d7c41c7de7d92cbf6e7583003aaf2a)
2013-07-26 14:44:30 -04:00
Scott Feeney d11a997dc3 Show space between multiple recipients (#1606)
Also adds a CasperJS test to verify multiple huddle recipients are
displayed properly.

(imported from commit 07f5f5ed30e360ac3f524d89e512bb1f20acaaa7)
2013-07-26 14:44:07 -04:00
Steve Howell 5b066c2289 Added comment to message_tour.js
(imported from commit 498ab9be3d499a1b8dbba97c051fbbd9a5f7290f)
2013-07-26 14:16:36 -04:00
Steve Howell 625003cbe1 Nudge pointer past visited msgs when coming home.
When you return to Home, we normally restore your last
position when in Home, which might have been before the
first unread message.  This is cumbersome for sidebar readers,
so now we keep track of messages that you visit while on a
tour away from Home, and when you return Home, we skip forward
any messages that were in the tour, landing on the last visited
message.  This all happens before rendering.

(imported from commit 9124a231d94f153e283e5ea95e40c50a58406275)
2013-07-26 14:03:55 -04:00
Steve Howell 41f744c3b8 Refactor how we mark a message range as read.
The goal here is to make it so that we can do other stuff with
the range of messages between two subsequent selections, besides
marking them as read.

(imported from commit f6eb07844fb2ccda195c9d4dfcdf1c15f3f40aff)
2013-07-26 13:58:01 -04:00