HomePhabricator

Persist excluded recipients when saving mail

Description

Persist excluded recipients when saving mail

Summary:
Fixes T5185. The fundamental issue is that this excludePHIDs property was not saved, so the logic went like this:

  • Generate excludePHIDs correctly.
  • Pass excludePHIDs through the stack.
  • Perform some other computations correctly.
  • Queue the mail for the daemons, throwing it away.
  • Daemons process mail with empty excludePHIDs list.

Store it in the persistent properties array instead.

Also remove the "override self mail" thing, since it's only used by bin/mail send-test and suffers from the same issue. I think it's too useless to fix, since even if you get caught by it, bin/mail makes it clear why the message was dropped.

Test Plan:
Notable:

  • exclude present in properties
  • Exclusion reason under RECIPIENTS header

1$ ./bin/mail show-outbound --id 22653
2PROPERTIES
3ID: 22653
4Status: queued
5Related PHID: PHID-TASK-gdxfct3qqboudbmfye3h
6Message:
7
8PARAMETERS
9subject: T10000145: asdf
10from: PHID-USER-lqiz3yd7wmk64ejugvov
11subject-prefix: [Maniphest]
12vary-subject-prefix: [Commented On]
13thread-id: maniphest-task-PHID-TASK-gdxfct3qqboudbmfye3h
14is-first-message:
15exclude: ["PHID-USER-aeabc4ipqbifny3rw4ok"]
16mailtags: ["maniphest-comment"]
17is-bulk: 1
18parent-message-id: i4lboqya4tltd4qivqd4a2b4vxzvj4geythhmh2y7gi3uho4kuczrwttq7zoekj4
19cc: ["PHID-USER-aeabc4ipqbifny3rw4ok"]
20reply-to: prefix+T10000145+public+caace40165701255@localderp.com
21
22HEADERS
23Thread-Topic: T10000145: asdf
24X-Herald-Rules: <51>, none
25X-Phabricator-To: <PHID-USER-lqiz3yd7wmk64ejugvov>
26X-Phabricator-Cc: <PHID-USER-aeabc4ipqbifny3rw4ok>
27X-Phabricator-Cc: <PHID-USER-lqiz3yd7wmk64ejugvov>
28
29RECIPIENTS
30! duck (duck)
31 - This message is a response to another email message, and this recipient received the original email message, so we are not sending them this substantially similar message (for example, the sender used "Reply All" instead of "Reply" in response to mail from Phabricator).
32
33BODY
34epriestley added a comment.
35
36quackquack
37
38TASK DETAIL
39 http://local.aphront.com:8080/T10000145
40
41REPLY HANDLER ACTIONS
42 Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
43
44To: epriestley
45Cc: duck, epriestley

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5185

Differential Revision: https://secure.phabricator.com/D10234