Page MenuHomePhabricator

Put a workboard link in the email Maniphest sends out about workboard changes
Closed, ResolvedPublic

Description

When you receive email about workboard changes, there's no way to quickly jump to the workboard right now. It would be nice to put a:

WORKBOARD
  http://blahblah/

...link in those emails.

Event Timeline

epriestley raised the priority of this task from to Normal.
epriestley updated the task description. (Show Details)
epriestley added projects: Projects, Maniphest.
epriestley added a subscriber: chad.
epriestley added a subscriber: epriestley.

Interesting. I have CC emails off, but would expect to get it if it were about me. What do you think?

I guess we could add a separate "I am mentioned" sort of thing, which includes all @mentions, CC PHIDs, reviewer PHIDs, assignee PHIDs, etc., and emails you if you appear anywhere.

In the general case, if I've unchecked other similar events like "a task's owner changes" or "a revision's reviewers change", I wouldn't expect me being one of them to punch through that on its own.

Yeah, I was mainly only looking to reducing less important emails (I don't care if people CC themselves on a task, for example). My bar being, I only want to receive emails I am likely interested in taking action (replying) to.

I think this should be straightforward now that custom fields can interact with email.

I wanted to do this in an ultra-general way that would let users disable it by disabling a custom field, but let's do it the realistic way first and I can generalize it into space later:

  • In ManiphestTransactionEditor->buildMailBody(), iterate through $xactions and check if any of them are a TYPE_PROJECT_COLUMN transaction.
  • If at least one such transaction exists (meaning the transaction group affected a workboard column), add a WORKBOARD section.
  • Use addLinkSection() to add the link.
  • You can generate the link with something like PhabricatorEnv::getProductionURI('/projects/board/'.$object->getID().'/').

Oh, it's more complicated than that -- $object is the task. To figure out the project, do something like:

$board_phids = array();
foreach ($xactions as $xaction) {
  if ($xaction->getTransactionType() == ManiphestTransaction::TYPE_PROJECT_COLUMN) {
    $new = $xaction->getNewValue();
    $project_phid = idx($new, 'projectPHID');
    if ($project_phid) {
      $board_phids[] = $project_phid;
    }
  }
}

if ($board_phids) {
  $projects = id(new PhabricatorProjectQuery())
    ->setViewer($this->requireActor())
    ->withPHIDs(array($board_phids))
    ->execute();

  foreach ($projects as $project) {
    // now use $project->getName() and $project->getID() to build
    // a section and link
    $mail->addLinkSection(...);
  }
}

This will add several sections if a transaction group moves a task on several boards. This is currently impossible (there's no way to do it in the UI), although changes in the UI in the future might make it possible so it seems reasonable to half-account for it.

@chad, I think you mentioned this -- feel free to steal it if that seems manageable.