Commit Graph

159 Commits

Author SHA1 Message Date
Tim Abbott ba411b0539 digest: Use get_user_profile_by_id. 2017-08-15 12:53:48 -07:00
Rishi Gupta aa845e7f60 models: Replace ScheduledJob with ScheduledEmail.
ScheduledJob was written for much more generality than it ended up being
used for. Currently it is used by send_future_email, and nothing
else. Tailoring the model to emails in particular will make it easier to do
things like selectively clear emails when people unsubscribe from particular
email types, or seamlessly handle using the same email on multiple realms.
2017-07-17 16:05:38 -07:00
Rishi Gupta f1aaf4cc33 emails: Remove the display_email function.
No longer needed, since this now only appears in build_email.
2017-07-16 16:56:39 -07:00
Rishi Gupta b0d325b8c5 emails: Change send_future_email to accept a to_user_id.
Also changes digest emails to use a to_user_id instead of a to_email.
2017-07-16 16:56:39 -07:00
James Rowan 9bd1b0ba58 emails: Update subject for digest emails. 2017-07-13 18:47:02 -07:00
James Rowan a3b1631832 emails: Make the digest email come from 'Zulip Digest.' 2017-07-13 14:50:36 -07:00
Aditya Bansal 3687dcdb3f pep8: Add compliance with rule E261 digest.py. 2017-05-07 23:21:50 -07:00
Rishi Gupta face3077df email: Rename template_payload to context. 2017-05-05 14:38:25 -07:00
Rishi Gupta 6a8ed81439 send_email: Remove tags argument from send_future_email.
The tags argument was only being used by the Mandrill pathway, which is no
longer around.
2017-05-05 14:38:25 -07:00
Rishi Gupta 68c172192b email.py: Change recipients argument of send_future_email to to_email. 2017-05-05 14:38:25 -07:00
Rishi Gupta 0d4c1b0467 notifications: Move send_future_email to zerver/lib/send_email.py. 2017-05-05 14:38:25 -07:00
Rishi Gupta d70e09b41d notifications: Change sender arg of send_future_email to from_email.
This commit is a step towards the goal of replacing most of the
send_future_email pathway with a call to send_email.

Note that this commit changes the default value of sender from "Zulip
<NOREPLY_EMAIL_ADDRESS>" to "NOREPLY_EMAIL_ADDRESS". NOREPLY_EMAIL_ADDRESS
will soon be changed to have the Zulip in front.
2017-05-05 14:38:25 -07:00
Rishi Gupta e46cbaffa2 email: Remove Mandrill pathways and dependency.
Everything it was doing (send_future_email) can now be done using
ScheduledJob.
2017-05-05 14:38:23 -07:00
Rishi Gupta a413b0dbad notifications: Change send_future_email to take a template_prefix.
Also reorders the arguments a bit to better match
zerver.lib.send_email.send_email.
2017-05-05 14:20:32 -07:00
Rishi Gupta cf38fd156b digest.py: Merge send_digest_email into its callers.
Most of the functionality of send_digest_email is being standardized in
zerver.lib.notifications.send_future_email.
2017-05-05 14:20:32 -07:00
Rishi Gupta ebfae36494 email: Move and rename digest_email templates. 2017-05-03 23:26:14 -07:00
Rishi Gupta 6ba11785ea js dependencies: Change hashchange_encode to hash_util_encode in zerver.
This function formerly replicated the behavior of hashchange.encode, and now
replicates the behavior of hash_util.encode.
2017-03-18 20:40:34 -07:00
Raghav Jajodia a3a03bd6a5 mypy: Added Dict, List and Set imports.
Fixed mypy errors associated with the upgrade.
2017-03-04 14:33:44 -08:00
Rishi Gupta c388858e53 Fix timezone errors in ScheduledJob and digest creation filters.
datetime.utcnow() is a timezone-naive datetime. The Django ORM interprets it
in the settings.TIME_ZONE timezone (e.g. 'America/New_York' in the
development server). We perhaps haven't noticed errors yet since with
'America/New_York' all it means is that emails are sent 5 hours early, or a
slightly different set of messages are included in the digest.
2017-03-01 22:54:28 -08:00
Tim Abbott 4e171ce787 lint: Clean up E126 PEP-8 rule. 2017-01-23 22:06:13 -08:00
Tim Abbott d6e38e2a5c lint: Clean up E123 PEP-8 rule. 2017-01-23 21:34:26 -08:00
Tim Abbott e9158dd520 lint: Clean up E121 PEP-8 rule. 2017-01-23 21:02:39 -08:00
Tim Abbott 00d48bff7d Digest: Fix URIs for emoji and friends in email links.
It turns out we were using malformed URLs in the image tags
(containing just a hostname, but no http(s)!) in what we were passing
to the Django templates for our digest/, which resulted in the Django
templates treating these URLs as http.  Gmail recently cracked down on
loading images in HTTP, causing the emoji links to appear broken in
emails Zulip sends.

Fixes #3258.
2017-01-21 22:25:51 -08:00
Rishi Gupta 8a07545afb Rename digest_email_txt.html to digest_email.html.
The .html file ending is clearer and more in line with our other
email files.
2017-01-06 10:42:28 -08:00
Rishi Gupta 8d038eef2f digest emails: Move the subject line to a templates/ file.
To match how we do the subject line for the emails in followup/ and
invitation/.
2017-01-06 10:42:28 -08:00
Robert Hönig 0917493588 mypy: Convert zerver/lib to use typing.Text. 2016-12-25 10:33:45 -08:00
reallyly 94b28e0afb pep8: Fix E128 violations.
With some line-wrapping tweaks by tabbott.
2016-12-13 10:50:14 -08:00
bulat22101 adebc75740 pep8: Fix E502 violations 2016-12-03 10:56:36 -08:00
Alex Huang 007b693cc7 pep8: Fix E131. 2016-12-01 23:16:47 -08:00
Alex Huang c8ddea16c3 pep8: Fix E122. 2016-12-01 23:16:35 -08:00
Rafid Aslam c5316b4002 lint: Fix E127 pep8 violations.
Fix pep8: E127 continuation line over-indented for visual indent
style issue.
2016-12-01 10:23:55 -08:00
Rafid Aslam 7a2282986a pep8: Fix E225 pep8 violations. 2016-11-28 15:21:15 -08:00
paxapy ff1e97603d context_processors: use a common context for emails.
Fixes #1611.
2016-11-08 11:37:16 -08:00
Eklavya Sharma ccce3ec0be zerver/lib/digest.py: Fix a type annotation. 2016-10-11 11:27:35 -07:00
Tim Abbott 4fbb8c3eee templates: Add new context variables to all templates.
This adds a few new helpful context variables that we can use to
compute URLs in all of our templates:
* external_uri_scheme: http(s)://
* server_uri: The base URL for the server's canonical name
* realm_uri: The base URL for the user's realm

This is preparatory work for making realm_uri != server_uri when we
add support for subdomains.
2016-08-13 16:27:35 -07:00
Tim Abbott 375551aaa6 Clean up most hardcoding of mit.edu domain checks.
This moves all this code to be gated on a few virtual realm settings.
2016-07-26 20:30:12 -07:00
Eklavya Sharma 68823767e2 zerver/lib/digest.py: Fix annotations. 2016-06-18 16:41:40 -07:00
Eklavya Sharma 6f5ed6e7c9 Fix annotations clashing with Stream model fields. 2016-06-13 20:01:02 +05:30
medullaskyline fcdcccb5df Annotate zerver.lib.digest. 2016-06-04 16:20:18 -07:00
Varshit 4e1060076d Purge 'from typing import *' from zerver/.
This is a partial implementation of #636.
2016-04-07 14:07:07 -07:00
Tim Abbott 2059f650ab Add PEP-484 type annotations to zerver/lib/. 2016-04-03 15:40:23 -07:00
Tim Abbott 5bacda3662 python3: Fix usage of .keys()/.values() to handle iterators.
This fixes the places where we use the result of .keys(), .items(),
and .values() that wouldn't work with an iterator to wrap them with
list().
2016-01-26 21:11:25 -08:00
Jessica McKellar eeb8464f4d Don't expose deactivated streams to users through clients or API.
(imported from commit c32715255b3286f52fb313d35659f9357082603a)
2014-01-29 12:41:21 -05:00
Tim Abbott da90d63046 Split out zerver/lib/notifications.py from actions.py.
(imported from commit 784b82834ee4fcb4431e77f8fb1c526f8eec82ad)
2014-01-24 17:33:56 -05:00
Jessica McKellar d3f6c4ef36 Log the actual sending of digest emails in addition to queuing possible ones.
(imported from commit e43ac59e71620fe715db462347db228d5a950aed)
2014-01-10 21:38:59 -05:00
Jessica McKellar 30367d0c0f digest: don't include automated messages in hot conversation accounting.
(imported from commit ab8db46c644b3cf66a4bc654d204d870b8fae91f)
2013-12-31 16:45:21 -05:00
Jessica McKellar 2f59f69a1f digest: tweak sender information.
(imported from commit fafc54d4b9c9cda447c42f2bd24845aee62624c2)
2013-12-18 14:31:03 -05:00
Jessica McKellar 1d11e2cce0 digest: don't show new users for MIT.
(imported from commit b7453cb30e6fcf5b36a5e3e53f67faeb17e74048)
2013-12-17 10:47:16 -05:00
Jessica McKellar 70b8d09391 digest: Fix erroneous early return giving us only 1 hot conversation.
(imported from commit db1588bf98778ef838edd6de88fb1ba750251eae)
2013-12-13 16:38:10 -05:00
Jessica McKellar e85566cbb2 digest: Always pad out to 4 conversations if possible.
(imported from commit 1b31a472db5a22a017e461ba846524226641ade1)
2013-12-13 16:38:10 -05:00
Jessica McKellar 8651e205be digest: Make it impossible to report new streams for MIT users.
We may never enqueue MIT users, but just in case we do, never report
new streams.

(imported from commit 01885f339d7bbb3c8ee665fd576831206d493b88)
2013-12-13 16:38:10 -05:00
Jessica McKellar 040cdc2f91 Don't mention new invite-only streams in digest e-mails.
(imported from commit 10ca5dd77736a085f0cc771888ed0aa1ba68a37d)
2013-12-13 16:38:09 -05:00
Jessica McKellar 4740bc7e3a digest: Don't show PMs sent by you.
You can't have unread PMs sent by you, so we weren't explicitly
checking this, but when testing locally we often ignore the unread
check. Filter PMs sent by you to reduce confusion when testing
locally.

(imported from commit 0205c4a3ed67790b9d60d4f2b927e4cb9e720bf3)
2013-12-13 16:38:09 -05:00
Jessica McKellar e15cc972ec digest: refactor sending the emails into a function for easier testing.
(imported from commit 2f3c8fb8e812c04ab838b1034ae0811309186625)
2013-12-02 18:58:03 -05:00
Jessica McKellar 207cfc449d Add unsubscribe links to digest e-mails.
(imported from commit 4e2a324decf4bc694752cc24b9085361338a08a5)
2013-12-02 18:58:03 -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 2be6c541cf digest emails: use a template filter to format new users, streams, etc.
(imported from commit e61a3dd6753db82da1b30c50e5bbf6273f302645)
2013-10-25 19:11:41 -04:00
Jessica McKellar d4b60e9304 Add a custom template filter for formatting displaying lists of items in emails.
We do this operation several times in the digest e-mails.

(imported from commit 7b906bad582c628d4461637dc7af374df349e09a)
2013-10-25 19:11:40 -04:00
Jessica McKellar 772adc1969 digest: Add functions used to compute interesting traffic.
So far, we gather: "hot conversations", missed PMs, new streams, and
new users.

(imported from commit c3c723d0426cb55bd0e43917c67f93db9052f9ed)
2013-10-25 19:08:46 -04:00