Commit Graph

147 Commits

Author SHA1 Message Date
Jessica McKellar 151fbd832c do_update_message: use is_admin to check who can edit a topic.
(imported from commit e96245506c7eecc8aed3fbdb6dfb7c44aca3234e)
2013-11-19 14:31:02 -05:00
Jessica McKellar 2c841042ae Allow admins to rename any topic.
(imported from commit 5b557e8244e5196c9aa0ee29d4efb00986434528)
2013-11-19 14:31:02 -05:00
Tim Abbott f3fa78d30c Rename do_[rd]activate to do_[rd]activate_user.
For similarity with do_activate_user.

(imported from commit 2874af84dbe1ce666de10e0d8ffe2daa8bad9731)
2013-11-16 11:35:26 -05:00
Steve Howell bdfd3ed9c2 Add do_reactivate() action.
(imported from commit fc73d0fdd3a6125b3b31a75c3b108ceb266e528b)
2013-11-16 11:35:25 -05:00
acrefoot daffe049ad Don't use hardcoded noreply@zulip.com, zulip@zulip.com, or https://zulip.com
(imported from commit 1132553b63ae23ebcca746f0f65205b97bfee7dc)
2013-11-15 21:31:37 -05:00
Jessica McKellar b0209fec05 Don't puke on non-ASCII characters when shelling out to html2text.
(imported from commit a407c9fb2a090075d5e26b5db00388f4f81de1f5)
2013-11-15 12:28:30 -05:00
acrefoot f991fbff9e Fix clear_followup_emails_queue on Zulip Enterprise.
(imported from commit bf211b205bc39a08340306d06fbb76479a02ed9e)
2013-11-14 11:32:29 -05:00
acrefoot b6751d2119 additional lowercase situations in clear_followup_emails
(imported from commit c0c031e7abb2a166636075596fb0d5ed21a5822c)
2013-11-13 17:53:37 -05:00
Jessica McKellar 338de6715d Fix broken html to markdown conversion on Linux.
(imported from commit 1b62d382e4f2b60972384a6b4b4173161ea58b73)
2013-11-13 17:47:28 -05:00
acrefoot f7b5a10da0 [schema] Add ScheduledJob table, and update mandrill related code
ScheduledJobs with type Email displace the usual mandrill codepaths
in the Zulip Enterprise deploys

* Email-specific helper functions will appear in deliver_email.py
* 0058_auto__add_scheduledjob.py

(imported from commit 8db08d8a279600322acfdbed792dc1a676f7a0ab)
2013-11-13 16:41:36 -05:00
Jessica McKellar 8382e074fe Move use of html2text to a subprocess call.
(imported from commit 36e8a6f030d75196c28fbdc0e58c6968952d95ff)
2013-11-13 16:28:29 -05:00
Jessica McKellar 5c0a624f9e Don't notify on stream messages by default for LevelUp.
(imported from commit c0c21047698612dbcee5eee9e858f37a8f8e29bd)
2013-11-13 16:14:36 -05:00
Leo Franchi 62ba16a829 [schema] Allow a realm to have aliases for multiple other domains
(imported from commit 5d0340afd4c77f50db63550a3ec8d81e885c285c)
2013-11-13 14:17:43 -05:00
Leo Franchi 6274c33f86 Allow disabling of feedback system in UI
(imported from commit ce16b2916784e9cf10a230cb47515ffc65888778)
2013-11-13 11:18:02 -05:00
Tim Abbott 5d5e662c08 Disable event logs on local server.
(imported from commit eafbd645ae7ce8d868de2fb8c6548325a05b1340)
2013-11-12 15:57:01 -05:00
Leo Franchi cc2d17d7c0 Allow omission of EMAIL_GATEWAY_BOT and stream emails
(imported from commit 51412d2a46bbacd6537ef892e7b6bdf33ac94079)
2013-11-12 10:32:34 -05:00
Jessica McKellar 74d1a56c68 Do not notify on stream messages by default for CUSTOMER19.
(imported from commit 7f737b9068ec39fc53678aa5c0976d3da908ce00)
2013-11-06 10:40:28 -05:00
Tim Abbott e06722657a [manual] Remove /messages/latest API and related legacy code.
This requires doing a puppet apply on our servers to take effect
properly.

(imported from commit 19dc56f071f07a5d2571eef49dd835121b2e82b6)
2013-11-05 14:19:40 -05:00
Tim Abbott 87271b57cd Fix feedback check to correctly use the recipients list.
Even for a PM, the "recipients" list is 2 people -- the sender and the
receiver.

(imported from commit 5503e0ee2abb643601a0a4e61366127914808245)
2013-11-04 12:58:40 -05:00
Tim Abbott 68dcc760c3 Clean up some unused imports.
(imported from commit 0c5d8e2a55ba1b8909ba807fee3afe863dcdc226)
2013-11-04 11:51:17 -05:00
Tim Abbott 29aef33c53 Remove transaction management hacks in workers.
(imported from commit 33b9349bd139907755b52474df8a0da13b73b80d)
2013-11-04 07:31:39 -05:00
Leo Franchi db6550e99a Make built-in bots come from settings.py, and allow localserver-specific ones
(imported from commit e21933e37487314ac986147562817a19227e8960)
2013-11-01 14:13:05 -04:00
Jessica McKellar f1e90086f5 Remove the onboarding checklist.
Looking at the historical data, fewer than 50% of active users have
completed the checklist, which means that it is just persistent
clutter. We also have other better ways of encouraging people to send
traffic and get the apps now.

This commit removes both the frontend UI and backend work but leaves
the db row for now for the historical data.

(imported from commit e8f5780be37bbc75f794fb118e4dd41d8811f2bf)
2013-10-31 11:34:15 -04:00
Tim Abbott 1292c5dbfe Add backend support for Jabber mirroring.
(imported from commit 12f5c708a6961aded4f4e166af84e87720be4ddc)
2013-10-29 16:49:42 -04:00
Tim Abbott 901a5c342c Use os.path directly rather than sometimes importing it separately.
(imported from commit 48486c4ea64d02a15faeebb0f490d31e9b113d62)
2013-10-28 15:44:13 -04:00
Leo Franchi e1557bef73 Cache realm user basic info dict that is used in bugdown
(imported from commit 688c47daceb73534be90bd98a031c7b4edb5546e)
2013-10-28 12:59:36 -04:00
Leo Franchi b26f158020 Use user_profile instead of leaked object from list comprehension
(imported from commit 7d8467b104fc80d52fa829eb0ff949b1bd0e578f)
2013-10-28 12:59:36 -04:00
Leo Franchi c12a97577e Rework local_settings_template.py to be clear about what the user needs to do
(imported from commit f69ea0d57e885509abc70dc4f2bee6e36169691f)
2013-10-25 16:35:27 -04:00
Luke Faraone e552307511 Send feedback to a queue to be forwarded to staging.
(imported from commit 4a9a1bfc6c95763a816263a726cc61b3ca90bf15)
2013-10-25 14:13:30 -04:00
Leo Franchi 2d276179d0 Refactor email-mirror to handle running on any machine
(imported from commit 2971449ceaacb564770e66874fc095f77e68d445)
2013-10-25 11:37:34 -04:00
Leo Franchi 410ee44eb6 Send users push notifications when they miss messages
(imported from commit 6c54fe44a82c5796268e56d3f5577bf4cfc8163a)
2013-10-24 14:54:31 -04:00
Leo Franchi 05564ec0e2 [schema] Add a config option for enabling/disabling push notifications
(imported from commit 5649188cd5e0e4edb6e71559ec7d7fc5e92efaf8)
2013-10-24 14:54:30 -04:00
Tim Abbott 1b381b343d Allow starring historical messages.
This has a small bug where we don't actually filter the message out of
the home view; fixing that requires adding an index on the "flags"
field of UserMessage.

(imported from commit 492c99d0a8e87b253e577be6564bec12099bd8e9)
2013-10-23 18:51:47 -04:00
Steve Howell db398d5e41 Send ids, not emails, of subscribers when loading the page.
(imported from commit 26bbf38664d246476df7062432fa20add7d4cb11)
2013-10-22 15:51:18 -04:00
Steve Howell 3b59952ea3 Extract gather_subscriptions_helper().
The gather_subscriptions_helper() does a separate query to
get emails from user_ids, and it returns an email_dict to its
caller.

This may seem like a step backward, since gather_subscriptions()
now needs to do an additional query, but there is some benefit
in passing fewer redundant emails over the wire from the DB.
The real payoff, though, will come in subsequent commits, where
we will reduce the amount of data going over the wire to the browser,
which will benefit users with slow connections.

(imported from commit bf1cc5828a4c5f68cafd052ea29a177837970206)
2013-10-22 15:51:18 -04:00
Steve Howell 58acef4098 Add get_emails_from_user_ids() action.
(imported from commit 887090de16f685373bd2f3548bd1ec94a7ad4a9e)
2013-10-22 15:51:18 -04:00
Kevin Mehall db71931dab Include is_bot in new user event
(imported from commit 4ae4daaa3ce9b2c2546e1469cc179d209a02c313)
2013-10-22 13:42:22 -04:00
Tim Abbott 8f1fc7c968 Update mirroring backend to support IRC mirrors.
(imported from commit 771aa59b780da0aed2fc7e43d20229e7f42ad06d)
2013-10-21 14:39:21 -04:00
Tim Abbott c34be3a91f Make the forged_timestamp field optional for mirror messages.
(imported from commit 6d03d374bce0d59b0e13c944af7b620a7336a86f)
2013-10-21 14:37:36 -04:00
acrefoot 776feb84e9 Make mandrill actions better
clear_followup_emails_queue now filters by from_email too
send_local_email_template_with_delay passes the template_payload into the subject template

(imported from commit 8044fe2ebad90a9d6d5c67cdfdd08801760fd7f7)
2013-10-21 11:08:38 -04:00
Steve Howell 03c856ce10 Add create-stream management command.
The current version should only be used for testing; for example,
if you want to create a bunch of streams for stress testing, you
can run this in a loop.

(imported from commit ec51a431fb9679fc18379e4c6ecdba66bc75a395)
2013-10-19 09:28:59 -04:00
Kevin Mehall 7b8dea3d54 Add all_public_streams parameter to register API.
It makes the event queue return all messages on public streams, rather
than only the user's subscriptions. It's meant for use with chat bots.

(imported from commit 12d7e9e9586369efa7e7ff9eb060f25360327f71)
2013-10-18 14:55:32 -04:00
Jessica McKellar 6dbf7613a1 Supply a name when creating realms.
For our populate_db bulk creation, just use the domain.

(imported from commit 4fb756f6dfa2d8f90e55822e27891e84168d5d1c)
2013-10-17 13:47:51 -04:00
Steve Howell 8cc82c6cbe Optimize /json/update_message_flags.
I added filter() statements to do_update_message_flags().

Here is some context:

Steve Howell: Case 1, have AND clause to reduce work for DB.

humbug=> update zerver_usermessage set flags = (flags & ~1) where id > 9000;
UPDATE 382
humbug=> select count(*) from zerver_usermessage where (flags & 1) = 0;
 count
-------
   382
(1 row)

humbug=> explain analyze update zerver_usermessage set flags = (flags | 1) where (flags & 1) = 0;
                                                       QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
 Update on zerver_usermessage  (cost=0.00..266.85 rows=47 width=27) (actual time=5.727..5.727 rows=0 loops=1)
   ->  Seq Scan on zerver_usermessage  (cost=0.00..266.85 rows=47 width=27) (actual time=0.045..2.751 rows=382 loops=1)
         Filter: ((flags & 1::bigint) = 0)
         Rows Removed by Filter: 9000
 Total runtime: 5.759 ms
(5 rows)

humbug=> select count(*) from zerver_usermessage where (flags & 1) = 0;
 count
-------
     0
(1 row)
Leo Franchi: Sounds reasonable, but I know way less than zev about DBs so I'll defer to his judgement :)

Steve Howell: Case 2, how the code works now:

humbug=> update zerver_usermessage set flags = (flags & ~1) where id > 9000;
UPDATE 382
humbug=> select count(*) from zerver_usermessage where (flags & 1) = 0;
 count
-------
   382
(1 row)

humbug=> explain analyze update zerver_usermessage set flags = (flags | 1);
                                                        QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------
 Update on zerver_usermessage  (cost=0.00..243.28 rows=9382 width=27) (actual time=362.075..362.075 rows=0 loops=1)
   ->  Seq Scan on zerver_usermessage  (cost=0.00..243.28 rows=9382 width=27) (actual time=0.008..6.138 rows=9382 loops=1)
 Total runtime: 362.105 ms
(3 rows)

humbug=> select count(*) from zerver_usermessage where (flags & 1) = 0;
 count
-------
     0
(1 row)
Steve Howell: In both trials, we set it up so that only 382 of 9382 rows need to be updated. The first trial runs about 63x as fast. The second trial, if my theory is correct, is doing 24x as many writes as it needs. Both trials are reading all 9382 rows.

Steve Howell: The expense of the update statement seems to be proportional to the number of rows you "update", not the number of rows that you actually change.

Steve Howell: For now I created #1869.

Zev Benjamin: That sounds like a reasonable explanation. The disk IO can be expensive

(imported from commit d9090daee1f81cad76c430de0956f9bd504da075)
2013-10-15 11:30:13 -04:00
acrefoot d2b8fe6f57 fix earlier 'linter workaround'
(imported from commit 4ac9f1e57a241f95f53fa65d82c376a61de2c28c)
2013-10-11 11:54:05 -04:00
acrefoot 98897fe5e3 Queue the day 1 and day 2 Zulip followup emails
Handled by the queue processor for signups. Added a management command
that accomplishes the same task, in case it's needed for manually added users,
or in case we goof and need to remove queued emails for a given user.

This addresses Trac #1807

(imported from commit 6727b82a07fa6a3ea3d827860c9e60fd0602297a)
2013-10-10 19:32:21 -04:00
acrefoot f8662c16f7 Add Mandrill decorators, credentials, actions
You can queue email for future delivery or send immediately via mandrill now

(imported from commit e6b6d11a2d94fcdeaffab80793e7ba31955b9031)
2013-10-10 19:32:21 -04:00
acrefoot 851a6e391e change variable name to get linter to stop complaining
(imported from commit b61824c16b1e7ad88375eeebdd945827dfc7fd3c)
2013-10-10 19:24:50 -04:00
Tim Abbott 1a7ddd9ea3 Fix UserActivityInterval overlap bug.
The previous version was incorrect in the event that log_time >
last.start + 15.

(imported from commit 56aa619e8c86db1796cf936c2be5224a25ca2e1f)
2013-10-08 17:21:59 -04:00
Jessica McKellar 3b7143d3ec Linkify narrows in missed message emails.
This will hopefully incentivize people to click one and get back into
the app.

We'll also need this for digest emails.

(imported from commit 57191c3fcca3b12df93a81e4692bb7eb8ccc83b2)
2013-10-08 10:46:52 -04:00