James Moger
2014-03-05 7ca05374db6f6af9de06665c9d2d08acfe85aa4f
src/main/java/com/gitblit/wicket/pages/EditTicketPage.java
@@ -88,11 +88,6 @@
         currentUser = UserModel.ANONYMOUS;
      }
      if (!currentUser.isAuthenticated || !app().tickets().isAcceptingTicketUpdates(getRepositoryModel())) {
         // tickets prohibited
         setResponsePage(TicketsPage.class, WicketUtils.newRepositoryParameter(repositoryName));
      }
      long ticketId = 0L;
      try {
         String h = WicketUtils.getObject(params);
@@ -102,8 +97,10 @@
      }
      TicketModel ticket = app().tickets().getTicket(getRepositoryModel(), ticketId);
      if (ticket == null) {
         setResponsePage(TicketsPage.class, WicketUtils.newRepositoryParameter(repositoryName));
      if (ticket == null
            || !currentUser.canEdit(ticket, getRepositoryModel())
            || !app().tickets().isAcceptingTicketUpdates(getRepositoryModel())) {
         setResponsePage(TicketsPage.class, WicketUtils.newObjectParameter(repositoryName, "" + ticketId));
      }
      typeModel = Model.of(ticket.type);
@@ -223,18 +220,6 @@
      }
      form.add(new DropDownChoice<TicketModel.Type>("type", typeModel, typeChoices));
      List<Status> statusChoices;
      if (ticket.isClosed()) {
         statusChoices = Arrays.asList(ticket.status, Status.Open);
      } else if (ticket.isProposal()) {
         statusChoices = Arrays.asList(TicketModel.Status.proposalWorkflow);
      } else if (ticket.isBug()) {
         statusChoices = Arrays.asList(TicketModel.Status.bugWorkflow);
      } else {
         statusChoices = Arrays.asList(TicketModel.Status.requestWorkflow);
      }
      form.add(new DropDownChoice<TicketModel.Status>("status", statusModel, statusChoices));
      form.add(new TextField<String>("title", titleModel));
      form.add(new TextField<String>("topic", topicModel));
@@ -249,7 +234,21 @@
      descriptionEditor.setText(ticket.body);
      form.add(descriptionEditor);
      if (currentUser != null && currentUser.isAuthenticated && currentUser.canPush(getRepositoryModel())) {
      // status
      List<Status> statusChoices;
      if (ticket.isClosed()) {
         statusChoices = Arrays.asList(ticket.status, Status.Open);
      } else if (ticket.isProposal()) {
         statusChoices = Arrays.asList(TicketModel.Status.proposalWorkflow);
      } else if (ticket.isBug()) {
         statusChoices = Arrays.asList(TicketModel.Status.bugWorkflow);
      } else {
         statusChoices = Arrays.asList(TicketModel.Status.requestWorkflow);
      }
      Fragment status = new Fragment("status", "statusFragment", this);
      status.add(new DropDownChoice<TicketModel.Status>("status", statusModel, statusChoices));
      form.add(status);
         // responsible
         Set<String> userlist = new TreeSet<String>(ticket.getParticipants());
@@ -314,13 +313,6 @@
         Fragment mergeto = new Fragment("mergeto", "mergeToFragment", this);
         mergeto.add(new DropDownChoice<String>("mergeto", mergeToModel, branches));
         form.add(mergeto.setVisible(!branches.isEmpty()));
      } else {
         // user does not have permission to assign milestone or responsible
         form.add(new Label("responsible").setVisible(false));
         form.add(new Label("milestone").setVisible(false));
         form.add(new Label("mergeto").setVisible(false));
      }
      form.add(new Button("update"));
      Button cancel = new Button("cancel") {