mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 20:40:56 +01:00
Probably fix excessive "(authored by X)" attributions
Summary: This is a pain to test, but we do a lot of needless "X committed thing (authored by X)" right now. I think that's because we compare two handle links here, and they're never the same, even if they're both links to the same object. Instead, compare the author and committer more carefully. Test Plan: Will do it live. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D11635
This commit is contained in:
parent
4af1fd2a79
commit
f1b238cb42
1 changed files with 14 additions and 1 deletions
|
@ -380,18 +380,31 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
|
||||||
$this->getMetadataValue('commitPHID'));
|
$this->getMetadataValue('commitPHID'));
|
||||||
$committer_phid = $this->getMetadataValue('committerPHID');
|
$committer_phid = $this->getMetadataValue('committerPHID');
|
||||||
$author_phid = $this->getMetadataValue('authorPHID');
|
$author_phid = $this->getMetadataValue('authorPHID');
|
||||||
|
|
||||||
if ($this->getHandleIfExists($committer_phid)) {
|
if ($this->getHandleIfExists($committer_phid)) {
|
||||||
$committer_name = $this->renderHandleLink($committer_phid);
|
$committer_name = $this->renderHandleLink($committer_phid);
|
||||||
} else {
|
} else {
|
||||||
$committer_name = $this->getMetadataValue('committerName');
|
$committer_name = $this->getMetadataValue('committerName');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getHandleIfExists($author_phid)) {
|
if ($this->getHandleIfExists($author_phid)) {
|
||||||
$author_name = $this->renderHandleLink($author_phid);
|
$author_name = $this->renderHandleLink($author_phid);
|
||||||
} else {
|
} else {
|
||||||
$author_name = $this->getMetadataValue('authorName');
|
$author_name = $this->getMetadataValue('authorName');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($committer_name && ($committer_name != $author_name)) {
|
// Check if the committer and author are the same. They're the
|
||||||
|
// same if both resolved and are the same user, or if neither
|
||||||
|
// resolved and the text is identical.
|
||||||
|
if ($committer_phid && $author_phid) {
|
||||||
|
$same_author = ($committer_phid == $author_phid);
|
||||||
|
} else if (!$committer_phid && !$author_phid) {
|
||||||
|
$same_author = ($committer_name == $author_name);
|
||||||
|
} else {
|
||||||
|
$same_author = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($committer_name && !$same_author) {
|
||||||
return pht(
|
return pht(
|
||||||
'%s closed %s by committing %s (authored by %s).',
|
'%s closed %s by committing %s (authored by %s).',
|
||||||
$author_link,
|
$author_link,
|
||||||
|
|
Loading…
Reference in a new issue