@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

When users mark their own inline comments as "Done", suppress the timeline/mail stories

Summary:
Depends on D19858. Ref T13222. See PHI995. In D19635 and related revisions, inline behavior changed to allow you to pre-mark your own inlines as done (as a reviewer) and to pre-mark your inlines for you (as an author).

These actions generate low-value stories in the timeline, like "alice marked 3 comments done." when an author adds some notes to their own revision. These aren't helpful and can be a little misleading.

Instead, just don't count it when someone marks their own inlines as "done". If we throw away all the marks after throwing away the self-marks, hide the whole story.

This happens in three cases:

# You comment on your own revision, and don't uncheck the "Done" checkbox.
# You comment on someone else's revision, and check the "Done" checkbox before submitting.
# You leave a not-"Done" inline on your own revision, then "Done" it later.

Cases (1) and (2) seem unambiguously good/clear. Case (3) is a little more questionable, but I think this still isn't very useful for reviewers.

If there's still a clarity issue around case (3), we could change the story text to "alice marked 3 inline comments by other users as done.", but I think this is probably needlessly verbose and that no one will be confused by the behavior as written here.

(Also note that this story is never shown in feed.)

Test Plan: Created and marked a bunch of inlines as "Done" in Differential and Diffusion, as the author and reviewer/auditor. My own marks didn't generate timeline stories; marking others' comments still does.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13222

Differential Revision: https://secure.phabricator.com/D19859

+66 -9
+12
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 4658 4658 $new_value[$key] = $state_map[$state]; 4659 4659 } 4660 4660 4661 + // See PHI995. Copy some information about the inlines into the transaction 4662 + // so we can tailor rendering behavior. In particular, we don't want to 4663 + // render transactions about users marking their own inlines as "Done". 4664 + 4665 + $inline_details = array(); 4666 + foreach ($inlines as $inline) { 4667 + $inline_details[$inline->getPHID()] = array( 4668 + 'authorPHID' => $inline->getAuthorPHID(), 4669 + ); 4670 + } 4671 + 4661 4672 return $object->getApplicationTransactionTemplate() 4662 4673 ->setTransactionType(PhabricatorTransactions::TYPE_INLINESTATE) 4663 4674 ->setIgnoreOnNoEffect(true) 4675 + ->setMetadataValue('inline.details', $inline_details) 4664 4676 ->setOldValue($old_value) 4665 4677 ->setNewValue($new_value); 4666 4678 }
+54 -9
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 664 664 break; 665 665 } 666 666 break; 667 + 668 + case PhabricatorTransactions::TYPE_INLINESTATE: 669 + list($done, $undone) = $this->getInterestingInlineStateChangeCounts(); 670 + 671 + if (!$done && !$undone) { 672 + return true; 673 + } 674 + 675 + break; 676 + 667 677 } 668 678 669 679 return false; ··· 1007 1017 } 1008 1018 1009 1019 case PhabricatorTransactions::TYPE_INLINESTATE: 1010 - $done = 0; 1011 - $undone = 0; 1012 - foreach ($new as $phid => $state) { 1013 - if ($state == PhabricatorInlineCommentInterface::STATE_DONE) { 1014 - $done++; 1015 - } else { 1016 - $undone++; 1017 - } 1018 - } 1020 + list($done, $undone) = $this->getInterestingInlineStateChangeCounts(); 1019 1021 if ($done && $undone) { 1020 1022 return pht( 1021 1023 '%s marked %s inline comment(s) as done and %s inline comment(s) '. ··· 1580 1582 } 1581 1583 1582 1584 return $moves; 1585 + } 1586 + 1587 + private function getInterestingInlineStateChangeCounts() { 1588 + // See PHI995. Newer inline state transactions have additional details 1589 + // which we use to tailor the rendering behavior. These details are not 1590 + // present on older transactions. 1591 + $details = $this->getMetadataValue('inline.details', array()); 1592 + 1593 + $new = $this->getNewValue(); 1594 + 1595 + $done = 0; 1596 + $undone = 0; 1597 + foreach ($new as $phid => $state) { 1598 + $is_done = ($state == PhabricatorInlineCommentInterface::STATE_DONE); 1599 + 1600 + // See PHI995. If you're marking your own inline comments as "Done", 1601 + // don't count them when rendering a timeline story. In the case where 1602 + // you're only affecting your own comments, this will hide the 1603 + // "alice marked X comments as done" story entirely. 1604 + 1605 + // Usually, this happens when you pre-mark inlines as "done" and submit 1606 + // them yourself. We'll still generate an "alice added inline comments" 1607 + // story (in most cases/contexts), but the state change story is largely 1608 + // just clutter and slightly confusing/misleading. 1609 + 1610 + $inline_details = idx($details, $phid, array()); 1611 + $inline_author_phid = idx($inline_details, 'authorPHID'); 1612 + if ($inline_author_phid) { 1613 + if ($inline_author_phid == $this->getAuthorPHID()) { 1614 + if ($is_done) { 1615 + continue; 1616 + } 1617 + } 1618 + } 1619 + 1620 + if ($is_done) { 1621 + $done++; 1622 + } else { 1623 + $undone++; 1624 + } 1625 + } 1626 + 1627 + return array($done, $undone); 1583 1628 } 1584 1629 1585 1630