Differential D19859 Diff 47438 src/applications/transactions/storage/PhabricatorApplicationTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
Show First 20 Lines • Show All 658 Lines • ▼ Show 20 Lines | switch ($this->getTransactionType()) { | ||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
} | } | ||||
break; | break; | ||||
case PhabricatorTransactions::TYPE_INLINESTATE: | |||||
list($done, $undone) = $this->getInterestingInlineStateChangeCounts(); | |||||
if (!$done && !$undone) { | |||||
return true; | |||||
} | |||||
break; | |||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
public function shouldHideForMail(array $xactions) { | public function shouldHideForMail(array $xactions) { | ||||
if ($this->isSelfSubscription()) { | if ($this->isSelfSubscription()) { | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | switch ($this->getTransactionType()) { | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
} else { | } else { | ||||
return pht( | return pht( | ||||
'%s awarded a token.', | '%s awarded a token.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
} | } | ||||
case PhabricatorTransactions::TYPE_INLINESTATE: | case PhabricatorTransactions::TYPE_INLINESTATE: | ||||
$done = 0; | list($done, $undone) = $this->getInterestingInlineStateChangeCounts(); | ||||
$undone = 0; | |||||
foreach ($new as $phid => $state) { | |||||
if ($state == PhabricatorInlineCommentInterface::STATE_DONE) { | |||||
$done++; | |||||
} else { | |||||
$undone++; | |||||
} | |||||
} | |||||
if ($done && $undone) { | if ($done && $undone) { | ||||
return pht( | return pht( | ||||
'%s marked %s inline comment(s) as done and %s inline comment(s) '. | '%s marked %s inline comment(s) as done and %s inline comment(s) '. | ||||
'as not done.', | 'as not done.', | ||||
$this->renderHandleLink($author_phid), | $this->renderHandleLink($author_phid), | ||||
new PhutilNumber($done), | new PhutilNumber($done), | ||||
new PhutilNumber($undone)); | new PhutilNumber($undone)); | ||||
} else if ($done) { | } else if ($done) { | ||||
▲ Show 20 Lines • Show All 550 Lines • ▼ Show 20 Lines | foreach ($moves as $key => $move) { | ||||
if (isset($from_phids[$move['columnPHID']])) { | if (isset($from_phids[$move['columnPHID']])) { | ||||
unset($moves[$key]); | unset($moves[$key]); | ||||
} | } | ||||
} | } | ||||
return $moves; | return $moves; | ||||
} | } | ||||
private function getInterestingInlineStateChangeCounts() { | |||||
// See PHI995. Newer inline state transactions have additional details | |||||
// which we use to tailor the rendering behavior. These details are not | |||||
// present on older transactions. | |||||
$details = $this->getMetadataValue('inline.details', array()); | |||||
$new = $this->getNewValue(); | |||||
$done = 0; | |||||
$undone = 0; | |||||
foreach ($new as $phid => $state) { | |||||
$is_done = ($state == PhabricatorInlineCommentInterface::STATE_DONE); | |||||
// See PHI995. If you're marking your own inline comments as "Done", | |||||
// don't count them when rendering a timeline story. In the case where | |||||
// you're only affecting your own comments, this will hide the | |||||
// "alice marked X comments as done" story entirely. | |||||
// Usually, this happens when you pre-mark inlines as "done" and submit | |||||
// them yourself. We'll still generate an "alice added inline comments" | |||||
// story (in most cases/contexts), but the state change story is largely | |||||
// just clutter and slightly confusing/misleading. | |||||
$inline_details = idx($details, $phid, array()); | |||||
$inline_author_phid = idx($inline_details, 'authorPHID'); | |||||
if ($inline_author_phid) { | |||||
if ($inline_author_phid == $this->getAuthorPHID()) { | |||||
if ($is_done) { | |||||
continue; | |||||
} | |||||
} | |||||
} | |||||
if ($is_done) { | |||||
$done++; | |||||
} else { | |||||
$undone++; | |||||
} | |||||
} | |||||
return array($done, $undone); | |||||
} | |||||
/* -( PhabricatorPolicyInterface Implementation )-------------------------- */ | /* -( PhabricatorPolicyInterface Implementation )-------------------------- */ | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |