diff options
author | James Moger <james.moger@gitblit.com> | 2014-03-07 14:28:12 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-03-07 14:28:12 -0500 |
commit | 31e1bfd91836f35a6482431956a03b831e9ae956 (patch) | |
tree | ce693e23d550825a01f167e43720b0873229a117 | |
parent | c346a9c84fb14713b4974304c96bf3c1d6f508e0 (diff) | |
download | gitblit-31e1bfd91836f35a6482431956a03b831e9ae956.tar.gz gitblit-31e1bfd91836f35a6482431956a03b831e9ae956.zip |
Conditionally hide the propose patchset instructions
There are a few scenarios where a ticket without a patchset should not
display propose instructions.
1. the ticket is resolved
2. the repository is configured to reject new patchsets or is read-only
3. the server is configured to reject new patchsets
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/TicketPage.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.java b/src/main/java/com/gitblit/wicket/pages/TicketPage.java index 69f4fe7a..4be9e69f 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.java @@ -731,15 +731,22 @@ public class TicketPage extends TicketBasePage { * PATCHSET TAB
*/
if (currentPatchset == null) {
- // no patchset yet, show propose fragment
- String repoUrl = getRepositoryUrl(user, repository);
- Fragment changeIdFrag = new Fragment("patchset", "proposeFragment", this);
- changeIdFrag.add(new Label("proposeInstructions", MarkdownUtils.transformMarkdown(getString("gb.proposeInstructions"))).setEscapeModelStrings(false));
- changeIdFrag.add(new Label("ptWorkflow", MessageFormat.format(getString("gb.proposeWith"), "Barnum")));
- changeIdFrag.add(new Label("ptWorkflowSteps", getProposeWorkflow("propose_pt.md", repoUrl, ticket.number)).setEscapeModelStrings(false));
- changeIdFrag.add(new Label("gitWorkflow", MessageFormat.format(getString("gb.proposeWith"), "Git")));
- changeIdFrag.add(new Label("gitWorkflowSteps", getProposeWorkflow("propose_git.md", repoUrl, ticket.number)).setEscapeModelStrings(false));
- add(changeIdFrag);
+ // no patchset available
+ if (ticket.isOpen() && app().tickets().isAcceptingNewPatchsets(repository)) {
+ // ticket & repo will accept a proposal patchset
+ // show the instructions for proposing a patchset
+ String repoUrl = getRepositoryUrl(user, repository);
+ Fragment changeIdFrag = new Fragment("patchset", "proposeFragment", this);
+ changeIdFrag.add(new Label("proposeInstructions", MarkdownUtils.transformMarkdown(getString("gb.proposeInstructions"))).setEscapeModelStrings(false));
+ changeIdFrag.add(new Label("ptWorkflow", MessageFormat.format(getString("gb.proposeWith"), "Barnum")));
+ changeIdFrag.add(new Label("ptWorkflowSteps", getProposeWorkflow("propose_pt.md", repoUrl, ticket.number)).setEscapeModelStrings(false));
+ changeIdFrag.add(new Label("gitWorkflow", MessageFormat.format(getString("gb.proposeWith"), "Git")));
+ 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));
+ }
} else {
// show current patchset
Fragment patchsetFrag = new Fragment("patchset", "patchsetFragment", this);
|