summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/tickets
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-04-26 13:51:39 -0400
committerJames Moger <james.moger@gitblit.com>2014-05-01 14:27:28 -0400
commit01995873731e7efa517ca66246547b3084f8d529 (patch)
treeab708e66f058e49fbd2fcb8d2014a79ce51574d5 /src/main/java/com/gitblit/tickets
parentce048e750f7ae986dddfc8ab9b57750114d2b7b9 (diff)
downloadgitblit-01995873731e7efa517ca66246547b3084f8d529.tar.gz
gitblit-01995873731e7efa517ca66246547b3084f8d529.zip
Allow milestone deletion within the edit milestone page
Diffstat (limited to 'src/main/java/com/gitblit/tickets')
-rw-r--r--src/main/java/com/gitblit/tickets/ITicketService.java11
-rw-r--r--src/main/java/com/gitblit/tickets/QueryResult.java8
2 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/tickets/ITicketService.java b/src/main/java/com/gitblit/tickets/ITicketService.java
index e1a377a6..cce805ed 100644
--- a/src/main/java/com/gitblit/tickets/ITicketService.java
+++ b/src/main/java/com/gitblit/tickets/ITicketService.java
@@ -643,7 +643,7 @@ public abstract class ITicketService {
public synchronized boolean renameMilestone(RepositoryModel repository, String oldName, String newName, String createdBy) {
return renameMilestone(repository, oldName, newName, createdBy, true);
}
-
+
/**
* Renames a milestone.
*
@@ -714,6 +714,7 @@ public abstract class ITicketService {
}
Repository db = null;
try {
+ TicketMilestone tm = getMilestone(repository, milestone);
db = repositoryManager.getRepository(repository.name);
StoredConfig config = db.getConfig();
config.unsetSection(MILESTONE, milestone);
@@ -721,6 +722,14 @@ public abstract class ITicketService {
milestonesCache.remove(repository.name);
+ for (QueryResult qr : tm.tickets) {
+ if (qr.isOpen()) {
+ // reset the milestone only for open tickets
+ Change change = new Change(createdBy);
+ change.setField(Field.milestone, "");
+ TicketModel ticket = updateTicket(repository, qr.number, change);
+ }
+ }
return true;
} catch (IOException e) {
log.error("failed to delete milestone " + milestone + " in " + repository, e);
diff --git a/src/main/java/com/gitblit/tickets/QueryResult.java b/src/main/java/com/gitblit/tickets/QueryResult.java
index 9f5d3a55..7a2b1abe 100644
--- a/src/main/java/com/gitblit/tickets/QueryResult.java
+++ b/src/main/java/com/gitblit/tickets/QueryResult.java
@@ -74,6 +74,14 @@ public class QueryResult implements Serializable {
return type != null && Type.Proposal == type;
}
+ public boolean isOpen() {
+ return !status.isClosed();
+ }
+
+ public boolean isClosed() {
+ return status.isClosed();
+ }
+
public boolean isMerged() {
return Status.Merged == status && !StringUtils.isEmpty(mergeSha);
}