public function applyHeraldEffects(array $effects)
 {
     assert_instances_of($effects, 'HeraldEffect');
     $result = array();
     if ($this->explicitCCs) {
         $effect = new HeraldEffect();
         $effect->setAction(self::ACTION_ADD_CC);
         $effect->setTarget(array_keys($this->explicitCCs));
         $effect->setReason(pht('CCs provided explicitly by revision author or carried over ' . 'from a previous version of the revision.'));
         $result[] = new HeraldApplyTranscript($effect, true, pht('Added addresses to CC list.'));
     }
     $forbidden_ccs = array_fill_keys(nonempty($this->forbiddenCCs, array()), true);
     foreach ($effects as $effect) {
         $action = $effect->getAction();
         switch ($action) {
             case self::ACTION_NOTHING:
                 $result[] = new HeraldApplyTranscript($effect, true, pht('OK, did nothing.'));
                 break;
             case self::ACTION_FLAG:
                 $result[] = parent::applyFlagEffect($effect, $this->revision->getPHID());
                 break;
             case self::ACTION_EMAIL:
             case self::ACTION_ADD_CC:
                 $op = $action == self::ACTION_EMAIL ? 'email' : 'CC';
                 $base_target = $effect->getTarget();
                 $forbidden = array();
                 foreach ($base_target as $key => $fbid) {
                     if (isset($forbidden_ccs[$fbid])) {
                         $forbidden[] = $fbid;
                         unset($base_target[$key]);
                     } else {
                         if ($action == self::ACTION_EMAIL) {
                             $this->emailPHIDs[$fbid] = true;
                         } else {
                             $this->newCCs[$fbid] = true;
                         }
                     }
                 }
                 if ($forbidden) {
                     $failed = clone $effect;
                     $failed->setTarget($forbidden);
                     if ($base_target) {
                         $effect->setTarget($base_target);
                         $result[] = new HeraldApplyTranscript($effect, true, pht('Added these addresses to %s list. ' . 'Others could not be added.', $op));
                     }
                     $result[] = new HeraldApplyTranscript($failed, false, pht('%s forbidden, these addresses have unsubscribed.', $op));
                 } else {
                     $result[] = new HeraldApplyTranscript($effect, true, pht('Added addresses to %s list.', $op));
                 }
                 break;
             case self::ACTION_REMOVE_CC:
                 foreach ($effect->getTarget() as $fbid) {
                     $this->remCCs[$fbid] = true;
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Removed addresses from CC list.'));
                 break;
             case self::ACTION_ADD_REVIEWERS:
                 foreach ($effect->getTarget() as $phid) {
                     $this->addReviewerPHIDs[$phid] = true;
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Added reviewers.'));
                 break;
             case self::ACTION_ADD_BLOCKING_REVIEWERS:
                 // This adds reviewers normally, it just also marks them blocking.
                 foreach ($effect->getTarget() as $phid) {
                     $this->addReviewerPHIDs[$phid] = true;
                     $this->blockingReviewerPHIDs[$phid] = true;
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Added blocking reviewers.'));
                 break;
             case self::ACTION_APPLY_BUILD_PLANS:
                 foreach ($effect->getTarget() as $phid) {
                     $this->buildPlans[] = $phid;
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Applied build plans.'));
                 break;
             case self::ACTION_REQUIRE_SIGNATURE:
                 foreach ($effect->getTarget() as $phid) {
                     $this->requiredSignatureDocumentPHIDs[] = $phid;
                 }
                 $result[] = new HeraldApplyTranscript($effect, true, pht('Required signatures.'));
                 break;
             default:
                 $custom_result = parent::handleCustomHeraldEffect($effect);
                 if ($custom_result === null) {
                     throw new Exception(pht("No rules to handle action '%s'.", $action));
                 }
                 $result[] = $custom_result;
                 break;
         }
     }
     return $result;
 }