mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Fix an issue with mentions in transactions
Ref T6367. Fixes T8415. Maniphest filters transactions too early. This happens automatically later. Remove the code. Transactions should be filtered per-user. If a transaction is hidden for some users, we shouldn't mail them. Move the filtering logic to be per-user. Stack: ``` [Thu Jun 04 05:51:05.371061 2015] [:error] [pid 25111] [client 127.0.0.1:56497] [2015-06-04 05:51:05] EXCEPTION: (Exception) Transaction ("PHID-XACT-TASK-x4jlylat47s6ttr", of type "core:edge") requires a handle ("PHID-DREV-rs7jaoxbcb3av6biq4b5") that it did not load. at [<phabricator>/src/applications/transactions/storage/PhabricatorApplicationTransaction.php:277] [Thu Jun 04 05:51:05.372546 2015] [:error] [pid 25111] [client 127.0.0.1:56497] arcanist(head=master, ref.master=4e83efb31d3e), instances(head=master, ref.master=db56d5d6ad91), ledger(head=master, ref.master=5694485699a4), libcore(), phabricator(head=xaction1, ref.master=04a22a8fa443, ref.xaction1=04a22a8fa443, custom=17), phutil(head=master, ref.master=c2cd90ee7aec), services(head=master, ref.master=2d76591c4f87) [Thu Jun 04 05:51:05.372559 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #0 <#2> PhabricatorApplicationTransaction::getHandle(string) called at [<phabricator>/src/applications/transactions/storage/PhabricatorApplicationTransaction.php:463] [Thu Jun 04 05:51:05.372564 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #1 <#2> PhabricatorApplicationTransaction::shouldHide() called at [<phabricator>/src/applications/maniphest/storage/ManiphestTransaction.php:163] [Thu Jun 04 05:51:05.372568 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #2 <#2> ManiphestTransaction::shouldHide() called at [<phutil>/src/utils/utils.php:428] [Thu Jun 04 05:51:05.372572 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #3 <#2> mfilter(array, string, boolean) called at [<phabricator>/src/applications/maniphest/editor/ManiphestTransactionEditor.php:380] [Thu Jun 04 05:51:05.372576 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #4 <#2> ManiphestTransactionEditor::shouldSendMail(ManiphestTask, array) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:957] [Thu Jun 04 05:51:05.372580 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #5 <#2> PhabricatorApplicationTransactionEditor::applyTransactions(ManiphestTask, array) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2858] [Thu Jun 04 05:51:05.372585 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #6 <#2> PhabricatorApplicationTransactionEditor::applyInverseEdgeTransactions(DifferentialRevision, DifferentialTransaction, integer) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:569] [Thu Jun 04 05:51:05.372589 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #7 <#2> PhabricatorApplicationTransactionEditor::applyBuiltinExternalTransaction(DifferentialRevision, DifferentialTransaction) called at [<phabricator>/src/applications/differential/editor/DifferentialTransactionEditor.php:615] [Thu Jun 04 05:51:05.372594 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #8 <#2> DifferentialTransactionEditor::applyBuiltinExternalTransaction(DifferentialRevision, DifferentialTransaction) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:489] [Thu Jun 04 05:51:05.372611 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #9 <#2> PhabricatorApplicationTransactionEditor::applyExternalEffects(DifferentialRevision, DifferentialTransaction) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:827] [Thu Jun 04 05:51:05.372616 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #10 <#2> PhabricatorApplicationTransactionEditor::applyTransactions(DifferentialRevision, array) called at [<phabricator>/src/applications/differential/controller/DifferentialCommentSaveController.php:124] [Thu Jun 04 05:51:05.372621 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #11 <#2> DifferentialCommentSaveController::processRequest() called at [<phabricator>/src/aphront/AphrontController.php:33] [Thu Jun 04 05:51:05.372625 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #12 <#2> AphrontController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:226] [Thu Jun 04 05:51:05.372629 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #13 phlog(Exception) called at [<phabricator>/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php:226] [Thu Jun 04 05:51:05.372633 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #14 AphrontDefaultApplicationConfiguration::handleException(Exception) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:230] [Thu Jun 04 05:51:05.372637 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #15 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:140] [Thu Jun 04 05:51:05.372641 2015] [:error] [pid 25111] [client 127.0.0.1:56497] #16 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:19] ``` Auditors: btrahan
This commit is contained in:
parent
04a22a8fa4
commit
98aae51c3d
2 changed files with 20 additions and 25 deletions
|
@ -373,14 +373,6 @@ final class ManiphestTransactionEditor
|
|||
return $xactions;
|
||||
}
|
||||
|
||||
protected function shouldSendMail(
|
||||
PhabricatorLiskDAO $object,
|
||||
array $xactions) {
|
||||
|
||||
$xactions = mfilter($xactions, 'shouldHide', true);
|
||||
return $xactions;
|
||||
}
|
||||
|
||||
protected function getMailSubjectPrefix() {
|
||||
return PhabricatorEnv::getEnvConfig('metamta.maniphest.subject-prefix');
|
||||
}
|
||||
|
|
|
@ -2110,21 +2110,6 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
PhabricatorLiskDAO $object,
|
||||
array $xactions) {
|
||||
|
||||
// Check if any of the transactions are visible. If we don't have any
|
||||
// visible transactions, don't send the mail.
|
||||
|
||||
$any_visible = false;
|
||||
foreach ($xactions as $xaction) {
|
||||
if (!$xaction->shouldHideForMail($xactions)) {
|
||||
$any_visible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$any_visible) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$email_to = $this->mailToPHIDs;
|
||||
$email_cc = $this->mailCCPHIDs;
|
||||
$email_cc = array_merge($email_cc, $this->heraldEmailPHIDs);
|
||||
|
@ -2145,6 +2130,7 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
$locale = PhabricatorEnv::beginScopedLocale($viewer->getTranslation());
|
||||
|
||||
$caught = null;
|
||||
$mail = null;
|
||||
try {
|
||||
// Reload handles for the new viewer.
|
||||
$this->loadHandles($xactions);
|
||||
|
@ -2161,8 +2147,10 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
throw $ex;
|
||||
}
|
||||
|
||||
foreach ($mail->buildRecipientList() as $phid) {
|
||||
$mailed[$phid] = true;
|
||||
if ($mail) {
|
||||
foreach ($mail->buildRecipientList() as $phid) {
|
||||
$mailed[$phid] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2174,6 +2162,21 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
array $xactions,
|
||||
PhabricatorMailTarget $target) {
|
||||
|
||||
// Check if any of the transactions are visible for this viewer. If we
|
||||
// don't have any visible transactions, don't send the mail.
|
||||
|
||||
$any_visible = false;
|
||||
foreach ($xactions as $xaction) {
|
||||
if (!$xaction->shouldHideForMail($xactions)) {
|
||||
$any_visible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$any_visible) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$mail = $this->buildMailTemplate($object);
|
||||
$body = $this->buildMailBody($object, $xactions);
|
||||
|
||||
|
|
Loading…
Reference in a new issue