mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 21:40:55 +01:00
Fix ApplicationTransaction "no effect" error for mentions of already-mentioned users
Summary: Fixes T3139. See that task for discussion. If all mentions are removed because they're already subscribed, we currently generate an empty transaction, which later gets picked up as having no effect and the user gets yelled at. Instead, don't generate a transaction if no PHIDs remain after filtering already-subscribed PHIDs. Test Plan: Followed plan in T3139. Reviewers: garoevans, btrahan Reviewed By: garoevans CC: aran Maniphest Tasks: T3139 Differential Revision: https://secure.phabricator.com/D6048
This commit is contained in:
parent
59bb8ca9dd
commit
da60c71fb8
1 changed files with 5 additions and 9 deletions
|
@ -269,11 +269,7 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
|
||||
public function setContentSourceFromRequest(AphrontRequest $request) {
|
||||
return $this->setContentSource(
|
||||
PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_WEB,
|
||||
array(
|
||||
'ip' => $request->getRemoteAddr(),
|
||||
)));
|
||||
PhabricatorContentSource::newFromRequest($request));
|
||||
}
|
||||
|
||||
public function getContentSource() {
|
||||
|
@ -571,10 +567,6 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
|
||||
$this->mentionedPHIDs = $phids;
|
||||
|
||||
if (!$phids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($object->getPHID()) {
|
||||
// Don't try to subscribe already-subscribed mentions: we want to generate
|
||||
// a dialog about an action having no effect if the user explicitly adds
|
||||
|
@ -589,6 +581,10 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
}
|
||||
$phids = array_values($phids);
|
||||
|
||||
if (!$phids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$xaction = newv(get_class(head($xactions)), array());
|
||||
$xaction->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS);
|
||||
$xaction->setNewValue(array('+' => $phids));
|
||||
|
|
Loading…
Reference in a new issue