From 4affd0a3a4fe086b31a87d56616f74093d2ac715 Mon Sep 17 00:00:00 2001 From: James Moger Date: Fri, 7 Mar 2014 14:59:02 -0500 Subject: [PATCH] Display an explanation in ticket page if the user can't propose commits --- .../gitblit/wicket/GitBlitWebApp.properties | 8 +++++++- .../com/gitblit/wicket/pages/TicketPage.html | 16 ++++++++++++++++ .../com/gitblit/wicket/pages/TicketPage.java | 18 ++++++++++++++++-- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties b/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties index 1a907bab..e52623e6 100644 --- a/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties +++ b/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties @@ -662,4 +662,10 @@ gb.mergeTo = merge to gb.labels = labels gb.reviewers = reviewers gb.voters = voters -gb.mentions = mentions \ No newline at end of file +gb.mentions = mentions +gb.canNotProposePatchset = can not propose a patchset +gb.repositoryIsMirror = This repository is a read-only mirror. +gb.repositoryIsFrozen = This repository is frozen. +gb.repositoryDoesNotAcceptPatchsets = This repository does not accept patchsets. +gb.serverDoesNotAcceptPatchsets = This server does not accept patchsets. +gb.ticketIsClosed = This ticket is closed. \ No newline at end of file diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.html b/src/main/java/com/gitblit/wicket/pages/TicketPage.html index 6fcf96c8..a2f105d3 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketPage.html +++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.html @@ -298,6 +298,22 @@ pt push + + +
+
+
+
+

+
+

+
+
+
+
+
+ +
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.java b/src/main/java/com/gitblit/wicket/pages/TicketPage.java index 4be9e69f..7b492dc2 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.java @@ -744,8 +744,22 @@ public class TicketPage extends TicketBasePage { changeIdFrag.add(new Label("gitWorkflowSteps", getProposeWorkflow("propose_git.md", repoUrl, ticket.number)).setEscapeModelStrings(false)); add(changeIdFrag); } else { - // ticket is resolved OR repository is rejecting new patchsets - add(new Label("patchset").setVisible(false)); + // explain why you can't propose a patchset + Fragment fragment = new Fragment("patchset", "canNotProposeFragment", this); + String reason = ""; + if (ticket.isClosed()) { + reason = getString("gb.ticketIsClosed"); + } else if (repository.isMirror) { + reason = getString("gb.repositoryIsMirror"); + } else if (repository.isFrozen) { + reason = getString("gb.repositoryIsFrozen"); + } else if (!repository.acceptNewPatchsets) { + reason = getString("gb.repositoryDoesNotAcceptPatchsets"); + } else { + reason = getString("gb.serverDoesNotAcceptPatchsets"); + } + fragment.add(new Label("reason", reason)); + add(fragment); } } else { // show current patchset -- 2.39.5