1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

Mark "low importance" and "owned" changes in the filetree

Summary: Ref T13516. Mark low-importance changes (generated code, deleted files) and owned-with-authority changes in the filetree.

Test Plan: {F7375327}

Maniphest Tasks: T13516

Differential Revision: https://secure.phabricator.com/D21157
This commit is contained in:
epriestley 2020-04-22 10:56:09 -07:00
parent ff88eb588e
commit a72a66caa8
10 changed files with 138 additions and 32 deletions

View file

@ -12,7 +12,7 @@ return array(
'core.pkg.css' => 'dd5f04a3',
'core.pkg.js' => '544bc792',
'differential.pkg.css' => 'cb99cd21',
'differential.pkg.js' => 'b1ef535d',
'differential.pkg.js' => '6c315e3f',
'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => 'a98c0bf7',
'maniphest.pkg.css' => '35995d6d',
@ -59,7 +59,7 @@ return array(
'rsrc/css/application/countdown/timer.css' => 'bff8012f',
'rsrc/css/application/daemon/bulk-job.css' => '73af99f5',
'rsrc/css/application/dashboard/dashboard.css' => '5a205b9d',
'rsrc/css/application/diff/diff-tree-view.css' => 'bd83417c',
'rsrc/css/application/diff/diff-tree-view.css' => '26fb4a0d',
'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d',
'rsrc/css/application/differential/add-comment.css' => '7e5900d9',
'rsrc/css/application/differential/changeset-view.css' => '489b6995',
@ -378,11 +378,11 @@ return array(
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => 'a2ab19be',
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9',
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
'rsrc/js/application/diff/DiffChangeset.js' => 'd089ffb1',
'rsrc/js/application/diff/DiffChangeset.js' => 'a1a5dc46',
'rsrc/js/application/diff/DiffChangesetList.js' => '57035863',
'rsrc/js/application/diff/DiffInline.js' => '16e97ebc',
'rsrc/js/application/diff/DiffPathView.js' => '5f70ad12',
'rsrc/js/application/diff/DiffTreeView.js' => 'ccf691f3',
'rsrc/js/application/diff/DiffPathView.js' => 'ceb66010',
'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b',
'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17',
'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd',
'rsrc/js/application/differential/behavior-populate.js' => 'b86ef6c2',
@ -558,7 +558,7 @@ return array(
'conpherence-thread-manager' => 'aec8e38c',
'conpherence-transaction-css' => '3a3f5e7e',
'd3' => '9d068042',
'diff-tree-view-css' => 'bd83417c',
'diff-tree-view-css' => '26fb4a0d',
'differential-changeset-view-css' => '489b6995',
'differential-core-view-css' => '7300a73e',
'differential-revision-add-comment-css' => '7e5900d9',
@ -775,11 +775,11 @@ return array(
'phabricator-darklog' => '3b869402',
'phabricator-darkmessage' => '26cd4b73',
'phabricator-dashboard-css' => '5a205b9d',
'phabricator-diff-changeset' => 'd089ffb1',
'phabricator-diff-changeset' => 'a1a5dc46',
'phabricator-diff-changeset-list' => '57035863',
'phabricator-diff-inline' => '16e97ebc',
'phabricator-diff-path-view' => '5f70ad12',
'phabricator-diff-tree-view' => 'ccf691f3',
'phabricator-diff-path-view' => 'ceb66010',
'phabricator-diff-tree-view' => '5d83623b',
'phabricator-drag-and-drop-file-upload' => '4370900d',
'phabricator-draggable-list' => '0169e425',
'phabricator-fatal-config-template-css' => '20babf50',
@ -1505,7 +1505,7 @@ return array(
'javelin-dom',
'phuix-dropdown-menu',
),
'5f70ad12' => array(
'5d83623b' => array(
'javelin-dom',
),
'5faf27b9' => array(
@ -1829,6 +1829,18 @@ return array(
'javelin-dom',
'javelin-workflow',
),
'a1a5dc46' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
'phabricator-diff-inline',
'phabricator-diff-path-view',
),
'a241536a' => array(
'javelin-install',
),
@ -2067,7 +2079,7 @@ return array(
'phuix-icon-view',
'phabricator-busy',
),
'ccf691f3' => array(
'ceb66010' => array(
'javelin-dom',
),
'cef53b3e' => array(
@ -2081,18 +2093,6 @@ return array(
'javelin-dom',
'javelin-stratcom',
),
'd089ffb1' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
'phabricator-diff-inline',
'phabricator-diff-path-view',
),
'd12d214f' => array(
'javelin-install',
'javelin-dom',

View file

@ -384,7 +384,6 @@ final class DifferentialRevisionViewController
->setTitle(pht('Diff %s', $target->getID()))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
$revision_id = $revision->getID();
$inline_list_uri = "/revision/inlines/{$revision_id}/";
$inline_list_uri = $this->getApplicationURI($inline_list_uri);
@ -456,6 +455,15 @@ final class DifferentialRevisionViewController
$reviewer_changesets = $this->getPackageChangesets($reviewer_phid);
$reviewer->attachChangesets($reviewer_changesets);
}
$authority_packages = $this->getAuthorityPackages();
foreach ($changesets as $changeset) {
$changeset_packages = $this->getChangesetPackages($changeset);
$changeset
->setAuthorityPackages($authority_packages)
->setChangesetPackages($changeset_packages);
}
}
$tab_group = new PHUITabGroupView();
@ -476,7 +484,6 @@ final class DifferentialRevisionViewController
$filetree = id(new DifferentialFileTreeEngine())
->setViewer($viewer);
$filetree_collapsed = !$filetree->getIsVisible();
// See PHI811. If the viewer has the file tree on, the files tab with the

View file

@ -6,6 +6,7 @@ final class DifferentialFileTreeEngine
private $viewer;
private $changesets;
private $disabled;
private $ownedChangesets;
public function setViewer($viewer) {
$this->viewer = $viewer;

View file

@ -350,9 +350,12 @@ final class DifferentialInlineCommentMailView
// comments on diffs with long recipient lists.
$cache_key = $changeset->getID();
$viewstate = new PhabricatorChangesetViewState();
$parser = id(new DifferentialChangesetParser())
->setRenderCacheKey($cache_key)
->setUser($viewer)
->setViewer($viewer)
->setViewstate($viewstate)
->setChangeset($changeset)
->setOffsetMode($offset_mode)
->setMarkupEngine($engine);

View file

@ -22,6 +22,9 @@ final class DifferentialChangeset
private $hunks = self::ATTACHABLE;
private $diff = self::ATTACHABLE;
private $authorityPackages;
private $changesetPackages;
const TABLE_CACHE = 'differential_changeset_parse_cache';
const METADATA_TRUSTED_ATTRIBUTES = 'attributes.trusted';
@ -110,6 +113,24 @@ final class DifferentialChangeset
return $this;
}
public function setAuthorityPackages(array $authority_packages) {
$this->authorityPackages = mpull($authority_packages, null, 'getPHID');
return $this;
}
public function getAuthorityPackages() {
return $this->authorityPackages;
}
public function setChangesetPackages($changeset_packages) {
$this->changesetPackages = mpull($changeset_packages, null, 'getPHID');
return $this;
}
public function getChangesetPackages() {
return $this->changesetPackages;
}
public function save() {
$this->openTransaction();
$ret = parent::save();
@ -266,6 +287,37 @@ final class DifferentialChangeset
->setIcon("{$icon} {$color}");
}
public function getIsOwnedChangeset() {
$authority_packages = $this->getAuthorityPackages();
$changeset_packages = $this->getChangesetPackages();
if (!$authority_packages || !$changeset_packages) {
return false;
}
return (bool)array_intersect_key($authority_packages, $changeset_packages);
}
public function getIsLowImportanceChangeset() {
$change_type = $this->getChangeType();
$change_map = array(
DifferentialChangeType::TYPE_DELETE => true,
DifferentialChangeType::TYPE_MOVE_AWAY => true,
DifferentialChangeType::TYPE_MULTICOPY => true,
);
if (isset($change_map[$change_type])) {
return $change_map[$change_type];
}
if ($this->isGeneratedChangeset()) {
return true;
}
return false;
}
public function getPathIconIcon() {
return idx($this->getPathIconDetails(), 'icon');
}

View file

@ -197,6 +197,8 @@ final class DifferentialChangesetDetailView extends AphrontView {
'pathIconIcon' => $changeset->getPathIconIcon(),
'pathIconColor' => $changeset->getPathIconColor(),
'isLowImportance' => $changeset->getIsLowImportanceChangeset(),
'isOwned' => $changeset->getIsOwnedChangeset(),
'editorURI' => $this->getEditorURI(),
'editorConfigureURI' => $this->getEditorConfigureURI(),

View file

@ -10,6 +10,7 @@
height: 20px;
line-height: 20px;
color: {$greytext};
border-left: 4px solid transparent;
}
.diff-tree-path-indent {
@ -44,15 +45,25 @@
background: {$darkgreybackground};
}
.diff-tree-path-selected {
background: {$yellow};
}
.device-desktop .diff-tree-path-changeset:hover {
background: {$lightblueborder};
transition: 0.1s;
}
.diff-tree-view .diff-tree-path-changeset.diff-tree-path-selected {
/* Rule is intentionally more specific than "hover". */
background: {$yellow};
}
.diff-tree-path-low-importance .diff-tree-path-name {
opacity: 0.5;
}
.diff-tree-path-owned {
border-left-color: {$orange};
box-shadow: inset 2px 0 {$lightorange};
}
.diff-tree-path-inlines {
display: none;
position: absolute;

View file

@ -37,6 +37,8 @@ JX.install('DiffChangeset', {
this._pathIconIcon = data.pathIconIcon;
this._pathIconColor = data.pathIconColor;
this._isLowImportance = data.isLowImportance;
this._isOwned = data.isOwned;
this._inlines = [];
@ -77,6 +79,8 @@ JX.install('DiffChangeset', {
_pathIconIcon: null,
_pathIconColor: null,
_isLowImportance: null,
_isOwned: null,
getEditorURI: function() {
return this._editorURI;
@ -900,7 +904,9 @@ JX.install('DiffChangeset', {
if (!this._pathView) {
var view = new JX.DiffPathView()
.setChangeset(this)
.setPath(this._pathParts);
.setPath(this._pathParts)
.setIsLowImportance(this._isLowImportance)
.setIsOwned(this._isOwned);
view.getIcon()
.setIcon(this._pathIconIcon)

View file

@ -23,6 +23,8 @@ JX.install('DiffPathView', {
_inlineNode: null,
_isDirectory: false,
_displayPath: null,
_isOwned: false,
_isLowImportance: false,
getNode: function() {
if (!this._node) {
@ -119,6 +121,27 @@ JX.install('DiffPathView', {
return this;
},
setIsLowImportance: function(low_importance) {
this._isLowImportance = low_importance;
var node = this.getNode();
JX.DOM.alterClass(
node,
'diff-tree-path-low-importance',
this._isLowImportance);
return this;
},
setIsOwned: function(owned) {
this._isOwned = owned;
var node = this.getNode();
JX.DOM.alterClass(node, 'diff-tree-path-owned', this._isOwned);
return this;
},
_onclick: function(e) {
if (!e.isNormalClick()) {
return;

View file

@ -106,7 +106,8 @@ JX.install('DiffTreeView', {
.setPath(tree.parts);
path.getIcon()
.setIcon('fa-folder-open-o');
.setIcon('fa-folder-open-o')
.setColor('grey');
tree.pathObject = path;
}