Page MenuHomePhabricator

D11966.id.diff
No OneTemporary

D11966.id.diff

diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php
--- a/src/applications/audit/editor/PhabricatorAuditEditor.php
+++ b/src/applications/audit/editor/PhabricatorAuditEditor.php
@@ -519,22 +519,6 @@
}
- protected function shouldSendMail(
- PhabricatorLiskDAO $object,
- array $xactions) {
-
- // not every code path loads the repository so tread carefully
- // TODO: They should, and then we should simplify this.
- if ($object->getRepository($assert_attached = false)) {
- $repository = $object->getRepository();
- if (!$repository->shouldPublish()) {
- return false;
- }
- }
-
- return $this->isCommitMostlyImported($object);
- }
-
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
$reply_handler = PhabricatorEnv::newObjectFromConfig(
'metamta.diffusion.reply-handler');
@@ -808,14 +792,6 @@
);
}
-
-
- protected function shouldPublishFeedStory(
- PhabricatorLiskDAO $object,
- array $xactions) {
- return $this->shouldSendMail($object, $xactions);
- }
-
protected function shouldApplyHeraldRules(
PhabricatorLiskDAO $object,
array $xactions) {
@@ -916,4 +892,39 @@
return $object->isPartiallyImported($mask);
}
+
+ private function shouldPublishRepositoryActivity(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+
+ // not every code path loads the repository so tread carefully
+ // TODO: They should, and then we should simplify this.
+ if ($object->getRepository($assert_attached = false)) {
+ $repository = $object->getRepository();
+ if (!$repository->shouldPublish()) {
+ return false;
+ }
+ }
+
+ return $this->isCommitMostlyImported($object);
+ }
+
+ protected function shouldSendMail(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+ return $this->shouldPublishRepositoryActivity($object, $xactions);
+ }
+
+ protected function shouldEnableMentions(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+ return $this->shouldPublishRepositoryActivity($object, $xactions);
+ }
+
+ protected function shouldPublishFeedStory(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+ return $this->shouldPublishRepositoryActivity($object, $xactions);
+ }
+
}
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -186,6 +186,10 @@
return $this->unmentionablePHIDMap;
}
+ protected function shouldEnableMentions() {
+ return true;
+ }
+
public function setApplicationEmail(
PhabricatorMetaMTAApplicationEmail $email) {
$this->applicationEmail = $email;
@@ -1052,10 +1056,14 @@
return null;
}
- $texts = array_mergev($blocks);
- $phids = PhabricatorMarkupEngine::extractPHIDsFromMentions(
- $this->getActor(),
- $texts);
+ if ($this->shouldEnableMentions($object, $xactions)) {
+ $texts = array_mergev($blocks);
+ $phids = PhabricatorMarkupEngine::extractPHIDsFromMentions(
+ $this->getActor(),
+ $texts);
+ } else {
+ $phids = array();
+ }
$this->mentionedPHIDs = $phids;
@@ -1229,12 +1237,14 @@
$engine);
$mentioned_phids = array();
- foreach ($blocks as $key => $xaction_blocks) {
- foreach ($xaction_blocks as $block) {
- $engine->markupText($block);
- $mentioned_phids += $engine->getTextMetadata(
- PhabricatorObjectRemarkupRule::KEY_MENTIONED_OBJECTS,
- array());
+ if ($this->shouldEnableMentions($object, $xactions)) {
+ foreach ($blocks as $key => $xaction_blocks) {
+ foreach ($xaction_blocks as $block) {
+ $engine->markupText($block);
+ $mentioned_phids += $engine->getTextMetadata(
+ PhabricatorObjectRemarkupRule::KEY_MENTIONED_OBJECTS,
+ array());
+ }
}
}
@@ -1248,19 +1258,22 @@
->execute();
$mentionable_phids = array();
- foreach ($mentioned_objects as $mentioned_object) {
- if ($mentioned_object instanceof PhabricatorMentionableInterface) {
- $mentioned_phid = $mentioned_object->getPHID();
- if (idx($this->getUnmentionablePHIDMap(), $mentioned_phid)) {
- continue;
- }
- // don't let objects mention themselves
- if ($object->getPHID() && $mentioned_phid == $object->getPHID()) {
- continue;
+ if ($this->shouldEnableMentions($object, $xactions)) {
+ foreach ($mentioned_objects as $mentioned_object) {
+ if ($mentioned_object instanceof PhabricatorMentionableInterface) {
+ $mentioned_phid = $mentioned_object->getPHID();
+ if (idx($this->getUnmentionablePHIDMap(), $mentioned_phid)) {
+ continue;
+ }
+ // don't let objects mention themselves
+ if ($object->getPHID() && $mentioned_phid == $object->getPHID()) {
+ continue;
+ }
+ $mentionable_phids[$mentioned_phid] = $mentioned_phid;
}
- $mentionable_phids[$mentioned_phid] = $mentioned_phid;
}
}
+
if ($mentionable_phids) {
$edge_type = PhabricatorObjectMentionsObjectEdgeType::EDGECONST;
$block_xactions[] = newv(get_class(head($xactions)), array())

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 9:17 AM (8 h, 4 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6720549
Default Alt Text
D11966.id.diff (5 KB)

Event Timeline