Suppress change edit icon for closed changes on SBS2

Change-Id: I4f9638e8e84ea6b470f73da6dede0322d12daea4
This commit is contained in:
David Ostrovsky
2014-10-17 00:24:20 +02:00
parent 2801c7f175
commit fd6298525e
3 changed files with 12 additions and 6 deletions

View File

@@ -169,11 +169,13 @@ class DiffTable extends Composite {
} }
void set(DiffPreferences prefs, JsArray<RevisionInfo> list, DiffInfo info, void set(DiffPreferences prefs, JsArray<RevisionInfo> list, DiffInfo info,
boolean editExists, int currentPatchSet) { boolean editExists, int currentPatchSet, boolean open) {
this.changeType = info.change_type(); this.changeType = info.change_type();
this.autoHideHeader = prefs.autoHideDiffTableHeader(); this.autoHideHeader = prefs.autoHideDiffTableHeader();
patchSetSelectBoxA.setUpPatchSetNav(list, info.meta_a(), editExists, currentPatchSet); patchSetSelectBoxA.setUpPatchSetNav(list, info.meta_a(), editExists,
patchSetSelectBoxB.setUpPatchSetNav(list, info.meta_b(), editExists, currentPatchSet); currentPatchSet, open);
patchSetSelectBoxB.setUpPatchSetNav(list, info.meta_b(), editExists,
currentPatchSet, open);
JsArrayString hdr = info.diff_header(); JsArrayString hdr = info.diff_header();
if (hdr != null) { if (hdr != null) {

View File

@@ -87,7 +87,7 @@ class PatchSetSelectBox2 extends Composite {
} }
void setUpPatchSetNav(JsArray<RevisionInfo> list, DiffInfo.FileMeta meta, void setUpPatchSetNav(JsArray<RevisionInfo> list, DiffInfo.FileMeta meta,
boolean editExists, int currentPatchSet) { boolean editExists, int currentPatchSet, boolean open) {
InlineHyperlink baseLink = null; InlineHyperlink baseLink = null;
InlineHyperlink selectedLink = null; InlineHyperlink selectedLink = null;
if (sideA) { if (sideA) {
@@ -115,7 +115,7 @@ class PatchSetSelectBox2 extends Composite {
if (!Patch.COMMIT_MSG.equals(path)) { if (!Patch.COMMIT_MSG.equals(path)) {
linkPanel.add(createDownloadLink()); linkPanel.add(createDownloadLink());
} }
if (idActive != null && Gerrit.isSignedIn() if (open && idActive != null && Gerrit.isSignedIn()
&& !Patch.COMMIT_MSG.equals(path)) { && !Patch.COMMIT_MSG.equals(path)) {
if ((editExists && idActive.get() == 0) if ((editExists && idActive.get() == 0)
|| (!editExists && idActive.get() == currentPatchSet)) { || (!editExists && idActive.get() == currentPatchSet)) {

View File

@@ -223,7 +223,11 @@ public class SideBySide2 extends Screen {
int currentPatchSet = info.revision(info.current_revision())._number(); int currentPatchSet = info.revision(info.current_revision())._number();
JsArray<RevisionInfo> list = info.revisions().values(); JsArray<RevisionInfo> list = info.revisions().values();
RevisionInfo.sortRevisionInfoByNumber(list); RevisionInfo.sortRevisionInfoByNumber(list);
diffTable.set(prefs, list, diff, edit != null, currentPatchSet); // TODO(davido): Change edit feature doesn't support drafts atm,
// so we cannot use info.status().isOpen()
boolean renderChangeEditIcon = info.status() == Change.Status.NEW;
diffTable.set(prefs, list, diff, edit != null, currentPatchSet,
renderChangeEditIcon);
header.setChangeInfo(info); header.setChangeInfo(info);
}})); }}));