THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

api: Support ISSUE_LABE_CHANGED event

tags/v1.11.0
Suwon Chae 1 year ago
parent
commit
b782a77670
3 changed files with 13 additions and 3 deletions
  1. +2
    -2
      app/controllers/IssueApp.java
  2. +10
    -0
      app/controllers/api/IssueApi.java
  3. +1
    -1
      app/views/issue/partial_event_timeline.scala.html

+ 2
- 2
app/controllers/IssueApp.java View File

@@ -432,7 +432,7 @@ public class IssueApp extends AbstractPostingApp {
IssueLabel label = IssueLabel.finder.byId(labelId);
issue.labels.add(label);
isLabelChanged = true;
addedLabels.append(label.category.name).append(" - ").append(label.name);
addedLabels.append(label.category.name).append(" - ").append(label.name).append(" ").append(label.color);
}
}

@@ -441,7 +441,7 @@ public class IssueApp extends AbstractPostingApp {
IssueLabel label = IssueLabel.finder.byId(labelId);
issue.labels.remove(label);
isLabelChanged = true;
deletedLabels.append(label.category.name).append(" - ").append(label.name);
deletedLabels.append(label.category.name).append(" - ").append(label.name).append(" ").append(label.color);
}
}


+ 10
- 0
app/controllers/api/IssueApi.java View File

@@ -107,12 +107,14 @@ public class IssueApi extends AbstractPostingApp {
if (issue.events.size() > 0) {
for (IssueEvent event: issue.events) {
ObjectNode result = Json.newObject();
User sender = User.findByLoginId(event.senderLoginId);
result.put("id", event.id);
result.put("createdDate", JodaDateUtil.getDateString(event.created, JodaDateUtil.ISO_FORMAT));
result.put("eventType", event.eventType.toString());
result.put("eventDescription", event.eventType.getDescr());
result.put("oldValue", event.oldValue);
result.put("newValue", event.newValue);
result.put("actor", getActorJson(sender));
array.add(result);
}
}
@@ -120,6 +122,14 @@ public class IssueApi extends AbstractPostingApp {
return array;
}

private static JsonNode getActorJson(User user) {
ObjectNode result = Json.newObject();
result.put("name", user.getPureNameOnly());
result.put("loginId", user.loginId);
result.put("englishName", user.englishName);
return result;
}

@Transactional
@IsCreatable(ResourceType.ISSUE_POST)
public static Result newIssues(String owner, String projectName) {

+ 1
- 1
app/views/issue/partial_event_timeline.scala.html View File

@@ -58,7 +58,7 @@
categoryAndName
} else {
var categoryName = splitedCategoryAndName(0).trim
var labelName = splitedCategoryAndName(1).trim
var labelName = splitedCategoryAndName(1).split(" #")(0).trim
val issueLabel = IssueLabel.findByName(labelName, categoryName, project)
if(issueLabel != null) {
val labelColor = issueLabel.color

Loading…
Cancel
Save