Page MenuHomePhabricator

D8849.id21001.diff
No OneTemporary

D8849.id21001.diff

diff --git a/src/applications/audit/editor/PhabricatorAuditCommentEditor.php b/src/applications/audit/editor/PhabricatorAuditCommentEditor.php
--- a/src/applications/audit/editor/PhabricatorAuditCommentEditor.php
+++ b/src/applications/audit/editor/PhabricatorAuditCommentEditor.php
@@ -76,6 +76,7 @@
// Find any "@mentions" in the content blocks.
$mention_ccs = PhabricatorMarkupEngine::extractPHIDsFromMentions(
+ $this->getActor(),
$content_blocks);
if ($mention_ccs) {
$metacc = idx(
diff --git a/src/applications/conpherence/conduit/ConduitAPI_conpherence_updatethread_Method.php b/src/applications/conpherence/conduit/ConduitAPI_conpherence_updatethread_Method.php
--- a/src/applications/conpherence/conduit/ConduitAPI_conpherence_updatethread_Method.php
+++ b/src/applications/conpherence/conduit/ConduitAPI_conpherence_updatethread_Method.php
@@ -90,7 +90,10 @@
if ($message) {
$xactions = array_merge(
$xactions,
- $editor->generateTransactionsFromText($conpherence, $message));
+ $editor->generateTransactionsFromText(
+ $user,
+ $conpherence,
+ $message));
}
try {
diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php
--- a/src/applications/conpherence/controller/ConpherenceUpdateController.php
+++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php
@@ -55,6 +55,7 @@
case ConpherenceUpdateActions::MESSAGE:
$message = $request->getStr('text');
$xactions = $editor->generateTransactionsFromText(
+ $user,
$conpherence,
$message);
$delete_draft = true;
diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php
--- a/src/applications/conpherence/editor/ConpherenceEditor.php
+++ b/src/applications/conpherence/editor/ConpherenceEditor.php
@@ -34,9 +34,9 @@
$errors[] = self::ERROR_EMPTY_MESSAGE;
}
- $file_phids =
- PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
- array($message));
+ $file_phids = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
+ $creator,
+ array($message));
if ($file_phids) {
$files = id(new PhabricatorFileQuery())
->setViewer($creator)
@@ -78,13 +78,14 @@
}
public function generateTransactionsFromText(
+ PhabricatorUser $viewer,
ConpherenceThread $conpherence,
$text) {
$files = array();
- $file_phids =
- PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
- array($text));
+ $file_phids = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
+ $viewer,
+ array($text));
// Since these are extracted from text, we might be re-including the
// same file -- e.g. a mock under discussion. Filter files we
// already have.
diff --git a/src/applications/conpherence/mail/ConpherenceReplyHandler.php b/src/applications/conpherence/mail/ConpherenceReplyHandler.php
--- a/src/applications/conpherence/mail/ConpherenceReplyHandler.php
+++ b/src/applications/conpherence/mail/ConpherenceReplyHandler.php
@@ -82,6 +82,7 @@
$xactions = array_merge(
$xactions,
$editor->generateTransactionsFromText(
+ $user,
$conpherence,
$body));
diff --git a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php
--- a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php
+++ b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php
@@ -26,6 +26,7 @@
// list of all the CCs and then construct a transaction for them at the
// end if necessary.
$added_ccs = PhabricatorMarkupEngine::extractPHIDsFromMentions(
+ $user,
array(
$request->getStr('comments'),
));
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
@@ -973,7 +973,9 @@
}
$texts = array_mergev($blocks);
- $phids = PhabricatorMarkupEngine::extractPHIDsFromMentions($texts);
+ $phids = PhabricatorMarkupEngine::extractPHIDsFromMentions(
+ $this->getActor(),
+ $texts);
$this->mentionedPHIDs = $phids;
@@ -2173,6 +2175,7 @@
$phids = array();
if ($blocks) {
$phids[] = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
+ $this->getActor(),
$blocks);
}
diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php
--- a/src/infrastructure/markup/PhabricatorMarkupEngine.php
+++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php
@@ -494,11 +494,14 @@
return $engine;
}
- public static function extractPHIDsFromMentions(array $content_blocks) {
+ public static function extractPHIDsFromMentions(
+ PhabricatorUser $viewer,
+ array $content_blocks) {
+
$mentions = array();
$engine = self::newDifferentialMarkupEngine();
- $engine->setConfig('viewer', PhabricatorUser::getOmnipotentUser());
+ $engine->setConfig('viewer', $viewer);
foreach ($content_blocks as $content_block) {
$engine->markupText($content_block);
@@ -512,11 +515,12 @@
}
public static function extractFilePHIDsFromEmbeddedFiles(
+ PhabricatorUser $viewer,
array $content_blocks) {
$files = array();
$engine = self::newDifferentialMarkupEngine();
- $engine->setConfig('viewer', PhabricatorUser::getOmnipotentUser());
+ $engine->setConfig('viewer', $viewer);
foreach ($content_blocks as $content_block) {
$engine->markupText($content_block);

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 22, 8:29 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7384777
Default Alt Text
D8849.id21001.diff (5 KB)

Event Timeline