public void writeActions(Issue issue, JsonWriter json) {
   json.name("actions").beginArray();
   for (String action : actionService.listAvailableActions(issue)) {
     json.value(action);
   }
   json.endArray();
 }
Exemplo n.º 2
0
 // TODO all available actions should be returned by ActionService or another service
 private List<String> actions(DefaultIssue issue) {
   List<String> actions = newArrayList();
   if (UserSession.get().isLoggedIn()) {
     actions.add("comment");
     if (issue.resolution() == null) {
       actions.add("assign");
       if (!UserSession.get().login().equals(issue.assignee())) {
         actions.add("assign_to_me");
       }
       actions.add("plan");
       if (UserSession.get().hasProjectPermission(UserRole.ISSUE_ADMIN, issue.projectKey())) {
         actions.add("set_severity");
       }
       for (Action action : actionService.listAvailableActions(issue)) {
         actions.add(action.key());
       }
     }
   }
   return actions;
 }