Refactor highlighting patch sets that have drafts
As suggested in the comments under change
I537db90a940c9df7c4b7c28974adac5b29c8abf4:
- Remove an unrelated field from a PatchSet entity class
- Remove highlighting of the patch set label
- Add a "comment" icon to a patch set header to indicate that it has draft
comment(s)
Bug: Issue 667
Change-Id: Ie37be962ecb7beb82e85174492e154db9df6175c
(cherry picked from commit 61e18b0595
)
This commit is contained in:
parent
2c7acce786
commit
9b42620385
@ -20,6 +20,7 @@ import com.google.gerrit.reviewdb.client.PatchSet;
|
|||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/** Detail necessary to display a change. */
|
/** Detail necessary to display a change. */
|
||||||
public class ChangeDetail {
|
public class ChangeDetail {
|
||||||
@ -37,6 +38,7 @@ public class ChangeDetail {
|
|||||||
protected List<ChangeInfo> dependsOn;
|
protected List<ChangeInfo> dependsOn;
|
||||||
protected List<ChangeInfo> neededBy;
|
protected List<ChangeInfo> neededBy;
|
||||||
protected List<PatchSet> patchSets;
|
protected List<PatchSet> patchSets;
|
||||||
|
protected Set<PatchSet.Id> patchSetsWithDraftComments;
|
||||||
protected List<SubmitRecord> submitRecords;
|
protected List<SubmitRecord> submitRecords;
|
||||||
protected Project.SubmitType submitType;
|
protected Project.SubmitType submitType;
|
||||||
protected SubmitTypeRecord submitTypeRecord;
|
protected SubmitTypeRecord submitTypeRecord;
|
||||||
@ -187,6 +189,14 @@ public class ChangeDetail {
|
|||||||
patchSets = s;
|
patchSets = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPatchSetsWithDraftComments(Set<PatchSet.Id> pwdc) {
|
||||||
|
this.patchSetsWithDraftComments = pwdc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasDraftComments(PatchSet.Id id) {
|
||||||
|
return patchSetsWithDraftComments.contains(id);
|
||||||
|
}
|
||||||
|
|
||||||
public void setSubmitRecords(List<SubmitRecord> all) {
|
public void setSubmitRecords(List<SubmitRecord> all) {
|
||||||
submitRecords = all;
|
submitRecords = all;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,6 @@ public interface GerritCss extends CssResource {
|
|||||||
String patchSetLink();
|
String patchSetLink();
|
||||||
String patchSetRevision();
|
String patchSetRevision();
|
||||||
String patchSetUserIdentity();
|
String patchSetUserIdentity();
|
||||||
String patchSetWithDraft();
|
|
||||||
String patchSizeCell();
|
String patchSizeCell();
|
||||||
String pluginsTable();
|
String pluginsTable();
|
||||||
String posscore();
|
String posscore();
|
||||||
|
@ -54,4 +54,7 @@ public interface GerritResources extends ClientBundle {
|
|||||||
|
|
||||||
@Source("diffy.png")
|
@Source("diffy.png")
|
||||||
public ImageResource gerritAvatar();
|
public ImageResource gerritAvatar();
|
||||||
|
|
||||||
|
@Source("draftComments.png")
|
||||||
|
public ImageResource draftComments();
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,7 @@ public interface ChangeConstants extends Constants {
|
|||||||
String patchSetInfoCommitter();
|
String patchSetInfoCommitter();
|
||||||
String patchSetInfoDownload();
|
String patchSetInfoDownload();
|
||||||
String patchSetInfoParents();
|
String patchSetInfoParents();
|
||||||
|
String patchSetWithDraftCommentsToolTip();
|
||||||
String initialCommit();
|
String initialCommit();
|
||||||
|
|
||||||
String buttonRebaseChange();
|
String buttonRebaseChange();
|
||||||
|
@ -100,6 +100,7 @@ patchSetInfoAuthor = Author
|
|||||||
patchSetInfoCommitter = Committer
|
patchSetInfoCommitter = Committer
|
||||||
patchSetInfoDownload = Download
|
patchSetInfoDownload = Download
|
||||||
patchSetInfoParents = Parent(s)
|
patchSetInfoParents = Parent(s)
|
||||||
|
patchSetWithDraftCommentsToolTip = Draft comment(s) inside
|
||||||
initialCommit = Initial Commit
|
initialCommit = Initial Commit
|
||||||
|
|
||||||
buttonAbandonChangeBegin = Abandon Change
|
buttonAbandonChangeBegin = Abandon Change
|
||||||
|
@ -45,6 +45,7 @@ import com.google.gwt.user.client.ui.DisclosurePanel;
|
|||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
import com.google.gwt.user.client.ui.FocusWidget;
|
import com.google.gwt.user.client.ui.FocusWidget;
|
||||||
import com.google.gwt.user.client.ui.Grid;
|
import com.google.gwt.user.client.ui.Grid;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
|
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
|
||||||
import com.google.gwt.user.client.ui.InlineLabel;
|
import com.google.gwt.user.client.ui.InlineLabel;
|
||||||
import com.google.gwt.user.client.ui.Panel;
|
import com.google.gwt.user.client.ui.Panel;
|
||||||
@ -78,7 +79,8 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
|
|||||||
* Creates a closed complex disclosure panel for a patch set.
|
* Creates a closed complex disclosure panel for a patch set.
|
||||||
* The patch set details are loaded when the complex disclosure panel is opened.
|
* The patch set details are loaded when the complex disclosure panel is opened.
|
||||||
*/
|
*/
|
||||||
public PatchSetComplexDisclosurePanel(final PatchSet ps, boolean isOpen) {
|
public PatchSetComplexDisclosurePanel(final PatchSet ps, boolean isOpen,
|
||||||
|
boolean hasDraftComments) {
|
||||||
super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen);
|
super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen);
|
||||||
detailCache = ChangeCache.get(ps.getId().getParentKey()).getChangeDetailCache();
|
detailCache = ChangeCache.get(ps.getId().getParentKey()).getChangeDetailCache();
|
||||||
changeDetail = detailCache.get();
|
changeDetail = detailCache.get();
|
||||||
@ -87,6 +89,12 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
|
|||||||
body = new FlowPanel();
|
body = new FlowPanel();
|
||||||
setContent(body);
|
setContent(body);
|
||||||
|
|
||||||
|
if (hasDraftComments) {
|
||||||
|
final Image draftComments = new Image(Gerrit.RESOURCES.draftComments());
|
||||||
|
draftComments.setTitle(Util.C.patchSetWithDraftCommentsToolTip());
|
||||||
|
getHeader().add(draftComments);
|
||||||
|
}
|
||||||
|
|
||||||
final GitwebLink gw = Gerrit.getGitwebLink();
|
final GitwebLink gw = Gerrit.getGitwebLink();
|
||||||
final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " ");
|
final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " ");
|
||||||
revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision());
|
revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision());
|
||||||
@ -111,10 +119,6 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
|
|||||||
addOpenHandler(this);
|
addOpenHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ps.getHasDraftComments()) {
|
|
||||||
addStyleName(Gerrit.RESOURCES.css().patchSetWithDraft());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDiffBaseId(PatchSet.Id diffBaseId) {
|
public void setDiffBaseId(PatchSet.Id diffBaseId) {
|
||||||
|
@ -88,7 +88,8 @@ public class PatchSetsBlock extends Composite {
|
|||||||
|
|
||||||
for (final PatchSet ps : patchSets) {
|
for (final PatchSet ps : patchSets) {
|
||||||
final PatchSetComplexDisclosurePanel p =
|
final PatchSetComplexDisclosurePanel p =
|
||||||
new PatchSetComplexDisclosurePanel(ps, ps == currps);
|
new PatchSetComplexDisclosurePanel(ps, ps == currps,
|
||||||
|
detail.hasDraftComments(ps.getId()));
|
||||||
if (diffBaseId != null) {
|
if (diffBaseId != null) {
|
||||||
p.setDiffBaseId(diffBaseId);
|
p.setDiffBaseId(diffBaseId);
|
||||||
if (ps == currps) {
|
if (ps == currps) {
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 371 B |
@ -887,10 +887,6 @@ a:hover {
|
|||||||
font-size: 8pt;
|
font-size: 8pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
.patchSetWithDraft .header td {
|
|
||||||
color: #ff5555;
|
|
||||||
}
|
|
||||||
|
|
||||||
.changeScreen .gwt-DisclosurePanel .content {
|
.changeScreen .gwt-DisclosurePanel .content {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
@ -177,19 +177,25 @@ public class ChangeDetailFactory extends Handler<ChangeDetail> {
|
|||||||
private void loadPatchSets() throws OrmException {
|
private void loadPatchSets() throws OrmException {
|
||||||
ResultSet<PatchSet> source = db.patchSets().byChange(changeId);
|
ResultSet<PatchSet> source = db.patchSets().byChange(changeId);
|
||||||
List<PatchSet> patches = new ArrayList<PatchSet>();
|
List<PatchSet> patches = new ArrayList<PatchSet>();
|
||||||
|
Set<PatchSet.Id> patchesWithDraftComments = new HashSet<PatchSet.Id>();
|
||||||
|
final CurrentUser user = control.getCurrentUser();
|
||||||
|
final Account.Id me =
|
||||||
|
user instanceof IdentifiedUser ? ((IdentifiedUser) user).getAccountId()
|
||||||
|
: null;
|
||||||
for (PatchSet ps : source) {
|
for (PatchSet ps : source) {
|
||||||
final CurrentUser user = control.getCurrentUser();
|
final PatchSet.Id psId = ps.getId();
|
||||||
if (user instanceof IdentifiedUser) {
|
|
||||||
final Account.Id me = ((IdentifiedUser) user).getAccountId();
|
|
||||||
ps.setHasDraftComments(db.patchComments()
|
|
||||||
.draftByPatchSetAuthor(ps.getId(), me).iterator().hasNext());
|
|
||||||
}
|
|
||||||
if (control.isPatchVisible(ps, db)) {
|
if (control.isPatchVisible(ps, db)) {
|
||||||
patches.add(ps);
|
patches.add(ps);
|
||||||
|
if (me != null
|
||||||
|
&& db.patchComments().draftByPatchSetAuthor(psId, me)
|
||||||
|
.iterator().hasNext()) {
|
||||||
|
patchesWithDraftComments.add(psId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
patchsetsById.put(ps.getId(), ps);
|
patchsetsById.put(psId, ps);
|
||||||
}
|
}
|
||||||
detail.setPatchSets(patches);
|
detail.setPatchSets(patches);
|
||||||
|
detail.setPatchSetsWithDraftComments(patchesWithDraftComments);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadMessages() throws OrmException {
|
private void loadMessages() throws OrmException {
|
||||||
|
@ -136,9 +136,6 @@ public final class PatchSet {
|
|||||||
@Column(id = 5)
|
@Column(id = 5)
|
||||||
protected boolean draft;
|
protected boolean draft;
|
||||||
|
|
||||||
/** Not persisted in the database */
|
|
||||||
protected boolean hasDraftComments;
|
|
||||||
|
|
||||||
protected PatchSet() {
|
protected PatchSet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,14 +187,6 @@ public final class PatchSet {
|
|||||||
return id.toRefName();
|
return id.toRefName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getHasDraftComments() {
|
|
||||||
return hasDraftComments;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHasDraftComments(boolean hasDraftComments) {
|
|
||||||
this.hasDraftComments = hasDraftComments;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[PatchSet " + getId().toString() + "]";
|
return "[PatchSet " + getId().toString() + "]";
|
||||||
|
Loading…
Reference in New Issue
Block a user