Commit Graph

19167 Commits

Author SHA1 Message Date
Steve Howell b7ef86bc34 Added /json/set_muted_topics
(imported from commit e9072cd273fabf0e072b6a5e9ed80b07142f1013)
2013-09-11 16:47:37 -04:00
Steve Howell 21456091e4 [schema] Add muted_topics to UserProfile
(imported from commit 5d804259be94ba83dc4f7541e50443dd1a42cc6b)
2013-09-11 16:47:37 -04:00
Steve Howell c6131b630b Handle undefined keys in muting.is_topic_muted
(imported from commit 96a9f0253e1c0e72a2b05577118dac438d190994)
2013-09-11 16:47:36 -04:00
Steve Howell f616148181 Make muting case insensitive for streams and topics
(imported from commit 6e731a5305a6d19896c61300aedf0fb4a387e148)
2013-09-11 16:47:36 -04:00
Steve Howell 0641e693fa Add muting.set_muted_topics
(imported from commit c84cd085e513d57e3913543d40cd8fd6b5d45b67)
2013-09-11 16:47:36 -04:00
Steve Howell 04c6a8198a Add muting.get_muted_topics
(imported from commit 5edb1d36ae66dfc42cf534edc452959df8306661)
2013-09-11 16:47:36 -04:00
Steve Howell 8626276dc3 Add muting.unmute_topic
(imported from commit c3aa08b7d50c70cba86b43c12d618ba1d96832b4)
2013-09-11 16:47:35 -04:00
Leo Franchi a408192f92 Don't re-parse alert words more than necessary
(imported from commit 4fee6ad9592c1dc5f844889fcb6586192de6cb35)
2013-09-11 12:00:37 -04:00
Jessica McKellar 171306a37d Don't include not in home view messages towards bankrupcty unread count.
(imported from commit 64c038f1d41c091c88875f2c90e9b4dd695308a3)
2013-09-11 01:29:45 -04:00
Kevin Mehall 7fea9e0755 Fix race condition in 06-unread
There was nothing to ensure that the changes resulting from scrolling
happened before the unread counts were checked. We already had a long
wait there; might as well do those checks after it to ensure that the
DOM is updated.

(imported from commit 0d4014ae6a74dd684521fecabefc4bf79015f842)
2013-09-10 18:06:57 -04:00
Kevin Mehall 5991b0003f Fix 06-unread PM count selector for changes in 2b82fbb
(imported from commit 0d8e52f17fb06092efff7cdf4fc4b01ab4901e2f)
2013-09-10 18:06:57 -04:00
Leo Franchi 2eb8c6aae3 Add documentation and a duration argument to analyze_user_activity.py
(imported from commit 5668ec02a23dcfeb29760b55d8acee17cfdea9cf)
2013-09-10 13:25:59 -04:00
Leo Franchi 9ebb536c2d Use json_to_bool in REQ instead of manually using ujson.loads
(imported from commit 5a607f7aba4a8e4e5920a35df06c375cff98ff55)
2013-09-10 13:25:59 -04:00
Leo Franchi a1d7e6336c Add stub for .on() in activity test
(imported from commit 82727e18739cb8bed7b2c64f8013e7f0fe386b94)
2013-09-10 13:25:59 -04:00
Tim Abbott 9fcca3df4e [schema] Collect data on when users are active on site.
These engagement data will be useful both for making pretty graphs of
how addicted our users are as well as for allowing us to check whether
a new deployment is actually using the product or not.

This measures "number of minutes during which each user had checked
the app within the previous 15 minutes".  It should correctly not
count server-initiated reloads.

It's possible that we should use something less aggressive than
mousemove; I'm a little torn on that because you really can check the
app for new messages without doing anything active.

This is somewhat tested but there are a few outstanding issues:

* Mobile apps don't report these data.  It should be as easy as having
  them send in update_active_status queries with new_user_input=true.

* The semantics of this should be better documented (e.g. the
  management script should print out the spec above)x.

(imported from commit ec8b2dc96b180e1951df00490707ae916887178e)
2013-09-10 13:25:59 -04:00
Steve Howell 5bcc403ea4 Add filter tests for is:alerted predicate
(imported from commit 077fdab5437f498f015da7ed81a77036c9ff6361)
2013-09-10 13:13:18 -04:00
Leo Franchi a33957db32 Handle mailchimp error 214 (duplicate email) in signup worker
(imported from commit cb34c153fc96bca7c8faed01d019aa2433fcf568)
2013-09-09 10:57:09 -04:00
Scott Feeney b8dc9cc198 Send you the subscribers list when you add a subscription
(imported from commit 810de1f03c6765ef1c5476df30aff4c467783cab)
2013-09-06 23:13:47 -04:00
Scott Feeney 17cad06a2d Add Dict.from_array()
(imported from commit 0650edb2217afa2c37be1bbc4f9e2ac40f4c0e2c)
2013-09-06 23:13:47 -04:00
Scott Feeney f9cfa6b5f7 Include subscriber list in page_params.stream_list
(imported from commit 7f03eec37c7cbdcdefb590c39a76444bd1b55230)
2013-09-06 23:13:47 -04:00
Scott Feeney c46007e08e When a user subscribes to a stream, notify other stream subscribers
This is a backend-only change. No frontend code that uses this is
included.

(imported from commit 4bc379de3bbfc0975ff939fa5895d716a4d1ff1b)
2013-09-06 23:13:47 -04:00
Scott Feeney 65ed20469e Split out get_subscribers method on backend
(imported from commit b5941ff90bbf5b31a9fa31aa83e5d1856d483dcc)
2013-09-06 23:13:47 -04:00
Scott Feeney 1c2479c807 Fix overly-tight coupling in set_stream_color test
The test will fail if a new attribute is added to the structure that
gather_subscriptions() returns. It should only be concerned with the
subscription's color.

(imported from commit fd5bad97bbce2544e0078ee029f54d4e45da9c15)
2013-09-06 23:13:47 -04:00
Leo Franchi cf59f07fed Replace alert_words as event contains full list
(imported from commit 489975f8bcbd0c3bcec07dd5ed62de5cae686140)
2013-09-06 16:05:08 -04:00
Leo Franchi a67d461139 Hoist joining of message content in alert_words processor
(imported from commit 5025b7108839ddc04d6d9e575a9a288223526fe8)
2013-09-06 16:05:08 -04:00
Leo Franchi 7d76c47321 Re-enable alert word bugdown processor for staging
(imported from commit a9fb8284a47d18b97b84d3ce37482132b21d3885)
2013-09-06 14:51:40 -04:00
Leo Franchi 8ad6a0daa9 Cache realm alert_words to avoid database hits when rendering
We found that since bugdown processes are threaded, the cost of
doing a db query in a markdown processor is quite high---each
thread must start up a new db connection including a SSL handshake
etc. We should strive to keep our rendering pipeline free of mandatory
DB queries.

(imported from commit 555066bd03da6c681b74ce6137acc264eb41c55d)
2013-09-06 14:50:25 -04:00
Leo Franchi 7b375634f9 Temporarily disable alert_words markdown processor on staging
(imported from commit ab3eed4ce36ebcd3d928d2d92fc34c9ebacc11f9)
2013-09-06 13:39:26 -04:00
Leo Franchi 252045fe2e Fix assignee in JIRA created message
(imported from commit 5ebadd14dee58c20746c80dfd99ba70a3d772ab6)
2013-09-06 11:24:03 -04:00
acrefoot cf3e98d74a use staging for wdaher.com for the email script
(imported from commit fbad47386f5c48785f766886218370612db31c26)
2013-09-05 19:19:41 -04:00
acrefoot 592e1ead6b Actually use the realm specified by the email mirror when doing the markdown
(imported from commit 00b909b1d0c70a3523ab53d2f91815ab14ba2a6f)
2013-09-05 18:24:55 -04:00
Zev Benjamin cb78014eef bugdown: Allow block-level block quotes
It is triggered by specifying the "language" of a code block to
"quote" or "quoted":
    Hamlet said:
    ~~~ quote
    To be or **not** to be.

    That is the question
    ~~~

(imported from commit 847a0602e335e9f2955e32d9955adf8ac8de068c)
2013-09-05 17:34:28 -04:00
Zev Benjamin dd26260884 bugdown: Clarify variable name
(imported from commit 27968536bd6a3fcda6d26d8dde7f82d9f0990dd2)
2013-09-05 17:34:28 -04:00
Zev Benjamin b3644ecfad Fix attribution of Github issues messages
(imported from commit 941e52e51dfd9fddfe4f86bb33f25877d6d0edbd)
2013-09-05 16:04:59 -04:00
Zev Benjamin 2f1551e745 Replace comment references to trac.humbughq.com with trac.zulip.net
(imported from commit 231d0884345be525d58ce51f48a76bba6960f09d)
2013-09-05 15:43:08 -04:00
Zev Benjamin 5c81148839 Switch our trac realm filter to use trac.zulip.net
(imported from commit 19163f5be01a1d9370d9ed45c55bedd670772dac)
2013-09-05 15:43:07 -04:00
Kevin Mehall e58e6f1b7d Check admin permissions on the target realm, not on their own realm.
Trac #1772

Also abstracts this into a method.

(imported from commit f435b3379fb5387f8b3fdf7ca728ab760eadbf95)
2013-09-05 15:36:59 -04:00
Tim Abbott ce710292ca Always use external-content.zulipcdn.net for mit.edu realm.
(imported from commit 21d1101185bf52f21fcc345e791217311e9c0a13)
2013-09-05 14:35:42 -04:00
Tim Abbott b557b94d0b bugdown: Rewrite image urls to avoid mixed-content warnings.
(imported from commit fc0a41befb04f2a8aad2937a856366ac3cadb192)
2013-09-05 14:35:29 -04:00
Tim Abbott cdfc6dc10a bugdown: Fetch youtube preview images over HTTPS.
(imported from commit 9dbf3c21083cbbcf1288789f400c33ec735d4416)
2013-09-05 14:35:29 -04:00
Tim Abbott 3f1c967e3d Clean up approximate_unread_count.
The new version is more accurate (doesn't rely on UserMessage IDs
being sorted, which they aren't necessarily) and simpler.

(imported from commit 671dd89dc8881ae2dcb8d0e804fd65458e074a29)
2013-09-05 14:35:29 -04:00
Leo Franchi 663fd4653f Feature-flag alert words to staging + reddit
(imported from commit 1fe9c596b26ce6676514719e4ed2e185108685cb)
2013-09-05 10:21:39 -04:00
Leo Franchi 41b286232d Allow filtering to alerted messages with is:alerted
(imported from commit 99834f1ee1b9b2e0f5c7427afa1494bf404e3626)
2013-09-05 10:18:41 -04:00
Leo Franchi 897dd87b94 Add a span around alert words to mark them visually
(imported from commit 9b8fbbd957086f1eeaa3409e5830aa6d7974fbe8)
2013-09-05 10:18:40 -04:00
Leo Franchi b2ddd670e4 [schema] Add backend support for per-user alert words
(imported from commit 7a9c596a010cbedbddf594c5d9c68bb9ed46d122)
2013-09-05 10:18:40 -04:00
Kevin Mehall 6b820038ad Server side tests for message editing, including subject propagation.
(imported from commit 0a68bdc337eda1b04976fb41a50a29f9f626ef25)
2013-09-04 14:51:46 -04:00
Kevin Mehall 19a835e7d5 Add a checkbox that propagates topic edits to subsequent messages.
Trac #1348

(imported from commit 28e2a8cb3ecda5ec50d17501f4ccbd8644212065)
2013-09-04 14:51:46 -04:00
Scott Feeney 6adfed7f3d Add backend support for basic Desk.com webhook
(imported from commit 425a26b2ba5ffd4f4437e8d8438e8ef540d7b1ee)
2013-09-04 13:19:23 -04:00
Scott Feeney a213fb5df2 Comment that authenticated_rest_api_view does Basic auth
(imported from commit 145ea6b0a17ab904c32e23e809410f56448baa72)
2013-09-04 13:19:22 -04:00
Leo Franchi 7e6af0a5d0 Mark messages from the desktop app as sent_by_human
(imported from commit 001073221387cbbaa541b17f9a377490562a28f1)
2013-09-04 11:00:11 -04:00
Luke Faraone 085fdebc98 Use the X-Gm-Original-To header instead of iterating through To/Cc/Bcc
This will allow mail with an implicit destination (mailing lists, complex
forwarding) to be received by our system.

See http://support.google.com/a/bin/answer.py?hl=en&answer=2368151 for
documentation of Google's behaviour that adds this header.

(imported from commit f8fd500e3c27e12af5941c63c91d5c796a2cd24a)
2013-09-03 17:46:44 -04:00
Tim Abbott eeb04ed78e deactivate_user: Only delete sessions that aren't expired.
(imported from commit e3d844a55581a7e7faab8ea9ed6703480fae8f51)
2013-09-03 11:40:42 -04:00
Kevin Mehall be5c90c217 Add test for realm-specific emoji
(imported from commit 2148038b300b71afe0a7517709ed0404536b69fd)
2013-09-03 11:01:01 -04:00
Scott Feeney 549c644480 Move webhooks views to a separate file
(imported from commit 73db9f5ccc03d19024f35001b0805ca17eeadff7)
2013-08-30 10:18:49 -04:00
Scott Feeney 6eea2d7988 Rename views.py to views/__init__.py
(imported from commit 6d2fc769b3997f8ae9aea1119ebe1c27872baf42)
2013-08-30 10:18:49 -04:00
Jessica McKellar acdfb6afa0 email mirror: make being one of many recipients okay.
Previously the email gateway had to be the only address in a recipient
field or we'd mis-parse the recipient.

This commit also makes the mirror correctly handle addresses of the
form "Jessica McKellar <jesstess@zulip.com>".

(imported from commit 7435f2b59b8f47dc599cc869f64597a730af7d12)
2013-08-29 18:13:21 -04:00
Jessica McKellar c4157ed2b6 Make email mirror testing easier by using a different mailbox locally.
The mirror will use INBOX when deployed and Test locally. Send an
e-mail to the Test mailbox by including the word "localhost" in the
subject; a GMail filter will place it in Test on receipt.

(imported from commit bacf9a9554c8c5e1f3ec8497761edf2c15d3745d)
2013-08-29 18:13:21 -04:00
Scott Feeney c94ba52d3a Backend support for "announce stream"
(imported from commit dab3206a973083c3cee8225fa9ca71f4eecc269f)
2013-08-29 10:32:32 -04:00
Scott Feeney e3247de572 Factor out get_active_user_profiles_by_realm()
(imported from commit 634ebf265b02303a938f7595de3622e25bc22b49)
2013-08-29 10:28:20 -04:00
Scott Feeney 09ff770435 Make invite-only stream invite notifications less confusing
Previously, when added to an invite-only stream, you got notifications
like this:

   Hi there! We thought you'd like to know that Some Person just subscribed
you to the invite-only stream 'Secret stuff'

   You can see historical content on a non-invite-only stream by narrowing
to it.

Note that the second line is irrelevant and confusing in light of the
first!

This commit leaves this out, and also, to make sure I didn't mess
anything up (and because I needed to change the tests anyway), adds a
test for invite-only stream notifications.

(imported from commit 49c333629c78fc06f6d2f1ec8a627c6d38e7716a)
2013-08-29 10:27:34 -04:00
Tim Abbott ac1f9b5128 check_message: Allow zephyr mirroring bot to send to invite-only streams.
(imported from commit d45c75915cc4e29328768f1ed0e0ec972e5b7269)
2013-08-28 19:07:05 -04:00
Tim Abbott 5b62101a5f check_message: Clean up confusing and redundant authorization checks.
(imported from commit 1b756c89ec740f988e8f15d21fb413de9947d658)
2013-08-28 19:07:05 -04:00
Tim Abbott 371654adb3 zephyr_mirror: Make Webathena work for golem.
(imported from commit 6f8bf1f44c521b22c9fc990711d2821e5a60761d)
2013-08-28 18:56:54 -04:00
Tim Abbott 591b42bb1c bugdown: Clarify code around inline_interesting_links processor.
(imported from commit a1d734230135ab9099fafea7814bfec25754ea4e)
2013-08-28 18:56:53 -04:00
Steve Howell 1e88bb914e Add test_private_suggestions() to search_suggestion.js
(imported from commit db89f8574a4f7e169e66ebaff3a9c2cd49a4b0dc)
2013-08-28 17:41:17 -04:00
Steve Howell 8363b7c59a Add test_subset_suggestions() to search_suggestion.js
(imported from commit db9173ffa92ca225baf24a1103807034e4f31a7f)
2013-08-28 17:41:16 -04:00
Jessica McKellar cf0f205f75 tests: check that non-subscribers can't send messages to an invite-only stream.
(imported from commit 5ee0fb49e994c4d283348d89a25606ca6d314005)
2013-08-28 16:43:40 -04:00
Jessica McKellar 2cc06aafe1 tests: don't skip message sending restriction checks!
We were using the internal do_send_message, which does not do any
security checks.

(imported from commit 14a31a39a392dd2bc6b79f4345aa80217d5356f2)
2013-08-28 16:43:40 -04:00
Jessica McKellar f67f5b7619 Allow superusers to send messages to even private streams.
(imported from commit b7253174fa25d61b5bda056a5e5353e3b8ea918b)
2013-08-28 16:43:40 -04:00
Jessica McKellar d72ed33dc6 Be more verbose and explicit in the checks on who can send a message.
It was getting hard to follow and is going to get more complicated
with a new super user check in a later commit.

(imported from commit 8d5cfa960824519d87ce0f09aab3a120ba9ef357)
2013-08-28 16:43:40 -04:00
Steve Howell 5b598a6d9c Avoid churning the cache for stream name changes that don't change the cache key.
(imported from commit 1cc1ed01eaaaec4e6ddd6901fb5b877f831b604c)
2013-08-28 13:34:26 -04:00
Steve Howell 6aecdda7f7 Allow stream renames like corporate -> Corporate
(imported from commit 46d5078fb700631ef2a5b847eeeb055ff75d87d1)
2013-08-28 13:34:25 -04:00
Steve Howell 857680102f Remove enforce_arity checks from Dict
(imported from commit 8fdb6d8807e5c16349c7fcf71f25ce73348a5fe1)
2013-08-28 12:29:11 -04:00
Jessica McKellar b27f27f932 node tests: add some asserts for stream_data.delete_sub.
(imported from commit 3428f32206105b240e230e1050e7c16cd9c3729c)
2013-08-28 10:24:52 -04:00
Jessica McKellar 2be988e6b7 Give recipient_cache and associated functions a clearer name.
(imported from commit 14b12b196e33dfc4eeca5ab0f12c130ddaef1065)
2013-08-28 10:23:40 -04:00
Jessica McKellar 95c70967d2 rename-stream: support non-ASCII stream names.
(imported from commit 5fe2c803c0645bb6367f39bfe58acc478a66a0eb)
2013-08-28 10:23:39 -04:00
Jessica McKellar 8f3c5dc924 Add a management command to rename a stream.
(imported from commit b3acadc09b289b48e2ac298e50a5427545b6a473)
2013-08-28 10:23:39 -04:00
Jessica McKellar 97f0320dd1 Add the backend facilities for renaming a stream.
An important part of this is updating the various caches that cache
the display_recipient.

(imported from commit 888bf54fd205516cf31a25ba3f4e45ad11bbd4d5)
2013-08-28 10:23:39 -04:00
Jessica McKellar c1439c8853 actions: factor stream name checks into a function.
(imported from commit e107e895f247f6bfafe2c21de12d8a3c5de9268a)
2013-08-28 10:23:39 -04:00
Jessica McKellar 1f4f799030 Flush the per-process recipient cache after every request.
This cache was created to make recipient lookups within a single
request (e.g. when fetching old messages) cheaper. To support stream
name changes, we need to invalidate this cache on every request so
that users get a consistent view of the name change.

(imported from commit 801051b9f6a108c1f50be7eca9a1242d661919b1)
2013-08-28 10:23:39 -04:00
Jessica McKellar cd4daaa41f Factor the display_recipient cache key into a function.
(imported from commit 4a80c4db6ddcf8104f45b6b068e598378e655bc0)
2013-08-28 10:23:37 -04:00
Jessica McKellar d64c09b1ed Add a cache_delete for deletion of items from memcached.
(imported from commit 4fbdc4c4b230a5ab029dacc2463437f81fb0d023)
2013-08-28 10:23:04 -04:00
Jessica McKellar 21d857e577 Add a cache_delete_many for bulk deletion of items from memcached.
(imported from commit 33fc65dce89e51b99f13b50216d975272a028c16)
2013-08-28 10:23:03 -04:00
Jessica McKellar 2dbe6914d9 Factor out finding active user IDs to a function.
(imported from commit c2d25b24833be900af40d45331e4b9eb9e3a2dc6)
2013-08-28 10:23:03 -04:00
Tim Abbott 648e85160d Fix buggy application of subscription update events.
(imported from commit 4c76dc3ee5d3d1a298591c0c60dbe0e3aa30e0af)
2013-08-27 19:12:20 -04:00
Tim Abbott 77dbbe7f23 zephyr_mirror: Require zcrypt when mirroring to invite-only streams.
(imported from commit 1b88a8fc9bc26f2f9b1bb3f037093f85255feb17)
2013-08-27 18:26:12 -04:00
Tim Abbott e95a81addb Add Webathena login button to our mirroring page.
(imported from commit 43d8323bb502299027436a8c94c04f55d87bf953)
2013-08-27 15:41:43 -04:00
Steve Howell 667372068c Add idempotency test coverage for muting.js
(imported from commit 50496866fa11df433150ff28f0f1e58e9e8b33bc)
2013-08-27 15:40:54 -04:00
Scott Feeney 9f054eb15f Add a detailed docstring to rest_dispatch()
(imported from commit 6ff92e71e995e544c19828258a11d97e68294e3a)
2013-08-27 14:27:28 -04:00
Scott Feeney f225c467b0 Strip whitespace from email/key during API auth
Trac #1681

(imported from commit 4c97bfea052d2da7673ba5a9520f7ddc7515d975)
2013-08-27 14:27:28 -04:00
Scott Feeney 141877a06c Give a helpful error if API key is wrong length
Trac #1680

(imported from commit 0a50e7a93b37a5a3e74fb99c97a8917d8fbcc8f9)
2013-08-27 14:27:28 -04:00
Allen Rabinovich 2bb6f45af2 Add a data-name attribute to stream elements in the stream list and modify the test accordingly
(imported from commit 24791703015a47ae89fdf628d6511736b9d0f026)
2013-08-27 09:44:57 -07:00
Tim Abbott 134da30fdf Add webathena authentication button for Zephyr users.
This shows up when you're not running a Zephyr mirroring bot and lets
you use Webathena to have us run it.  Obviously needs more docs.

Current problems include:

* supervisorctl reload ends up recreating /var/run/supervisor.sock
  with the wrong permissions, so it only works once in a row before
  you need to chmod that.

* /etc/supervisor/conf.d needs to be humbug-writeable; this is a clear
  local root vulnerability

* This uses SSH and thus is kinda slow.

(imported from commit 7029979615ffd50b10f126ce2cf9a85a5eefd7a2)
2013-08-26 18:17:25 -04:00
Zev Benjamin 44ecd09ac7 Simplify Github event capture condition and improve error handling
Attempted captures are causing errors and I'm not sure why.

(imported from commit ecf7a711fc13f2c8e036a0ebf6db6c2cd566109b)
2013-08-26 15:37:37 -04:00
Scott Feeney 0856274fd2 Change empty messages to '(deleted)'
Before this it was [deleted]. Using parens is consistent with how we put
in (no topic) if you don't specify a topic.

(imported from commit 931c06a1096cf7b0d226336cbe82535abd2e6032)
2013-08-26 14:13:42 -04:00
Steve Howell a2bf6c3dd7 Test stream_data.in_home_view()
(imported from commit 29f1a187000e1818797c1a4781afaabca0ed29de)
2013-08-26 13:59:33 -04:00
Steve Howell b486f06e71 Test stream_data.get_invite_only for unknown stream
(imported from commit fb4e51b44b8c20844a7575af1a471a626273ae39)
2013-08-26 13:59:33 -04:00
Steve Howell 5e2de02dfc Test stream_data.get_color() for unknown stream
(imported from commit 7507e43de3f261a19d210c58863d1e614567f4bc)
2013-08-26 13:59:32 -04:00
Steve Howell ca5cf073f4 Add test_get_and_set() to stream_data tests
(imported from commit 007486f08879ea8b98524a91ef3fc02565cc4d86)
2013-08-26 13:59:32 -04:00
Steve Howell 96a2f0d907 Test TypeError exception in Dict.from
(imported from commit 088bf04ecf10338e2d1cff1b86d5beb263ee19dc)
2013-08-26 11:21:30 -04:00
Steve Howell 5dda9a5816 Test is_subscribed=false path of unread.get_counts
(imported from commit 7fb6531fb6d2d475bf43de6267fd018cc7347d7a)
2013-08-26 11:21:30 -04:00
Steve Howell 1821005dfe Restore subject counts for Uppercase streams
(imported from commit ef0e78d39c56da67544441a73ea257f215fefd94)
2013-08-26 11:21:29 -04:00
Steve Howell ffa9cfd492 Test that unread.process_loaded_messages ignores read messages.
(imported from commit 262f20933551e786022de564f46c75f901d8123f)
2013-08-26 11:21:29 -04:00
Steve Howell 582eef8305 Add test_message_unread()
(imported from commit 7f26cafb90757a9c490a148b6dd7b4f4f0fb5f95)
2013-08-26 11:21:29 -04:00
Steve Howell 06065d50bf Add dict.num_items()
(imported from commit 209a01b61d18d4b65b54e473cf727065aada68e8)
2013-08-26 11:21:29 -04:00
Kevin Mehall 7f1a1dba9d Show realm emoji in typeahead and update the list via events.
(imported from commit bd8b8be5d088d503cac2b72cf228e769827e2308)
2013-08-23 21:39:29 -04:00
Kevin Mehall e2a13637f2 Management command for realm emoji
(imported from commit 4de3ac69c34bc6e92d180c672fa8276338fecf53)
2013-08-23 21:39:29 -04:00
Kevin Mehall d8146141a9 Render realm emoji.
(imported from commit 5a8dca8963bc6e2e16762844aebaefcb85a6aad2)
2013-08-23 21:39:29 -04:00
Kevin Mehall 32aa0bb72d [migration] Add RealmEmoji model for realm-specific emoji.
(imported from commit d0a08b748f458c0ab68985b4cf00c78950ab40c4)
2013-08-23 21:39:29 -04:00
Steve Howell 63fa194139 Turn off the "muted" topic special case
(imported from commit ea34ea060eb29864c4816d0f14ee106dcb10be9d)
2013-08-23 18:33:48 -04:00
Steve Howell 4a7bab9a6f Allow collapsing of recipient sections.
This is experimental, for staging only.  There might be a better
way to model this than dueling force_expand/force_collapse flags,
but it works for now.  The code in collapse_recipient_group()
could also be DRYed up relative to expand_summary_row().

(imported from commit 107151d1ecd640970fb7700d41278a003bd1abaa)
2013-08-23 15:57:31 -04:00
Zev Benjamin 2b1a99f985 Tweak Github test data to not cause the Github payload capture to error out
I believe the test data to be incorrect, but we'll find out when
we've captured some real data.

(imported from commit ae32af0436b6273d0b2a60b2c55047aace6adcad)
2013-08-23 15:44:19 -04:00
Steve Howell b3ebb13469 Remove some ".d" suffixes in predicate tests.
I was saying bar.d in places where I wasn't really specifically
testing the .d feature, and it was distracting and just an
unintentional consequence of copy/paste.

(imported from commit 7b137b28cb33c72b83f02fe1d2961c5c6accc263)
2013-08-23 14:10:03 -04:00
Steve Howell 439e984f3d Break up Filter predicate tests
(imported from commit 780559045d6ea84612617db9249d7f191dbd86d9)
2013-08-23 13:56:28 -04:00
Steve Howell 3239efd864 Simplify MIT regex code and harden tests
(imported from commit 96c988fb8c90d04dd4bcd7d2bbc04f1b1c8d8cb7)
2013-08-23 13:32:10 -04:00
Steve Howell df812b40f9 Have test excercise Filter.predicate caching code.
(imported from commit 504abea7c1ef3a9cdb58b5bbcf2d751c5d98b1ea)
2013-08-23 13:32:10 -04:00
Steve Howell f8c3b70ced Clarify Filter tests dealing with bogus operators
(imported from commit db8327eb6df70bc8ffee7fb8166bc6491bd2fe70)
2013-08-23 13:32:09 -04:00
Steve Howell ec5bfa2a10 Test Filter.public_operators()
(imported from commit 47e08ffb3eb7f91b95b84b91a249bcf99157998e)
2013-08-23 12:56:09 -04:00
Steve Howell c205b8b29f Test Filter.predicate better.
(imported from commit d32a1e0d7a638bc5bd010b902475a27527e699ba)
2013-08-23 12:56:08 -04:00
Steve Howell 795248a1d0 Mute any topic named "muted" on zulip.com.
This change will allow us to test the muting feature on
staging.  Any topic named "muted" will automatically be
muted.  You can also mute any other topic on the console:

    muting.mute_topic('devel', 'ios');
    current_msg_list.rerender();

More UI around this experiment will be coming soon, as well
as support for muting entire streams.

The muting module keeps track of which topics are muted, but a
user can expand muted messages, and once that happens, the
messages are marked with the "force_expand" flag that gets
persisted to the back end.

Muted messages are rendered in similar fashion to the summarized
rows, and as part of unifying some of that code, we have
made it so that expanding a summarized section doesn't remove
individual flags related to summaries; instead, the messages
get the force_expand flag set.

(imported from commit acee4190e63813d46850415c41ff8ebfae4a6953)
2013-08-23 12:10:27 -04:00
Steve Howell dca1ffdf96 [bugfix] Restore toString() call in Filter.unparse().
I regressed this recently, thinking that all our operators are
strings, but I forgot about the "near:" operator used in the
"Narrow messages around this time" feature.  The user facing
symptom was that the search bar showed up empty instead
of saying near:50, which might actually be the better
behavior, but it certainly was not intentional. :)

(imported from commit fcb93cecbe9a052bb9bc1af7fcac5aecaba5aafb)
2013-08-22 14:55:43 -04:00
Steve Howell c4d598b36e Move parse/unparse from narrow to Filter.
I'm trying to move well-isolated methods out of narrow.js, so that
narrow.js is more strongly focused on UI/ajax interactions and
big, heavy lifting stuff.  The logical home for parse/unparse
seemed to be Filter, and they brought along two private methods
with them.  The big code moves involved trivial follow ups
like s/exports/Filter/.

(imported from commit ace0fe5aa1c7abce0334d079ba9eb8d9a57bd10f)
2013-08-22 14:53:00 -04:00
Scott Feeney f0e9786c08 Test user-sidebar unread counts & fix broken tests
This is hard to break up into separate commits; sorry about that.

Before this commit we had 3 tests:

1. Claims to check that an unread count was 3, but actually doesn't.
2. Checks that scrolling down causes the left-sidebar stream unread
   count to decrease.
3. Claims to check that unread counts are correct, but actually doesn't.

From talking to Leo, it seems that he originally tried to actually do
what tests 1 and 3 claim to do, but found it too fragile to check an
exact unread count because of font sizes, layout, etc.

We now have 4 tests. For each of the stream sidebar and user sidebar, we
test that:

1. Scrolling down causes the unread count to decrease
2. Logging out and back in again leaves the unread count unchanged

I've removed the two bogus tests and some other code that didn't seem to
serve a purpose.

(imported from commit 9f8e4b521e2765099510426d0b7e2960885e6f19)
2013-08-22 14:46:13 -04:00
Scott Feeney d4661b22c8 Remove deprecated parameter in Casper unread test
You used to have to call casper.test.done(N) where N was the number of
tests run. This is no longer required and is deprecated in CasperJS 1.1.

(imported from commit 0de9ecb1930cbce416fa02c24a882e926cdc8e87)
2013-08-22 14:46:13 -04:00
Scott Feeney f41f042127 Remove an outdated comment in CasperJS unread test
The test now works standalone, contrary to what the comment said.

(imported from commit 1280923dd522518689624628df5f3063fbdc1a1d)
2013-08-22 14:46:13 -04:00
Steve Howell 58c141ad79 Avoid side effects in ui.set_presence_list().
Have ui.set_presence_list() only touch the presence list.

Before this change, it was calling update_unread_counts(), which
has a bunch of side effects unrelated to the presence list.

(imported from commit 690f754d78874a03fa36f8ff8765d5a63e431d28)
2013-08-22 14:46:13 -04:00
Tim Abbott c2be5ca1ef Disable public streams for a CUSTOMER5 contractor.
(imported from commit bb7997cd831b9df9c951e3ecefe8a65b06bf6732)
2013-08-22 13:57:19 -04:00
Tim Abbott 9e372118a9 Simplify stream access denied error message.
Otherwise, we'll report that a stream is invite-only when it isn't.

(imported from commit 441db1c84fb19bdf564251a1bd80ace23151783d)
2013-08-22 12:29:04 -04:00
Tim Abbott a356a0a229 Enable get_streams to list subs for mit.edu realm.
This makes the mit.edu setup share code with the CUSTOMER5 special
case.

(imported from commit 5d1d824d5ab4b50a6b11a94526efc57a0bdf8cb0)
2013-08-22 12:29:04 -04:00
Tim Abbott f5f95e5f43 [manual] Extend /api/v1/streams API endpoint.
Previously it only provided the list of all public streams; now it
allows one to specify any union of some of the following:
* all public streams
* all streams the user subscribed to

(the most relevant being the union of those two, which is what we want
for the "streams" page).

Or:
* all streams in realm (superuser only)

The manual task required is that when this is pushed to prod, we need
to also deploy the new sync-public-streams version to zmirror.

(imported from commit 27848b8bd136e2777f399b7d05b2fdcec35e4e21)
2013-08-22 12:29:04 -04:00
Zev Benjamin 9167b98820 Capture Github event data from a test repository
Github's documentation is a little unclear on what data is actually
sent and in some cases conflicts with the examples in the
github-services repo.  The hope here is to capture a good sample of
different events to develop against and then use it in testing.

(imported from commit 356935894b87ca21591f5682c15f9ed27289a5b6)
2013-08-21 19:45:25 -04:00
Steve Howell 7b9d9bcdae Avoid monkeypatching in search_suggestion tests.
(imported from commit 5b36a8e7effce9f174c4f7aa0447b7c570db1ffc)
2013-08-21 18:18:58 -04:00
Steve Howell 3e259e028b Avoid monkeypatching stream_data object.
(imported from commit 4755cf44736190b566645a83a7fc576d3c8451cb)
2013-08-21 18:18:58 -04:00
Steve Howell 0202ca0261 Run unit tests in deterministic order.
(imported from commit 74e1690e3bd401730313e66611423dcdf4709f81)
2013-08-21 18:18:58 -04:00
Steve Howell d21cbac611 Clean up globals after each unit test.
The functions add_dependencies() and set_global() are convenience
methods that allow you to modify the global namespace while
the current file is running but then have it be cleaned up
by index.js when you're done.

(imported from commit f75b8a10c19f773a8d2d3a8fa4bc39b1679566fe)
2013-08-21 18:18:58 -04:00
Kevin Mehall 8b365a5681 Use '[deleted]' instead of failing if you edit a message to empty.
Trac #1571

(imported from commit a51602d72aa2b89ce451946ae7f5a5363a6421f4)
2013-08-21 16:49:24 -04:00
Zev Benjamin 3f95e54dc1 dict: Add setdefault method
This is like Python's dict.setdefault.  I don't love the name, but
the consistency is nice.

We have lots of places where we do things like:

    if (! dict.has('foo')) {
      dict.set('foo', []);
    }

    var arr = dict.get('foo');
    arr.push(3);

We can now write:

    var arr = dict.setdefault('foo', []);
    arr.push(3);

(imported from commit b8933809c69ba47ec346ed51d53966793403e56c)
2013-08-21 14:11:39 -04:00
Zev Benjamin 62aec87962 dict: Make set() return the value passed
We were accidentally leaking our internal representation.

(imported from commit 08ddc42583fb13a2ad51eea7ed1b30bf5ccb4645)
2013-08-21 14:11:39 -04:00
Zev Benjamin 707898b236 bitbucket: Allow the stream to be specified
(imported from commit eea7392551b568502c01e59c89056b4369fe53e0)
2013-08-21 13:41:03 -04:00
Luke Faraone f17d030272 Send IDLE continuously when idle, interpret a too-old status as offline.
This helps make our statuses more meaningful and should resolve trac #1534.

As part of this, we lower OFFLINE_THRESHOLD_SECS to 1.1̅6 minutes and
mark the user as idle after 5 minutes.

(imported from commit ee6b1ad203554a84b11e16c4c6195be9df5bcf4f)
2013-08-21 11:07:45 -04:00
Kevin Mehall 00fc004be2 Server-side check for empty (or all-whitespace) messages.
(imported from commit 49054dd7a8050705f579b4b7a1bda7eb7bfc25be)
2013-08-21 10:37:36 -04:00
Tim Abbott 1901ebe49d Fix showing invite-only streams on stream list.
(imported from commit f364c2fa28009f2cdfc9aed225d4a9a8c8a1d3c1)
2013-08-20 17:34:24 -04:00
Leo Franchi 8484cac5c9 Add a messages/flags POST api call to change a message's flags
(imported from commit b51ebd94c99f57f1cda19039023013209556e343)
2013-08-20 16:19:07 -04:00
Leo Franchi f8b7b54626 Log message flag changes to our event queues
(imported from commit 72fcea1a98c6a5be81f32963d51453f4bb12ace0)
2013-08-20 16:19:07 -04:00
Leo Franchi 33f4837570 Only count message queues when determining whether to deliver missed message emails
(imported from commit 5a302489f3bcb19e2824452a0d3c1330e483af7f)
2013-08-20 16:19:07 -04:00
Leo Franchi 26cd96f132 Let clients specify how long queues shall live, within limits
(imported from commit 86609f6611ed37b45b28c31e541528ce260d62c8)
2013-08-20 16:19:07 -04:00
Zev Benjamin 59041d993b dict: Move Dict.from(otherdict) functionality into clone method
(imported from commit 6a3981a726922d7acf55b49ea2d477271da430d3)
2013-08-20 15:37:08 -04:00
Zev Benjamin 2c775d0894 Make recent_subjects case-insensitive
(imported from commit 36c423f506c1e8dc0536c80a4a085b689623191a)
2013-08-20 15:37:08 -04:00
Zev Benjamin 3a70c4e928 dict: Make copying Dict constructor a class constructor method
(imported from commit 7bd5f6029c1290036a47688cf2b80f9317fe9c13)
2013-08-20 15:35:53 -04:00
Tim Abbott 517c98d56f add_subscriptions: add authorization_errors_fatal parameter.
For syncing streams between Zephyr and Zulip, we need to be able to
have the API client send the server a long list of streams, some of
which might be invite-only, and add the ones that it can add and not
the ones it cannot without a bunch of annoying round trips dropping
individual streams one is not authorized to one by one.  This argument
makes that possible.

We might find other applications as well.

(imported from commit 9236d185897c42218ab6cac3d8f3ddcb1bbc94e9)
2013-08-20 14:57:15 -04:00
Tim Abbott 5f724a94ac Add support for invite-only streams in mit.edu realm.
This changes the mit.edu access rules from:

* Susbcriber list and inviting users to streams are unavailable

to

* Susbcriber lists and inviting users to streams are only available
  for invite-only streams

streams must still be made invite-only manually.

This both cuts down on the amount of code that is different between
the mit.edu user experience and the standard one, as well as paving
the way for us to invite-only streams for zcrypt.

(imported from commit 24e0e85428608c05c89eeea349338dd392e5489a)
2013-08-20 14:57:14 -04:00
Tim Abbott 53e62d4e7b Use bulk queries when checking auth for invite-only streams.
This gets rid of our last query-in-a-loop in the code path for adding
subscriptions.

(imported from commit d192a7723647f49878fc05028e78d593077a3b78)
2013-08-20 14:57:14 -04:00
Tim Abbott 3396dc3aa9 list_to_streams: Return which new streams were created.
(imported from commit 95f6701c3d9e4ea31bbf2470fe91d05f7f1f5a17)
2013-08-20 14:57:14 -04:00
Tim Abbott a0238fcfcc list_to_streams: Rename existing_streams.
(imported from commit f7aec045fc9ead2911328860341fde31001c9456)
2013-08-20 14:57:14 -04:00
Tim Abbott 3ffc3bc7f6 Don't filter invite-only streams for mit.edu superuser.
It's likely we'll eventually want to split this into 2 API queries,
but most of the code in get_public_streams_backend is specialized for
the performance requirements of the mit.edu mirroring anyway.

(imported from commit 47ac6586b59467fd64992c573b6e36885167dcc5)
2013-08-20 14:57:14 -04:00
Tim Abbott 7f350abf74 Add missing update_fields when saving bots.
(imported from commit bdbf3785f41d39f934780a1e54dcb3e61c4c8af4)
2013-08-20 14:57:13 -04:00
Steve Howell edda967100 Leave casing alone in search suggestions.
The function narrow.unparse() is used in a bunch of places in
the search suggestion code, and now it no longer lower cases
operands.  This change contributes to fixing trac #1659.

(imported from commit 6b44b8a818482b5c8b4f9a45bc7d3a9d21e04eba)
2013-08-20 14:27:44 -04:00
Steve Howell 890a4f0ac0 Remove unused var in search_suggestion.js test
(imported from commit 2298d4c8642ac031cd98729c23eed79e2b994876)
2013-08-20 14:27:43 -04:00
Steve Howell 0a22094e24 Change operator canonicalizations.
Streams are converted to their "official" names now.
Topics are not canonicalized at all.
All other operands continue to be lowercased.

Since we don't lowercase stream/topic at the parsing stage,
we have to modify the predicate function to do the lowercasing
of stream/topic to enable case-insensitive comparisons.  This
is slightly more expensive.  The server-side predicate
functions are already case-insensitive.

(imported from commit 286f118c6c3ff9d23b37c7f958cab4c0eacd5feb)
2013-08-20 14:27:43 -04:00
Steve Howell 767a8ae400 Add test_predicates() to filter.js tests
(imported from commit 551f396b4458ac529858f91f693b424bc7d06b8c)
2013-08-20 14:27:43 -04:00
Steve Howell 33c70f0f69 Extract Filter.canonicalize_tuple().
(imported from commit 96b8dc8c27c07d6d13f1e02c88a164abcab5a5c2)
2013-08-20 14:27:43 -04:00
Steve Howell d5f997eb58 Use the correct stream name in compose defaults.
If we have a stream named "Denmark" and we're narrowed to it,
then use "Denmark" as the default stream name in the compose box
even if the narrow operators are lowercase.

(imported from commit e9f06b7307c73231aa887dc95849e0307984e6f0)
2013-08-20 14:27:42 -04:00
Steve Howell 18857f6601 Added stream_data.get_name().
This function returns the stream's actual name, if we can get it;
otherwise, it's the identity function.

(imported from commit 7a981adba9632d6c6eba54cb6514a9226d1e83e8)
2013-08-20 14:27:42 -04:00
Steve Howell eccd7e90ab Add unit tests for stream_data.js.
(imported from commit 9a91aea1db3afc7936b1dbaeb4c014a3df6cd633)
2013-08-20 14:27:42 -04:00
Steve Howell 579f53845e Have search_suggestion clean up after itself
(imported from commit def5797f02868ecdb7dc3ffcc25caf1e532e2764)
2013-08-20 14:27:42 -04:00
Steve Howell 3d20f6478c Add unit test for narrow.set_compose_defaults().
(imported from commit 819b326bb10b4126438c9336d41e4aadce94d381)
2013-08-20 14:27:42 -04:00
Steve Howell f593c551da Add tests for Filter canonicalizations
(imported from commit def24dda1f178b658f6e49f3d2c67db779059c89)
2013-08-20 14:27:42 -04:00
Steve Howell 2491a80aa6 Fixed comment in in index.js
(imported from commit d28abf87d80f53038f1273529fcfe758fe7db2af)
2013-08-20 14:27:41 -04:00
Kevin Mehall d29484daa7 Casper tests for message editing
(imported from commit 4a62267241099432b40ef2cd592e0d5c20384f75)
2013-08-20 14:07:49 -04:00
Zev Benjamin 237746f3e2 Handle force pushes in Bitbucket integration
(imported from commit 6663934788b5cea13f9cf1344c45d2a568a0f287)
2013-08-20 12:28:04 -04:00
Scott Feeney 69efe2a695 Add a Node.js-based test runner
There are no functional changes; you can still use the shell script
tools/test-js-with-node. It just delegates now to the new index.js to
iterate through all the other .js files in the test directory and run
them. This sets the stage for Istanbul to correctly compute test
coverage.

(imported from commit 6f521c78b7a314d010fa113f9c2c971ab999b637)
2013-08-20 10:46:22 -04:00
Zev Benjamin 8010b49067 Add support for issues events for Github integration
(imported from commit 6ae1013948626acdd161bd6f2648351201842658)
2013-08-19 17:13:37 -04:00
Kevin Mehall 8a741ed3d4 Ensure that the pointer is valid before saving it.
Trac #1716

Fix the tests to use real message IDs for the pointer. One helper didn't
use the pointer ID it was passed at all, so the test didn't actually test
what it was supposed to before.

(imported from commit 457bcdb04a6c3873e224b68cd9d79c9a26612010)
2013-08-19 16:46:52 -04:00
Kevin Mehall 054ccabf16 Don't fail to load the home page if the pointer is invalid.
Trac #1716

(imported from commit 089093aaa2e5466c9f8fb89f795b44c648e8a6e8)
2013-08-19 16:46:43 -04:00
acrefoot 395aaae994 Allow anyone to edit a "no topic" message
This change would allow anyone in the realm to set a topic for a "no topic"
message. As soon as the message topic is set, only the sender can change it again.

(imported from commit 0a91a93b8fd14549965cedc79f45ffd869d82307)
2013-08-19 16:29:30 -04:00
Steve Howell 53f62bd71c Created MessageListView class.
(The code for MessageListView  was extracted from message_list.js.)

(imported from commit 60c0bac4c734d3850f8b8c047a978c292b19cc13)
2013-08-19 12:17:56 -04:00
Steve Howell 29c012dc74 Create stream_data.js module.
This pulls a lot of data-centric functions out of subs.js.

(imported from commit 0deed7d4bf5697e893af9bc9d888c2d5da8d9fa2)
2013-08-19 12:17:55 -04:00
Zev Benjamin 04147ae01f Set Cache-Control headers on index.html requesting no caching
This solves the problem of restoring a tab taking you to the previous
load's initial pointer position.

(imported from commit e5e988af65966b15a9d091064b65f87be3f0d75a)
2013-08-16 18:08:41 -04:00
Steve Howell a4af6c7062 Add unit tests for composebox_typeahead.add_topic().
This tests topics_seen_for() as well.

(imported from commit a748134af8068d9e4ae223fb7ecbbbc6c170137e)
2013-08-16 17:59:40 -04:00
Jessica McKellar f3a32d8382 Report email forwarding errors to our internal Zulip.
For now, just do this, and we'll reach out to realms having trouble
manually. We may eventually need to automatically reply to the e-mail,
reach out to a realm admin, etc.

(imported from commit 5c5ac354066f9e9be3fb928e1f8801613c22c1ac)
2013-08-16 16:09:18 -04:00
Jessica McKellar 557bdd2a6e email gateway: Make forwarding even "richly formatted" messages work.
(imported from commit b15f24fa6898eb2eaf7d27bf862e8bead76f544d)
2013-08-16 16:09:18 -04:00
Zev Benjamin f06c3c0aed Add BitBucket webhook integration
(imported from commit 50be72fb72d52e24b161f09b1d2314aaae5d636c)
2013-08-16 14:38:54 -04:00
Zev Benjamin 7650804499 Split build_message_from_gitlog in two
We do this because the upcoming Bitbucket webhook does not send
enough information for us to send a useful message for deleted
branches or force-pushes.

(imported from commit dcac675f47e10672125caabd6fefa8dc0dc9c86c)
2013-08-16 14:38:54 -04:00
Zev Benjamin 2f262b1558 Make @authenticated_rest_api_view imply @csrf_exempt
(imported from commit a90402effe48b184c05bf19f1136e3d63a6f460b)
2013-08-16 14:38:54 -04:00
Jessica McKellar d0aefa872e Give new users in all realms historical messages in their home view.
(imported from commit 60977c330d3a3dd22d77749104e388e12ef9e314)
2013-08-15 17:25:02 -04:00
Luke Faraone 078aea862c Always convert emails to lowercase in helper functions.
(imported from commit 834be7d682167c0d428c9b8a5ab8d3ae0c0d51a7)
2013-08-15 13:17:46 -04:00
Luke Faraone 4ad77831d1 Don't crash if a MIT user registers who has never sent/received a zgram.
(imported from commit 2527c8f4c3a5d8f6281318afff5ebdb431d0613e)
2013-08-15 13:17:46 -04:00
Luke Faraone 21b4b65322 Prefill a MIT user's fullname if we can guess.
(imported from commit 032aa393ee741cdae0deba6a4091be5c7dcc38d9)
2013-08-15 13:17:46 -04:00
Luke Faraone db2fd45deb Create MitUser objects in organic signups.
This is the way we disambiguate MIT users from normal PreregistrationUsers.

(imported from commit adfe781036f653ef2c15850100c7ea26332d9ef4)
2013-08-15 13:17:46 -04:00
Luke Faraone 9e71d0c7b2 Encode names before passing to urllib.
This otherwise causes Unicode bugs. See for example:

>>> import urllib
>>> urllib.quote_plus("hello&world+whats@up?")
'hello%26world%2Bwhats%40up%3F'
>>> urllib.quote_plus(u"faraoné")
/usr/lib/python2.7/urllib.py:1268: UnicodeWarning: Unicode equal
comparison failed to convert both arguments to Unicode - interpreting
them as being unequal
  return ''.join(map(quoter, s))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/urllib.py", line 1275, in quote_plus
    return quote(s, safe)
  File "/usr/lib/python2.7/urllib.py", line 1268, in quote
    return ''.join(map(quoter, s))
KeyError: u'\xe9'
>>> urllib.quote_plus(u"faraoné".encode("utf-8"))
'faraon%C3%A9'

(imported from commit 7c13b749bdc7f89e7b767ddd630be0ebce30802c)
2013-08-15 10:56:46 -04:00
Steve Howell 3e1cdaaded Add MessageList.nth_most_recent_id().
(imported from commit 69a424d4990402b9e77fbfa57fa573a002cf04ce)
2013-08-15 08:20:29 -04:00
Steve Howell 947ca3a0e0 Add Dict.each().
Dict.each() allows to iterate through values and keys of a Dict.
The callback function is passed value as the first parameter to
be similar to _.each()'s calling sequence.

(imported from commit e745e8b5d2f167b8b8acf7542b767494e354b037)
2013-08-14 14:24:38 -04:00
Jessica McKellar cc21429b99 Add a management command to dump all messages on public streams for a realm.
(imported from commit f4f8bfece408b466af4db93b2da15cf69b68e0a3)
2013-08-13 18:16:30 -04:00
Tim Abbott e24c770738 Fix bare save on UserProfile object in regenerate_api_key.
We should never be using bare saves like this, since they create
unfortunate races.

(imported from commit 82837e89b20eb4ac7040a79a5f695ca28cdf97bb)
2013-08-13 18:09:19 -04:00
Jessica McKellar f530e3b930 Display the email address for a stream in its stream page detail.
For now, only show it on staging.

(imported from commit fd07fad1c34578d8ddc2cddd1bb6bdcb72f354de)
2013-08-13 14:28:47 -04:00
Jessica McKellar 15afdf65eb email forwarder: encode stream names so they are safe in email addresses.
(imported from commit 6699d656e3cae58fad062a1403fb9923429fde89)
2013-08-13 14:28:47 -04:00
Jessica McKellar c4a0797413 Decode MIME-encoded emails before forwarding them to Zulip.
Otherwise you'll see garbage.

(imported from commit 07e68a5e209fdea4f54470396a67986dd9fa4016)
2013-08-13 14:28:47 -04:00
Jessica McKellar befd34d111 [schema][manual] Make Stream.email_token required.
This commit CANNOT be deployed until the previous schema change
([schema] models: add an email_token field to Streams) is on prod.

Before applying this schema change, run the populate-stream-tokens
management command to generate tokens for streams that need them.

(imported from commit 7adc81c8c317ec5d59dd59ba42a4dc1a46174007)
2013-08-13 14:28:47 -04:00
Luke Faraone af4c34330b Switch to checking database is_bot field instead of using a heuristic.
This has the amusing side effect of showing all the Zulip bots in the
administration view because none of them have the is_bot 	 set.

(imported from commit cdec19d2109c092018c1f331aa32f345d1587683)
2013-08-13 14:20:18 -04:00
Luke Faraone ecc42bc9f8 Add administrative panel to allow for user deactivations etc.
We now show a list of users and allow you to deactivate a user using the
same process as `python manage.py deactivate_user`.

We add a new menu item accessible from the gear icon which will eventually
have much more than just this, but we have a good start here.

Here we also add a property to UserProfile which determines whether you're
eligible to access the administration panel, and then have code which shows
the menu option if so.

This introduces a new JS file, admin.js.

(imported from commit 52296fdedb46b4f32d541df43022ffccfb277297)
2013-08-13 14:20:18 -04:00
Zev Benjamin 6843cc4479 Add test for zephyr mirror CC de-duplication
(imported from commit 1452c67818f8aa577a95a219fc6b86e9690033eb)
2013-08-13 13:49:09 -04:00
Zev Benjamin 307bba5b29 Add comment to some zephyr mirror CC de-duplication logic
(imported from commit 86680f24329475dccc79731639d51a735fa873bf)
2013-08-13 13:48:32 -04:00
Zev Benjamin 91c0be44a1 Raise JsonableErrors while checking messages instead of returning error strings
(imported from commit 986ad1e19dd508b12386c57cf093b32d3fbcf49e)
2013-08-13 13:45:10 -04:00
Zev Benjamin bfebfbbff5 Make error messages a little more consistent
(imported from commit 77baba591628bef6b8b8b0ae28a9e05ec2fac693)
2013-08-13 13:45:10 -04:00
Zev Benjamin 6fcfcf3f32 Fix comment
(imported from commit 6f8eac90e5b011bd25b09e562ebcb9d2cae39a06)
2013-08-13 13:45:09 -04:00
Zev Benjamin bcc03dd4ab Do full-precision time comparison when checking for duplicated messages
We've had microsecond-resolution timestamps since we migrated to Postgres.

(imported from commit 81fe79f00097ceb40105645aa04a2f0ee29d3a19)
2013-08-13 13:45:09 -04:00
Luke Faraone 8c35db91c0 Unit testing for MIT user name calculation / mailing list protection.
(imported from commit ae7d4c0a1fea0b0887861a71828eae7c3022ec6f)
2013-08-13 10:21:45 -07:00
Luke Faraone 3129b6374d Fix broken parsing of DNS response.
(imported from commit 3a627d45bc313bf244dc699a59df9423c849bc35)
2013-08-13 10:21:24 -07:00
Jessica McKellar 1a0cc2b421 Send enough information in page_params for the client to consider bankruptcy.
Previously, we'd determine unread counts client-side as messages got
loaded, which meant:

a) how many unread messages you were known to have kept changing
b) you could bankrupt yourself and then get the bankruptcy message
again as more messages arrived from the server

(imported from commit 90f1af27b493c720f77d37487d8746749faf157e)
2013-08-12 17:33:39 -04:00
Waseem Daher abef6be12f bugdown: Unescape HTML entities in Twitter.
This closes Trac #1071.

(imported from commit 521ffa6ed13df7c08e67218564d426ca90080948)
2013-08-12 17:23:49 -04:00
Luke Faraone 0cb741d7cc Removed confusing ALLOW_REGISTER setting.
ALLOW_REGISTER was no longer being used in determining whether you could
register for the app, so I've removed it to avoid additional local-dev /
production issues.

This closes #1613.

(imported from commit c928c6d350602d35f745ae1e60d734e4567885fc)
2013-08-12 16:16:26 -04:00
Luke Faraone f3c8806d30 Allow open realm signups with non-real-user MIT addresses.
This allows me to use a mail alias with CUSTOMER3, and closes #1671.

(imported from commit 581d1145fb112b9d35ad522fa06f81a25b4b8d3b)
2013-08-12 16:16:24 -04:00
Luke Faraone cb2e993393 Allow any user with a @mit.edu to register for Zulip.
We add a new validator that ensures that people who sign up with @mit.edu
addresses are in fact MIT users.

This closes #1612.

(imported from commit 1e30794b1615dd57cb0e367d1fa186a877253357)
2013-08-12 13:09:20 -07:00
Luke Faraone 368ace069c Use PyDNS instead of shelling out to `host`
On Debian systems, this is found in the `python-dns` package.

On OS X and others, install "pydns" using your Python package manager.

(imported from commit 17827d0a1d3d72b12945df5563295a1573bfa1ed)
2013-08-12 13:09:19 -07:00
Zev Benjamin 9c8a9ac947 Correctly return the message id for already mirrored zephyr messages
This was previously causing us to generate a traceback every time we
hit a duplicated zephyr due to CC'ing.

(imported from commit 240e1559655d0166dcd864e84649ab97b87a29ad)
2013-08-12 15:49:19 -04:00
Steve Howell 878ee2b3fd Move Filter class to filter.js from narrow.js.
1) The class Filter now lives in its own module.
2) The function canonicalized_operators() is now a class method on Filter.
3) The function message_in_home moved to filter.js and became private.
4) Various calling code had to change, of course.
5) Splitting out Filter helped simplify a few tests.

(imported from commit e41d792b46d3d6a30d3bd03db0419f129d0a2a7b)
2013-08-12 13:58:32 -04:00
Zev Benjamin 51beeba854 referral: Prevent empty form submission
(imported from commit cc012e84c21bc424adaaa79611f09415480a2ba5)
2013-08-12 12:50:32 -04:00
Tim Abbott f9c3f77d07 For the CUSTOMER3 realm, include 100 messages in initial message set.
This is an experiment to try to ease the customer3 onboarding process
given that there will be a website with a public feed of recent Zulip
messages, to ensure that those messages appear for new users.

(imported from commit 31fb59c1800728b5e4d8a5ce7282c7dcedb02b21)
2013-08-12 10:17:18 -04:00
Tim Abbott b7e3f608cb Fix setting the initial pointer for users starting with messages.
This if statement stopped working when we made the pointer managed via
the events system.

(imported from commit 382ca5bd055ab85048b211068ff3d43a47607f28)
2013-08-12 10:17:18 -04:00
Zev Benjamin ec9322fc87 Use Dict everywhere we have keys based on potentially dangerous, user-supplied data
There are also one or two places we don't need to use it for security
purposes, but we do so for consistencey.

(imported from commit aa111f5a22a0e8597ec3cf8504adae66d5fb6768)
2013-08-09 17:35:14 -04:00
Zev Benjamin 0cfc8fae9f Add basic Javascript Dict implementation
(imported from commit 9f2fb089eb6e269549de26b37bd588355757d22c)
2013-08-09 17:20:14 -04:00
Zev Benjamin e0eddabeb1 Add util.enforce_arity
util.enforce_arity takes a function and returns a new version which
throws an error if an incorrect number of arguments (as determined by
the function prototype) are passed.

(imported from commit 20e69a6dc7b6f8455726ab4fae8d5b7b04dc4103)
2013-08-09 17:12:23 -04:00
Tim Abbott dd50f29b3d get_events: Don't return a queue ID unless we allocated one.
(imported from commit 85ad1aa2a0d52247c5efcecfab5212e40b876b88)
2013-08-09 15:35:33 -04:00
Tim Abbott 7fa448cdef Return the message ID when sending a message.
Our API documentation says that we do, and it seems like it could be
useful to clients, so we might as well do it.

(imported from commit c391e4952a09d41df4dc06e3dc6ee094f774822b)
2013-08-09 15:35:33 -04:00
Tim Abbott 9d6627d269 Rewrite documentation for /api/endpoints.
The main changes are:
(1) Changing the input format for the example response so that it is
human-readable and editable
(2) Updating it to use the events API

(imported from commit 308fade9595d6877836d343d2307e3fceff3e7d4)
2013-08-09 15:34:57 -04:00
Jessica McKellar a878f8a668 populate_db: make emailgateway@zulip.com a default user.
(imported from commit 000d03f59afbb1da125d5d610e1fff6b54d5dbd0)
2013-08-09 15:22:59 -04:00
Jessica McKellar a228bb6671 Implement a v1 email-to-zulip forwarder.
(imported from commit 5f91fd69ee2075413d0d4aedf71b878bf98c640e)
2013-08-09 15:22:58 -04:00
Jessica McKellar 639aac964e Add a management command to generate hashes for all streams that need them.
(imported from commit b3a05e47dfe69b44f984185e360d79bf04f7885b)
2013-08-09 14:59:27 -04:00
Jessica McKellar c020545e02 [schema] models: add an email_token field to Streams.
The e-mail forwarder will use this. Set it to nullable temporarily to
accomodate existing streams; later commits will a) provide a script to
give all streams a token, and b) make the field non-null.

Realm administrators will eventually have a UI to regenerate stream
tokens.

(imported from commit a084d0a7012eb9665e4da095cbc46aa9ef354eaa)
2013-08-09 14:59:26 -04:00
Jessica McKellar 3f8dfc7b9b Move to a common random token generation function instead of several one-offs.
(imported from commit 3217de5384088deff68fbffc6bd481c045a76817)
2013-08-09 14:59:26 -04:00
Jessica McKellar 28a4c1e971 Give API superusers the ability to send messages to arbitrary realms.
(imported from commit e7d1e89844cd2c32c14ad852d848e93b5861eac1)
2013-08-09 14:59:26 -04:00
Jessica McKellar 62a20cf0ef Make emailgateway@zulip.com an API superuser.
(imported from commit 02b6c98123bbc10bd8feca29382a091b43d5b65a)
2013-08-09 14:59:26 -04:00
Steve Howell 6790ed79cc Add a unit test for activity.js.
This includes slightly invasive, but harmless, changes to
the production code.

(imported from commit ff40af504de2360ada866508da262e0d2e9f7ad9)
2013-08-09 13:11:59 -04:00
Steve Howell db33028b98 Added tools/test-js-with-casper symlink.
The test-all script now calls the symlink, and the run script
has been cleaned up to be symlink friendly.

(imported from commit 8abb5c1e5744416e94ff843e50c53e0d0f7e1316)
2013-08-09 13:04:52 -04:00
Steve Howell cf1d94edef Add a test for stream_color.js (pick_color).
(imported from commit a49f96a4a7b61ef51c057e8a3f11c116d77ebb49)
2013-08-09 12:29:02 -04:00
Steve Howell cef72fd8b8 Add tests for the Filter class.
(imported from commit ef0917bd7911c5cc6f6d20d356c156d483ba723f)
2013-08-09 12:04:43 -04:00
Steve Howell cc73619a9d Add unit tests to narrow.js.
This includes slightly invasive, but harmless, changes to
production code.

(imported from commit 847557c11088b75c836cc399d0af75353a8faa3a)
2013-08-09 11:59:32 -04:00
Steve Howell 50b28dec49 Add node-based unit tests for util.js.
(imported from commit df666a5b96d378787e911c2cd6e509b7d42e1cb4)
2013-08-08 17:25:24 -04:00
Waseem Daher 49849a214f New onboarding step: Set up an integration.
(imported from commit 2c6cc6f703e893b44b2871c9510e858743d417ad)
2013-08-08 17:23:27 -04:00
Steve Howell 8eb15a5436 Don't show inactive users as stream subscribers.
This fixes trac #1660.  A deactivated user may still have the
active flag set to "true" on their subscriptions, but this is
just to help future reactivations; they are not actually
valid subscribers while deactivated, so we add UserProfile.is_active
to our filter in the query in get_subscribers_backend().

(imported from commit 8598b2e180faea618371293e42b794898e645004)
2013-08-08 16:29:18 -04:00
Steve Howell 164215bc78 Support API for changing user's API key.
(imported from commit b9f5594cf809965c996115c8420a359820dad3ff)
2013-08-08 13:03:09 -04:00
Steve Howell 0b4c37ef8d Autocomplete names w/spaces in search.
See trac #1356.

(imported from commit 6aaf122c0f6d7b1d92bb074e8f3fbb93d0b63ceb)
2013-08-08 12:54:20 -04:00
Kevin Mehall 0b9497305f Add defensive checks against undefined messages to _is_summarized_message.
Should fix the issue with empty realms.

(imported from commit afca70ebf3b7b74ae0d0c269c72b4f8d54fc254b)
2013-08-08 12:47:23 -04:00
Tim Abbott 9181c7c75b Move generate-fixtures to tools/.
(imported from commit 3d452b17e315ba9adf91e33408a7711d16b069a2)
2013-08-08 10:22:32 -04:00
Tim Abbott 2ea1bb05a5 Rename ~/.humbugrc to ~/.zuliprc.
(imported from commit a0d53dd20097a56971874dc1d84c6f95267e84f2)
2013-08-08 10:22:31 -04:00
Jessica McKellar d6c87f35e2 Move domain validation from a form field validator to a data cleaning check.
We need to be able to let a user through if they are trying to sign up
for a completely open realm like CUSTOMER3.

(imported from commit 1e33ab0ce94545f217739d501e9227dfb48e1123)
2013-08-08 10:12:22 -04:00
Jessica McKellar 99b2a90440 Move completely_open to models.py.
It will have new callers soon and that's as fine a place as any to
avoid circular imports.

(imported from commit 089a724e9ad06cb5a51ffe80f1729d789238e5f6)
2013-08-08 10:12:22 -04:00
Tim Abbott 7b9305b06f Rename Django project to zproject.
This includes a hack to preserve humbug/backends.py as a symlink, so
that we don't need to regenerate all our old sessions.

(imported from commit b7918988b31c71ec01bbdc270db7017d4069221d)
2013-08-07 11:04:03 -04:00
Kevin Mehall eac6463031 Implement message summarization experiment.
When you read messages in a narrow and then un-narrow, collapse
adjacent messages read in the narrow into a summary row that can
be clicked to expand those messages.

Scoped to staging with feature flags.

The implementation of this within our current MessageList is rather ugly.

(imported from commit bcb3a39d8c0c334136fe86318f18ead03f0f50bf)
2013-08-07 10:24:03 -04:00
Tim Abbott 4c8fdec554 Rename humbug => zulip in comments.
(imported from commit 26f305fa9351135a1b874f3c2106f03aed7683cb)
2013-08-07 10:00:08 -04:00
Tim Abbott ae615dfb4d Rename humbug => zulip in some settings.
(imported from commit 4d10e6213cf828f16b833ecba98b950972c32442)
2013-08-07 10:00:08 -04:00
Tim Abbott d59ba39518 Rename humbug_finish to zulip_finish.
(imported from commit a73ef9302d16a4068c7d050d4882d2eba699488d)
2013-08-07 10:00:08 -04:00
Tim Abbott 661ca38b58 Change humbug => zulip in some local variables.
(imported from commit 88caa4a87ea0fd269ab741645c124c5d07d69c0a)
2013-08-07 10:00:08 -04:00
Tim Abbott 2db6dc6c88 Change humbug => zulip in populate_db variables.
(imported from commit 14f8e072fd87478e8877925912fde113a75aba2c)
2013-08-07 10:00:08 -04:00
Tim Abbott 41433e552f Remove old sqlite path zephyrdb from .gitignore files.
(imported from commit 1d9c9849de46854ace1caa4c32d5fe4c86d2ff5c)
2013-08-07 10:00:08 -04:00
Tim Abbott d8f78a5e2d Fix some remaining references to zephyr.
(imported from commit 2072d3451cc08bc32b997d7fafaafd7b6ac568df)
2013-08-07 10:00:08 -04:00
Tim Abbott d6e32668c8 Change Humbug => Zulip in name of exception filter module.
(imported from commit 87d4a45834f605a83fa5f9286217258dafaa1b92)
2013-08-07 10:00:07 -04:00
Tim Abbott d63a398716 Change Humbug => Zulip in name of error limiter module.
(imported from commit 55c5deba463faecc50da22e9745fd13ad8b11fd8)
2013-08-07 10:00:07 -04:00
Tim Abbott 6083ad7244 Change Humbug => Zulip in name of finder module.
(imported from commit 2f5391da2c3ce667531a3c6155c759309b9249f5)
2013-08-07 10:00:07 -04:00
Tim Abbott 034c96ef77 Change Humbug => Zulip in name of storage module.
(imported from commit 37d7994b36e5140962866d5c11d98ca05ad15d62)
2013-08-07 10:00:07 -04:00
Tim Abbott 3a470aa9c7 Change Humbug => Zulip in names of error reporting handlers.
(imported from commit 12e5486321303c80f6676c1f516ff35c3dcb676d)
2013-08-07 10:00:07 -04:00
Tim Abbott 1f1af26048 Change Humbug => Zulip in text/comments.
(imported from commit 2f9d73431ae40e1b9e9e11bc2f4f62f566ae758a)
2013-08-07 10:00:07 -04:00
Tim Abbott e05979d4c4 Rename humbug_realm to zulip_realm.
(imported from commit b36dcc7e5240159357a0f30036394a2af9b85844)
2013-08-07 10:00:07 -04:00
Steve Howell 57f518c9c2 Add node JS unit tests for MessageList.
(imported from commit 486a343add91fd5037431504e1ce4a750bfa9fbf)
2013-08-07 09:25:13 -04:00
Steve Howell 9f9c7c3e3b Loosen up emoji regex. (i.e. More emojis! 👍)
Now parsed: 🍺,🍺;🍺!

 If \w characters surround :foo:, we still say it's NOT an
 emoji, but we used to do this for \S characters, so it's loosened up.

(imported from commit 49b33d2f0ffdcfde8947ae411a4addcf4c24af9c)
2013-08-06 18:20:30 -04:00
Steve Howell 3aa5930191 Streamline search suggestions when query has trailing space.
If you entered "stream:Denmark " in the search box, we would show
you two suggestions for "stream Denmark", despite our duplicate
detection, because we didn't canonicalize the suggestion that is
literally based off the user typed query, and so the other way
of generating the "stream Denmark" suggestion created a duplicate.

Now all the suggestions we generate are canonicalized, so the
generalized duplicate detection can work.

(imported from commit 52bf08ccf9bb2e2260ca8c20690169aead3732ab)
2013-08-06 14:04:29 -04:00
Tim Abbott e111a2f9a5 [manual] Rename Django app from zephyr to zerver.
This needs to be deployed to both staging and prod at the same
off-peak time (and the schema migration run).

At the time it is deployed, we need to make a few changes directly in
the database:

(1) UPDATE django_content_type set app_label='zerver' where app_label='zephyr';
(2) UPDATE south_migrationhistory set app_name='zerver' where app_name='zephyr';

(imported from commit eb3fd719571740189514ef0b884738cb30df1320)
2013-08-06 07:39:36 -04:00