1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-11 01:12:41 +01:00
phorge-phorge/src/applications/config
epriestley 6db97bde12 Build separate mail for each recipient, honoring recipient access levels
Summary:
Ref T6367. Removes `multiplexMail()`!

We can't pass a single body into a function which splits it anymore: we need to split recipients first, then build bodies for each recipient list. This lets us build separate bodies for each recipient's individual translation/access levels.

The new logic does this:

  - First, split recipients into groups called "targets".
    - Each target corresponds to one actual mail we're going to build.
    - Each target has a viewer (whose translation / access levels will be used to generate the mail).
    - Each target has a to/cc list (the users who we'll ultimately send the mail to).
  - For each target, build a custom mail body based on the viewer's access levels and settings (language prefs not actually implemented).
  - Then, deliver the mail.

Test Plan:
  - Read new config help.

Then did a bunch of testing, primarily with `bin/mail list-outbound` and `bin/mail show-outbound` (to review generated mail), `bin/phd debug taskmaster` (to run daemons freely) and `bin/worker execute --id <id>` (to repeatedly test a specific piece of code after identifying an issue).

With `one-mail-per-recipient` on (default):

  - Sent mail to multiple users.
  - Verified mail showed up in `mail list-outbound`.
  - Examined mail with `mail show-outbound`.
  - Added a project that a subscriber could not see.
    - Verified it was not present in `X-Phabricator-Projects`.
    - Verified it was rendered as "Restricted Project" for the non-permissioned viewer.
  - Added a subscriber, then changed the object policy so they could not see it and sent mail.
    - Verified I received mail but the other user did not.
  - Enabled public replies and verified mail generated with public addresses.
  - Disabld public replies and verified mail generated with private addresses.

With `one-mail-per-recipient` off:

  - Verified that one mail is sent to all recipients.
  - Verified users who can not see the object are still filtered.
  - Verified that partially-visible projects are completely visible in the mail (this violates policies, as documented, as the best available compromise).
  - Enabled public replies and verified the mail generated with "Reply To".

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: carlsverre, epriestley

Maniphest Tasks: T6367

Differential Revision: https://secure.phabricator.com/D13131
2015-06-03 18:59:31 -07:00
..
application Add a very basic cache status page 2015-04-07 14:28:20 -07:00
check Update account roles documentation and remove actAsUser 2015-06-03 18:42:09 -07:00
controller phtize all the things 2015-05-22 21:16:39 +10:00
custom phtize all the things 2015-05-22 21:16:39 +10:00
editor Allow bin/config to affect database configuration and migrate between local and database configuration 2014-10-08 16:15:05 -07:00
exception Apply some autofix linter rules 2014-09-10 06:55:05 +10:00
issue Split Setup Issues into Groups 2015-02-10 12:53:00 -08:00
json Mask remaining config values, and implement set type 2013-01-16 15:06:07 -08:00
management phtize all the things 2015-05-22 21:16:39 +10:00
option Build separate mail for each recipient, honoring recipient access levels 2015-06-03 18:59:31 -07:00
phid Rename PHIDType classes 2014-07-24 08:05:46 +10:00
query Make buildWhereClause() a method of AphrontCursorPagedPolicyAwareQuery 2015-04-20 10:06:09 -07:00
response Clean up a text string 2015-02-13 07:03:09 -08:00
schema Use PhutilInvalidStateException 2015-05-14 07:53:52 +10:00
storage Fix visiblity of LiskDAO::getConfiguration() 2015-01-14 06:54:13 +11:00
view Fix pht method calls 2015-02-10 18:57:45 +11:00