1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Adding basic transaction titles to awarding/revoking badges

Summary: Ref T10677, awarding/revoking a badge should create timeline entries with titles that are more clear (excludes homepage feed stories)

Test Plan: Award/revoke a badge to single or multiple users. See timeline entries that reflect those actions.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T10677

Differential Revision: https://secure.phabricator.com/D15533
This commit is contained in:
lkassianik 2016-03-26 19:36:13 -07:00
parent a939bbc4fa
commit e6d2e66ea2
2 changed files with 54 additions and 0 deletions

View file

@ -109,6 +109,26 @@ final class PhabricatorBadgesTransaction
$qual_new);
}
break;
case self::TYPE_AWARD:
if (!is_array($new)) {
$new = array();
}
$handles = $this->renderHandleList($new);
return pht(
'%s awarded this badge to %s recipient(s): %s.',
$this->renderHandleLink($author_phid),
new PhutilNumber(count($new)),
$handles);
case self::TYPE_REVOKE:
if (!is_array($new)) {
$new = array();
}
$handles = $this->renderHandleList($new);
return pht(
'%s revoked this badge from %s recipient(s): %s.',
$this->renderHandleLink($author_phid),
new PhutilNumber(count($new)),
$handles);
}
return parent::getTitle();
@ -223,4 +243,24 @@ final class PhabricatorBadgesTransaction
$this->getOldValue(),
$this->getNewValue());
}
public function getRequiredHandlePHIDs() {
$phids = parent::getRequiredHandlePHIDs();
$type = $this->getTransactionType();
switch ($type) {
case self::TYPE_AWARD:
case self::TYPE_REVOKE:
$new = $this->getNewValue();
if (!is_array($new)) {
$new = array();
}
foreach ($new as $phid) {
$phids[] = $phid;
}
break;
}
return $phids;
}
}

View file

@ -1528,6 +1528,20 @@ final class PhabricatorUSEnglishTranslation
'%s removed watchers for %3$s: %4$s.',
),
),
'%s awarded this badge to %s recipient(s): %s.' => array(
array(
'%s awarded this badge to recipient: %3$s.',
'%s awarded this badge to recipients: %3$s.',
),
),
'%s revoked this badge from %s recipient(s): %s.' => array(
array(
'%s revoked this badge from recipient: %3$s.',
'%s revoked this badge from recipients: %3$s.',
),
),
);
}