]> source.dussan.org Git - gitblit.git/commitdiff
Revise severity & priority permissions
authorJames Moger <james.moger@gitblit.com>
Thu, 20 Nov 2014 14:23:32 +0000 (09:23 -0500)
committerJames Moger <james.moger@gitblit.com>
Thu, 20 Nov 2014 14:23:32 +0000 (09:23 -0500)
Ticket reporters should be able to specify severity whereas only those with repository push access should be able to specify priority. This also fixes a bug related to non-admin users creating tickets.

src/main/java/com/gitblit/wicket/pages/EditTicketPage.html
src/main/java/com/gitblit/wicket/pages/EditTicketPage.java
src/main/java/com/gitblit/wicket/pages/NewTicketPage.html
src/main/java/com/gitblit/wicket/pages/NewTicketPage.java

index e11aed825ecb8c652dc7993f144e1d0acbcdad78..b12d0c7734396643472dc4047f4e040a7648dc54 100644 (file)
                                </div>\r
                        </td></tr>\r
                        <tr wicket:id="status"></tr>\r
+            <tr><th><wicket:message key="gb.severity"></wicket:message></th><td class="edit"><select class="input-large" wicket:id="severity"></select></td></tr>\r
+            <tr wicket:id="priority"></tr>\r
                        <tr wicket:id="responsible"></tr>\r
                        <tr wicket:id="milestone"></tr>\r
-                       <tr><th><wicket:message key="gb.priority"></wicket:message></th><td class="edit"><select class="input-large" wicket:id="priority"></select></td></tr>\r
-                       <tr><th><wicket:message key="gb.severity"></wicket:message></th><td class="edit"><select class="input-large" wicket:id="severity"></select></td></tr>\r
                        <tr wicket:id="mergeto"></tr>\r
                </table>\r
        </div>\r
@@ -73,5 +73,9 @@
        <th><wicket:message key="gb.mergeTo"></wicket:message></th><td class="edit"><select class="input-large" wicket:id="mergeto"></select></td>\r
 </wicket:fragment>\r
 \r
+<wicket:fragment wicket:id="priorityFragment">\r
+    <th><wicket:message key="gb.priority"></wicket:message></th><td class="edit"><select class="input-large" wicket:id="priority"></select></td>\r
+</wicket:fragment>\r
+\r
 </wicket:extend>\r
 </html>
\ No newline at end of file
index 7c02c0beeb163c03184a53ba7c4ce89fe03ad7a8..192b48caac3faf7ea9b32445cf61eccb44a5515c 100644 (file)
@@ -83,9 +83,9 @@ public class EditTicketPage extends RepositoryPage {
        private IModel<TicketMilestone> milestoneModel;\r
 \r
        private Label descriptionPreview;\r
-       \r
+\r
        private IModel<TicketModel.Priority> priorityModel;\r
-       \r
+\r
        private IModel<TicketModel.Severity> severityModel;\r
 \r
        public EditTicketPage(PageParameters params) {\r
@@ -167,6 +167,9 @@ public class EditTicketPage extends RepositoryPage {
                status.add(new DropDownChoice<TicketModel.Status>("status", statusModel, statusChoices));\r
                form.add(status);\r
 \r
+               List<TicketModel.Severity> severityChoices = Arrays.asList(TicketModel.Severity.choices());\r
+               form.add(new DropDownChoice<TicketModel.Severity>("severity", severityModel, severityChoices));\r
+\r
                if (currentUser.canAdmin(ticket, getRepositoryModel())) {\r
                        // responsible\r
                        Set<String> userlist = new TreeSet<String>(ticket.getParticipants());\r
@@ -220,19 +223,17 @@ public class EditTicketPage extends RepositoryPage {
                                milestones.add(new TicketMilestone(NIL));\r
                        }\r
 \r
+                       // milestone\r
                        Fragment milestone = new Fragment("milestone", "milestoneFragment", this);\r
-\r
                        milestone.add(new DropDownChoice<TicketMilestone>("milestone", milestoneModel, milestones));\r
                        form.add(milestone.setVisible(!milestones.isEmpty()));\r
 \r
                        // priority\r
+                       Fragment priority = new Fragment("priority", "priorityFragment", this);\r
                        List<TicketModel.Priority> priorityChoices = Arrays.asList(TicketModel.Priority.choices());\r
-                       form.add(new DropDownChoice<TicketModel.Priority>("priority", priorityModel, priorityChoices));\r
-                       \r
-                       // severity\r
-                       List<TicketModel.Severity> severityChoices = Arrays.asList(TicketModel.Severity.choices());\r
-                       form.add(new DropDownChoice<TicketModel.Severity>("severity", severityModel, severityChoices));\r
-                                               \r
+                       priority.add(new DropDownChoice<TicketModel.Priority>("priority", priorityModel, priorityChoices));\r
+                       form.add(priority);\r
+\r
                        // mergeTo (integration branch)\r
                        List<String> branches = new ArrayList<String>();\r
                        for (String branch : getRepositoryModel().getLocalBranches()) {\r
@@ -252,6 +253,7 @@ public class EditTicketPage extends RepositoryPage {
                        form.add(new Label("responsible").setVisible(false));\r
                        form.add(new Label("milestone").setVisible(false));\r
                        form.add(new Label("mergeto").setVisible(false));\r
+                       form.add(new Label("priority").setVisible(false));\r
                }\r
 \r
                form.add(new AjaxButton("update") {\r
@@ -329,7 +331,7 @@ public class EditTicketPage extends RepositoryPage {
                                                change.setField(Field.milestone, milestone.name);\r
                                        }\r
                                }\r
-                               \r
+\r
                                TicketModel.Priority priority = priorityModel.getObject();\r
                                if (!ticket.priority.equals(priority))\r
                                {\r
@@ -341,7 +343,7 @@ public class EditTicketPage extends RepositoryPage {
                                {\r
                                        change.setField(Field.severity, severity);\r
                                }\r
-                               \r
+\r
                                String mergeTo = mergeToModel.getObject();\r
                                if ((StringUtils.isEmpty(ticket.mergeTo) && !StringUtils.isEmpty(mergeTo))\r
                                                || (!StringUtils.isEmpty(mergeTo) && !mergeTo.equals(ticket.mergeTo))) {\r
index 7b71ada078e14ae9807070686c4858f19a68aaae..9b5af023843ef8e044ddb4a2adcb5171ed5b2096 100644 (file)
                                </div>\r
                        </td></tr>\r
                        <tr><th><wicket:message key="gb.type"></wicket:message><span style="color:red;">*</span></th><td class="edit"><select class="input-large" wicket:id="type"></select></td></tr>\r
+            <tr><th><wicket:message key="gb.severity"></wicket:message></th><td class="edit"><select class="input-large" wicket:id="severity"></select></td></tr>\r
+            <tr wicket:id="priority"></tr>\r
                        <tr wicket:id="responsible"></tr>\r
                        <tr wicket:id="milestone"></tr>\r
-                       <tr><th><wicket:message key="gb.priority"></wicket:message></th><td class="edit"><select class="input-large" wicket:id="priority"></select></td></tr>\r
-                       <tr><th><wicket:message key="gb.severity"></wicket:message></th><td class="edit"><select class="input-large" wicket:id="severity"></select></td></tr>\r
                        <tr wicket:id="mergeto"></tr>\r
                </table>\r
        </div>\r
@@ -69,5 +69,9 @@
        <th><wicket:message key="gb.mergeTo"></wicket:message></th><td class="edit"><select class="input-large" wicket:id="mergeto"></select></td>\r
 </wicket:fragment>\r
 \r
+<wicket:fragment wicket:id="priorityFragment">\r
+    <th><wicket:message key="gb.priority"></wicket:message></th><td class="edit"><select class="input-large" wicket:id="priority"></select></td>\r
+</wicket:fragment>\r
+\r
 </wicket:extend>\r
 </html>
\ No newline at end of file
index ea3e960262a01efb4704a1a81eea50d0ce8122bb..0c52505c6c9d1130c77e40bcdecaed032508d80d 100644 (file)
@@ -75,9 +75,9 @@ public class NewTicketPage extends RepositoryPage {
        private IModel<TicketMilestone> milestoneModel;\r
 \r
        private Label descriptionPreview;\r
-       \r
+\r
        private IModel<TicketModel.Priority> priorityModel;\r
-       \r
+\r
        private IModel<TicketModel.Severity> severityModel;\r
 \r
        public NewTicketPage(PageParameters params) {\r
@@ -111,6 +111,7 @@ public class NewTicketPage extends RepositoryPage {
                form.add(new DropDownChoice<TicketModel.Type>("type", typeModel, Arrays.asList(TicketModel.Type.choices())));\r
                form.add(new TextField<String>("title", titleModel));\r
                form.add(new TextField<String>("topic", topicModel));\r
+               form.add(new DropDownChoice<TicketModel.Severity>("severity", severityModel, Arrays.asList(TicketModel.Severity.choices())));\r
 \r
                final IModel<String> markdownPreviewModel = Model.of();\r
                descriptionPreview = new Label("descriptionPreview", markdownPreviewModel);\r
@@ -159,11 +160,10 @@ public class NewTicketPage extends RepositoryPage {
                        form.add(milestone.setVisible(!milestones.isEmpty()));\r
 \r
                        // priority\r
-                       form.add(new DropDownChoice<TicketModel.Priority>("priority", priorityModel, Arrays.asList(TicketModel.Priority.choices())));\r
-                       \r
-                       //severity\r
-                       form.add(new DropDownChoice<TicketModel.Severity>("severity", severityModel, Arrays.asList(TicketModel.Severity.choices())));\r
-                       \r
+                       Fragment priority = new Fragment("priority", "priorityFragment", this);\r
+                       priority.add(new DropDownChoice<TicketModel.Priority>("priority", priorityModel, Arrays.asList(TicketModel.Priority.choices())));\r
+                       form.add(priority);\r
+\r
                        // integration branch\r
                        List<String> branches = new ArrayList<String>();\r
                        for (String branch : getRepositoryModel().getLocalBranches()) {\r
@@ -183,6 +183,7 @@ public class NewTicketPage extends RepositoryPage {
                        form.add(new Label("responsible").setVisible(false));\r
                        form.add(new Label("milestone").setVisible(false));\r
                        form.add(new Label("mergeto").setVisible(false));\r
+                       form.add(new Label("priority").setVisible(false));\r
                }\r
 \r
                form.add(new AjaxButton("create") {\r
@@ -223,14 +224,14 @@ public class NewTicketPage extends RepositoryPage {
                                if (milestone != null) {\r
                                        change.setField(Field.milestone, milestone.name);\r
                                }\r
-                               \r
+\r
                                // severity\r
                                TicketModel.Severity severity = TicketModel.Severity.defaultSeverity;\r
                                if (severityModel.getObject() != null) {\r
                                        severity = severityModel.getObject();\r
                                }\r
                                change.setField(Field.severity, severity);\r
-                               \r
+\r
                                // priority\r
                                TicketModel.Priority priority = TicketModel.Priority.defaultPriority;\r
                                if (priorityModel.getObject() != null) {\r