Commit Graph

6515 Commits

Author SHA1 Message Date
Steve Howell a8f6c2fe55 Add CheckMessageTest.test_bot_pm_feature() test.
This tests that a bot's owner gets sent a message if the bot
sends a message to a stream with no subscribers. (Presumably
the message will be a PM; we could make the test more precise
in the future.)

(imported from commit 0aaf931a90cb9c7bc3fde8ac545c6b6ad0a55668)
2013-09-20 10:19:06 -04:00
Steve Howell 7b748fed7a Add CheckMessageTest class
(imported from commit 07c4ba895570853c923703b1332c4fc403cc858e)
2013-09-20 10:19:06 -04:00
Jessica McKellar ee2cd51c4c generate_invite_links: work for open realms too.
(imported from commit ec2143d25cb2f6f4181ece7a25c79666334a1634)
2013-09-20 10:00:10 -04:00
Zev Benjamin 9b84b2dd67 github: Reduce code duplication
This includes:
* Merging the pull request and issue subject creation functions
* Factoring out pull request and issue content creation

(imported from commit 9cf90e999482a1998431e6483788522101607167)
2013-09-19 23:44:21 -04:00
Zev Benjamin e5e7e2f7bf github: Rearrange code to put the pull request and issue handlers next to each other
This makes their parallelism clearer.

(imported from commit 328d6df9443ed68ff5f462b405a930ecb6d90155)
2013-09-19 23:44:21 -04:00
Zev Benjamin 0394459f04 github: Put pull request comments on the 'commits' stream
(imported from commit d50c1f577737a07da1f08a1fbfc4242ca9d6d4a1)
2013-09-19 23:44:21 -04:00
Zev Benjamin 1c82a9ecfa github: Format pull request messages more like issue messages
(imported from commit cba3a84c3abb6f33495e5afbe8e03d1a7a7d046c)
2013-09-19 23:44:21 -04:00
Zev Benjamin f99cf15358 github: Add tests for pull requests
(imported from commit dd099cd0e630c09f490ecd5aac761ce131b0a8e2)
2013-09-19 23:44:21 -04:00
Zev Benjamin df5c4bb202 github: Enable pull requests for zulip.com so we can test them
(imported from commit ab13951a77d6563a9ec41d6ed7f991579623c565)
2013-09-19 23:44:20 -04:00
Zev Benjamin c5d4a640be tests: Refactor Github tests to reduce code duplication
(imported from commit 7c34bd2eefe706898479f96a03685f6e027bf43f)
2013-09-19 23:44:20 -04:00
Zev Benjamin f47258c740 github: Factor out pull request and issue subject creation
(imported from commit 539238f78b0ee49672a1338fc96d00bb21ce539d)
2013-09-19 23:44:20 -04:00
Zev Benjamin 7c74983370 Ensure select_on_focus handlers are not called recursively
This fixes #1696.

(imported from commit 4d7ba3a1e34aa48d2675178913de30d081653762)
2013-09-19 19:10:45 -04:00
Kevin Mehall 4af8eaaa7a Remove data-toggle="modal" from gear menu links
It makes bootstrap look up the href as a DOM element, which caused
a browser error because the path is not a CSS selector.

(imported from commit 196a5983ae6a31716b14ae577239fe7ab1416226)
2013-09-19 17:30:12 -04:00
Waseem Daher 190390d8ea Allow MIT to invite coworkers.
(imported from commit 273b3abdd3dcc49c01c1a04001450983d4acb000)
2013-09-19 17:14:41 -04:00
Allen Rabinovich 0b9b01e96a Revert to old logo
(imported from commit 0e4ccff295797d36ee89ffb078bef06b5a5edca0)
2013-09-19 13:20:27 -07:00
Steve Howell e79e74ade4 Add narrowed_to_topic() helper function.
(imported from commit 9190caa9b183893fb7ae883686b9bdbd661d5895)
2013-09-19 15:41:00 -04:00
Steve Howell a4e2ed9fd2 Add test_narrowed() to narrow.js unit tests.
(imported from commit 060032ac00d0c28a9625e2885ee3156bc94ff130)
2013-09-19 15:40:59 -04:00
Steve Howell 51b8caf442 Add set_filter() to narrow unit tests.
(imported from commit 60734fa1a9d0d28e8c0277a41cc69186bc2b6c0e)
2013-09-19 15:40:59 -04:00
Leo Franchi d3487aef15 Bump windows & mac apps to 0.3.7
(imported from commit 507332336538fae8321a200196b2778861967f6d)
2013-09-19 15:32:41 -04:00
Kevin Mehall 6695105bb9 Fix 2499d7b to not break user registration.
Some bots created by us do not have owners. Don't try to send a
message to the nonexistent owner.

(imported from commit ab952eccd7d6c4728e9477a106142214b5c81ca9)
2013-09-19 13:42:20 -04:00
Kevin Mehall 0da1d974bd Check the 'Get our apps' checkbox if you click any of the links to the apps page
(imported from commit 85795fae8a5ee78f0138aa08f09f645f75c5e9e7)
2013-09-19 13:23:35 -04:00
Kevin Mehall a77746e9fd Pull code that only has to run once out of the loop
(imported from commit 8c31c4bda6bf41e130fc4704d5520f500b9321f8)
2013-09-19 13:23:35 -04:00
Kevin Mehall bc36aad698 Show desktop apps alert when tutorial completes
(imported from commit 7719ec798dbcca519fd79ac8da9196e1a862764f)
2013-09-19 13:23:35 -04:00
Allen Rabinovich 1b4ee0c027 An alert informing about the desktop app
(imported from commit 627351b4bcd8caea22c8e83b0a09e18dd08a1ee1)
2013-09-19 13:23:35 -04:00
Jessica McKellar 5a32dc68c8 Fix a bug in the missed message count used for plaintext missed message emails.
We were previously using the true count of unread message for HTML
emails but the number of conversations for plaintext. Make them
consistent.

(imported from commit efb140abcc95faf00631c03580f518ca4d8ef58c)
2013-09-19 11:55:43 -04:00
Jessica McKellar 7e733a1b91 Don't rate-limit missed message e-mails.
Instead just rely on the 2-minute delay in the management command to
batch conversations.

We've had people report being confused or thinking the feature was
broken when they didn't get e-mails because of our rate-limiting, so
let's see if this is not too overwhelming.

(imported from commit 706ddb07b906b5c2edea1159c04acc2ee6f06e29)
2013-09-19 11:55:42 -04:00
Jeff Arnold f063921260 Enable summarizing for everyone
(imported from commit c03d48ad9c0fe6dfe86539fbff1f501b42b3b6d1)
2013-09-19 10:51:29 -04:00
Steve Howell 7228ce956b Wait for puppet checks to finish in lint-all
(imported from commit 760c49622e5f33e12551f24128e1df54a9ae8848)
2013-09-19 10:46:29 -04:00
Steve Howell 203a71dcd0 Fail hard on pyflakes errors.
Also, run pyflakes in the background like the other processes.

(imported from commit b168a5f7dd6dd5ec4b75e3148aea82b3e1040f87)
2013-09-19 10:46:28 -04:00
Waseem Daher 790e2b67de norman-mailer: Declare that our file is UTF-8.
(imported from commit 54236cd3bc4e4291767a47da21043992e592de48)
2013-09-19 10:44:25 -04:00
Steve Howell de0d50d31a [important] Fix recent regression w/maybe_get_subscribers
(imported from commit 8069f729dcb2bfec1c1df8f50a88fe49545a9a87)
2013-09-19 09:37:39 -04:00
Steve Howell c6a9297f1a Add blueslip warnings to stream_data functions.
Warn inside these functions when you get data on streams that you
are not subscribed to:

  add_subscriber
  remove_subscriber
  user_is_subscribed

The back end should be smart enough not to spam us with subscriber
info that we don't care about.

(imported from commit b27644be2abc37c11ddff884ef392ea208bd1bd3)
2013-09-19 08:52:54 -04:00
Steve Howell 3c69a6dd26 Bulk-send peer_add events in bulk_add_subscriptions().
Send a single peer_add event per stream that has multiple users.

(imported from commit 1027b212557f848d437128a03698ecd54575c3fd)
2013-09-19 08:52:54 -04:00
Steve Howell c8c64984d3 Eliminate redundant peer_add notifications.
Don't send peer_add notifications to users who are already
getting add notifications, because they will already know
about subscribers.

(imported from commit 726b54ae0e30b71440b17d9c51b026872ea96218)
2013-09-19 08:52:54 -04:00
Steve Howell c58d366178 Optimize notifications from do_add_subscription().
Instead of sending one notification per user, bulk them up with
the users parameter.

(imported from commit c296f23599a214a63ef6f09406a9deaea469a7f3)
2013-09-19 08:52:54 -04:00
Steve Howell 8182d60961 Optimize query used by do_add_subscription().
It only grabs the user_profile_id column now.  This leads to a
speedup of about 16x between grabbing large ORM objects vs.
small 1-column dictionaries.

(imported from commit 95150bff3fdcbe250b04f014062224af42a6644f)
2013-09-19 08:52:54 -04:00
Steve Howell e89c6f64bd Extract notify_peers().
Splitting out notify_peers() will give us flexibility for cleaning
up how we notify peers for bulk adds.

(imported from commit e108fa2c432cc1fe54d788c58c82c983e0f2394e)
2013-09-19 08:52:54 -04:00
Steve Howell d24d8e4b36 Optimize showing subscribers on the settings page.
If you expand subscribers on your settings page, you will now see
a query like this in your postgres logs:

SELECT "zerver_userprofile"."email"
FROM "zerver_subscription" INNER JOIN "zerver_recipient" ON ("zerver_subscription"."recipient_id" = "zerver_recipient"."id") INNER JOIN "zerver_userprofile" ON ("zerver_subscription"."user_profile_id" = "zerver_userprofile"."id") WHERE ("zerver_recipient"."type" = 2  AND "zerver_subscription"."active" = true  AND "zerver_recipient"."type_id" = 40  AND "zerver_userprofile"."is_active" = true )

The join's still complicated, but the list of fields is one instead of 40+.

(imported from commit 48de1f888193a4d23fcea52d0b633d134e4a3ff7)
2013-09-19 08:52:53 -04:00
Steve Howell 9cdedf7e6c Optimize adding subscriptions with maybe_get_subscriber_emails().
To get emails, query one field instead of 40-ish fields.

(imported from commit d2dbbe23871df76bc7d431dcd9b19ebd7a58c161)
2013-09-19 08:52:53 -04:00
Steve Howell 986dd8289e Optimize get_subscribers back end.
get_subscribers_backend() now calls the new get_subscriber_emails()
function, which just queries the email field:

  "zerver_userprofile"."email"

...instead of querying about 40 fields that it never uses.

I was able to verify the query slimming by watching my postgres server log.

Also, you can verify that the ORM does roughly 16x less work using values():

>>> def f(): return [sub.user_profile.email for sub in list(Subscription.objects.all().select_related())]
...
>>> def g(): return [row['user_profile__email'] for row in list(Subscription.objects.all().values('user_profile__email'))]
...
>>> def timeit(func): t = time.time(); func(); return time.time() - t
...
>>> timeit(f)
0.045198917388916016
>>> timeit(g)
0.002752065658569336

(imported from commit a69f690a96d076b323fdfc2f4821b0548bdfac7f)
2013-09-19 08:52:53 -04:00
Steve Howell db2c9ff8c2 Extract get_subscribers_query
(imported from commit fea253591093a1f0cf722c1d4bcfb0df4f881984)
2013-09-19 08:52:53 -04:00
Steve Howell b2a7860d56 Add test_multi_user_subscription() to backend tests.
(imported from commit aa6849f7c01f083144acd3ecb72cf7e31794dad7)
2013-09-19 08:52:53 -04:00
Steve Howell b02770440a Add tornado_redirected_to_list() to tests.py
(imported from commit e515d3e4b9f04b5db56d4c9433bc9ba15fd3b4da)
2013-09-19 08:52:52 -04:00
Allen Rabinovich b50fd7c16d Remove user list top margin
(imported from commit e70fb95a4417b497c13a35a29e4e9b1b49423489)
2013-09-18 13:35:16 -07:00
Kevin Mehall 8c7f1ecffa bugdown: Don't generate garbage on invalid links.
LinkPattern returned a string which contained a placeholder if the URL was
considered invalid. AtomicLinkPattern wrapped this in an AtomicString,
where the placeholder doesn't get removed properly.

m.group(0) is always incorrect because python-markdown modifies your regex
to include more than you specified (this is why part of the message got
duplicated).

(imported from commit 576bdf09c2b677cf4bc56484c363eb05f2110158)
2013-09-18 16:22:13 -04:00
Kevin Mehall 63cff6eb71 Make populate_db set the is_bot flag on bot accounts.
(imported from commit 93a507faa2b19fde05376fd73ed3a65149cfce68)
2013-09-18 16:16:17 -04:00
Jessica McKellar e73e3d1bac Don't error out on a name change for a stream you're not on.
(imported from commit 8438087b3b6c66f41b9d9152661a93f01a086b28)
2013-09-18 16:09:48 -04:00
Leo Franchi d88266b41d Warn bot owners when a bot sends a message to a nonexistent stream
(imported from commit 2499d7bd9d176a7ab43f751eb855813d0a479bd4)
2013-09-18 15:54:13 -04:00
Leo Franchi ce4a850bfc Remove all user we insert into autocomplete when alerting
(imported from commit 34521b5e9e312b5026f9dc015cc35de837d0e2a3)
2013-09-18 15:46:30 -04:00
Jessica McKellar 4300d7441a Add the new html2text requirement for the email mirror to Puppet.
(imported from commit 8d5e9eda4e554a3b48d4fa352e37125f31cafaac)
2013-09-18 15:41:27 -04:00