mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Add a flag column to Differential revision lists
Summary: Put a flag icon to the left of each flagged revision in the Differential summary tables. Flag is colored correctly and when hovered reveals the note in a tooltip. As epriestley specifically notes that the Flagged Revisions table should only be shown when a user is looking at their own revisions, maybe this ought to be limited by what controller is using this view, or something. Test Plan: View Differential main page. Check that flags appear correctly if some revisions are flagged. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin, avivey Maniphest Tasks: T1557 Differential Revision: https://secure.phabricator.com/D3125
This commit is contained in:
parent
b9aff187d9
commit
ca91a022fe
1 changed files with 21 additions and 3 deletions
|
@ -67,6 +67,11 @@ final class DifferentialRevisionListView extends AphrontView {
|
|||
throw new Exception("Call setUser() before render()!");
|
||||
}
|
||||
|
||||
$flags = id(new PhabricatorFlagQuery())
|
||||
->withObjectPHIDs(mpull($this->revisions, 'getPHID'))
|
||||
->execute();
|
||||
$flagged = mpull($flags, null, 'getObjectPHID');
|
||||
|
||||
foreach ($this->fields as $field) {
|
||||
$field->setUser($this->user);
|
||||
$field->setHandles($this->handles);
|
||||
|
@ -74,15 +79,28 @@ final class DifferentialRevisionListView extends AphrontView {
|
|||
|
||||
$rows = array();
|
||||
foreach ($this->revisions as $revision) {
|
||||
$row = array();
|
||||
$phid = $revision->getPHID();
|
||||
$flag = '';
|
||||
if (isset($flagged[$phid])) {
|
||||
$class = PhabricatorFlagColor::getCSSClass($flagged[$phid]->getColor());
|
||||
$note = $flagged[$phid]->getNote();
|
||||
$flag = phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'phabricator-flag-icon '.$class,
|
||||
'title' => $note,
|
||||
),
|
||||
'');
|
||||
}
|
||||
$row = array($flag);
|
||||
foreach ($this->fields as $field) {
|
||||
$row[] = $field->renderValueForRevisionList($revision);
|
||||
}
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
$headers = array();
|
||||
$classes = array();
|
||||
$headers = array('');
|
||||
$classes = array('');
|
||||
foreach ($this->fields as $field) {
|
||||
$headers[] = $field->renderHeaderForRevisionList();
|
||||
$classes[] = $field->getColumnClassForRevisionList();
|
||||
|
|
Loading…
Reference in a new issue