mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Add more transation data to panel tab changes
Summary: Fixes T10473. Clever, didn't know we could do this, but works well. Renders out the tab names by ', '. Test Plan: Add a tab panel, change some names, review transactions. {F2929594} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T10473 Differential Revision: https://secure.phabricator.com/D17359
This commit is contained in:
parent
37ac0ada17
commit
2f69cb5fe7
1 changed files with 43 additions and 0 deletions
|
@ -33,6 +33,49 @@ final class PhabricatorDashboardPanelTabsCustomField
|
|||
$this->setFieldValue($value);
|
||||
}
|
||||
|
||||
public function getApplicationTransactionTitle(
|
||||
PhabricatorApplicationTransaction $xaction) {
|
||||
$author_phid = $xaction->getAuthorPHID();
|
||||
$old = $xaction->getOldValue();
|
||||
$new = $xaction->getNewValue();
|
||||
|
||||
$new_tabs = array();
|
||||
if ($new) {
|
||||
foreach ($new as $new_tab) {
|
||||
$new_tabs[] = $new_tab['name'];
|
||||
}
|
||||
$new_tabs = implode(' | ', $new_tabs);
|
||||
}
|
||||
|
||||
$old_tabs = array();
|
||||
if ($old) {
|
||||
foreach ($old as $old_tab) {
|
||||
$old_tabs[] = $old_tab['name'];
|
||||
}
|
||||
$old_tabs = implode(' | ', $old_tabs);
|
||||
}
|
||||
|
||||
if (!$old) {
|
||||
// In case someone makes a tab panel with no tabs.
|
||||
if ($new) {
|
||||
return pht(
|
||||
'%s set the tabs to "%s".',
|
||||
$xaction->renderHandleLink($author_phid),
|
||||
$new_tabs);
|
||||
}
|
||||
} else if (!$new) {
|
||||
return pht(
|
||||
'%s removed tabs.',
|
||||
$xaction->renderHandleLink($author_phid));
|
||||
} else {
|
||||
return pht(
|
||||
'%s changed the tabs from "%s" to "%s".',
|
||||
$xaction->renderHandleLink($author_phid),
|
||||
$old_tabs,
|
||||
$new_tabs);
|
||||
}
|
||||
}
|
||||
|
||||
public function renderEditControl(array $handles) {
|
||||
// NOTE: This includes archived panels so we don't mutate the tabs
|
||||
// when saving a tab panel that includes archied panels. This whole UI is
|
||||
|
|
Loading…
Reference in a new issue