summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/models
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-03-12 22:25:52 -0400
committerJames Moger <james.moger@gitblit.com>2014-03-12 22:25:52 -0400
commit1207947afee4d7fbd2ee374339d5e84bb0528e9a (patch)
tree6498460efdb772b39196b6903898cdde33ef7662 /src/main/java/com/gitblit/models
parentb8e1fa94f3f28a94b466c79b1a4b24c6fd755df1 (diff)
downloadgitblit-1207947afee4d7fbd2ee374339d5e84bb0528e9a.tar.gz
gitblit-1207947afee4d7fbd2ee374339d5e84bb0528e9a.zip
Fix TicketModel modList bug when a field was set multiple times
Diffstat (limited to 'src/main/java/com/gitblit/models')
-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() {