1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12: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:
Alan Huang 2012-08-01 14:33:30 -07:00
parent b9aff187d9
commit ca91a022fe

View file

@ -67,6 +67,11 @@ final class DifferentialRevisionListView extends AphrontView {
throw new Exception("Call setUser() before render()!"); 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) { foreach ($this->fields as $field) {
$field->setUser($this->user); $field->setUser($this->user);
$field->setHandles($this->handles); $field->setHandles($this->handles);
@ -74,15 +79,28 @@ final class DifferentialRevisionListView extends AphrontView {
$rows = array(); $rows = array();
foreach ($this->revisions as $revision) { 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) { foreach ($this->fields as $field) {
$row[] = $field->renderValueForRevisionList($revision); $row[] = $field->renderValueForRevisionList($revision);
} }
$rows[] = $row; $rows[] = $row;
} }
$headers = array(); $headers = array('');
$classes = array(); $classes = array('');
foreach ($this->fields as $field) { foreach ($this->fields as $field) {
$headers[] = $field->renderHeaderForRevisionList(); $headers[] = $field->renderHeaderForRevisionList();
$classes[] = $field->getColumnClassForRevisionList(); $classes[] = $field->getColumnClassForRevisionList();