Merge "Add gitweb.linkDrafts to control if gitweb links are shown on drafts"

This commit is contained in:
David Pursehouse
2013-04-17 03:08:00 +00:00
committed by Gerrit Code Review
5 changed files with 38 additions and 1 deletions

View File

@@ -35,6 +35,16 @@ public class GitwebLink {
type = link.type;
}
/**
* Can we link to a patch set if it's a draft
*
* @param ps Patch set to check draft status
* @return true if it's not a draft, or we can link to drafts
*/
public boolean canLink(final PatchSet ps) {
return !ps.isDraft() || type.getLinkDrafts();
}
public String getLinkName() {
return "(" + type.getLinkName() + ")";
}

View File

@@ -91,7 +91,7 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " ");
revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision());
getHeader().add(revtxt);
if (gw != null) {
if (gw != null && gw.canLink(ps)) {
final Anchor revlink =
new Anchor(gw.getLinkName(), false, gw.toRevision(changeDetail.getChange()
.getProject(), ps));