summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/models/TicketModel.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/gitblit/models/TicketModel.java')
-rw-r--r--src/main/java/com/gitblit/models/TicketModel.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/models/TicketModel.java b/src/main/java/com/gitblit/models/TicketModel.java
index fa09ec59..aced6d78 100644
--- a/src/main/java/com/gitblit/models/TicketModel.java
+++ b/src/main/java/com/gitblit/models/TicketModel.java
@@ -785,7 +785,21 @@ public class TicketModel implements Serializable, Comparable<TicketModel> {
for (String item : items) {
list.add(prefix + item);
}
- setField(field, join(list, ","));
+ if (hasField(field)) {
+ String flat = getString(field);
+ if (isEmpty(flat)) {
+ // field is empty, use this list
+ setField(field, join(list, ","));
+ } else {
+ // merge this list into the existing field list
+ Set<String> set = new TreeSet<String>(Arrays.asList(flat.split(",")));
+ set.addAll(list);
+ setField(field, join(set, ","));
+ }
+ } else {
+ // does not have a list for this field
+ setField(field, join(list, ","));
+ }
}
public String getId() {