Differential D19035 Diff 45642 src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
Show First 20 Lines • Show All 1,510 Lines • ▼ Show 20 Lines | if ($this->shouldEnableMentions($object, $xactions)) { | ||||
$this->getActor(), | $this->getActor(), | ||||
$old_texts); | $old_texts); | ||||
$new_phids = PhabricatorMarkupEngine::extractPHIDsFromMentions( | $new_phids = PhabricatorMarkupEngine::extractPHIDsFromMentions( | ||||
$this->getActor(), | $this->getActor(), | ||||
$new_texts); | $new_texts); | ||||
$phids = array_diff($new_phids, $old_phids); | $phids = array_diff($new_phids, $old_phids); | ||||
// Count any users who were explicitly added as subscribers (other than | |||||
// the actor) as "mentioned". If someone: just adds another user as a | |||||
// subscriber; or adds them as a subscriber explicitly, then writes a | |||||
// comment without actually "@mentioning" them, we still want it to | |||||
// behave like a mention for the purposes of mail stamps. | |||||
$subscriber_type = PhabricatorTransactions::TYPE_SUBSCRIBERS; | |||||
$old_state = array_values($this->subscribers); | |||||
$old_state = array_fuse($old_state); | |||||
foreach ($xactions as $xaction) { | |||||
if ($xaction->getTransactionType() != $subscriber_type) { | |||||
continue; | |||||
} | |||||
$new_value = $xaction->getNewValue(); | |||||
$new_phids = array_merge( | |||||
idx($new_value, '=', array()), | |||||
idx($new_value, '+', array())); | |||||
foreach ($new_phids as $phid) { | |||||
if ($phid === $this->getActingAsPHID()) { | |||||
continue; | |||||
} | |||||
if (!isset($old_state[$phid])) { | |||||
$phids[] = $phid; | |||||
} | |||||
} | |||||
} | |||||
} else { | } else { | ||||
$phids = array(); | $phids = array(); | ||||
} | } | ||||
$this->mentionedPHIDs = $phids; | $this->mentionedPHIDs = $phids; | ||||
if ($object->getPHID()) { | if ($object->getPHID()) { | ||||
// Don't try to subscribe already-subscribed mentions: we want to generate | // Don't try to subscribe already-subscribed mentions: we want to generate | ||||
▲ Show 20 Lines • Show All 2,717 Lines • Show Last 20 Lines |