summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/tickets
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-06-08 10:30:39 -0400
committerJames Moger <james.moger@gitblit.com>2014-06-13 08:00:48 -0400
commit6651a8e96bdc51b0c558b88e1c77fcfbed1837da (patch)
treeb2d89a6dd77868783485af61636c65edf32b1861 /src/main/java/com/gitblit/tickets
parent2bfea381bbcea934f7e20f8c00db86e990c2fc93 (diff)
downloadgitblit-ticket/75.tar.gz
gitblit-ticket/75.zip
Move repository ownership to the UserModel and prepare for project ownershipticket/75
Diffstat (limited to 'src/main/java/com/gitblit/tickets')
-rw-r--r--src/main/java/com/gitblit/tickets/BranchTicketService.java4
-rw-r--r--src/main/java/com/gitblit/tickets/FileTicketService.java4
-rw-r--r--src/main/java/com/gitblit/tickets/RedisTicketService.java4
-rw-r--r--src/main/java/com/gitblit/tickets/TicketNotifier.java17
4 files changed, 18 insertions, 11 deletions
diff --git a/src/main/java/com/gitblit/tickets/BranchTicketService.java b/src/main/java/com/gitblit/tickets/BranchTicketService.java
index 8c000550..448014f7 100644
--- a/src/main/java/com/gitblit/tickets/BranchTicketService.java
+++ b/src/main/java/com/gitblit/tickets/BranchTicketService.java
@@ -494,7 +494,7 @@ public class BranchTicketService extends ITicketService implements RefsChangedLi
continue;
}
TicketModel ticket = TicketModel.buildTicket(changes);
- ticket.project = repository.projectPath;
+ ticket.project = repository.getProject();
ticket.repository = repository.name;
ticket.number = ticketId;
@@ -540,7 +540,7 @@ public class BranchTicketService extends ITicketService implements RefsChangedLi
}
TicketModel ticket = TicketModel.buildTicket(changes);
if (ticket != null) {
- ticket.project = repository.projectPath;
+ ticket.project = repository.getProject();
ticket.repository = repository.name;
ticket.number = ticketId;
}
diff --git a/src/main/java/com/gitblit/tickets/FileTicketService.java b/src/main/java/com/gitblit/tickets/FileTicketService.java
index b3d8838e..33b5307b 100644
--- a/src/main/java/com/gitblit/tickets/FileTicketService.java
+++ b/src/main/java/com/gitblit/tickets/FileTicketService.java
@@ -257,7 +257,7 @@ public class FileTicketService extends ITicketService {
continue;
}
TicketModel ticket = TicketModel.buildTicket(changes);
- ticket.project = repository.projectPath;
+ ticket.project = repository.getProject();
ticket.repository = repository.name;
ticket.number = ticketId;
@@ -320,7 +320,7 @@ public class FileTicketService extends ITicketService {
}
TicketModel ticket = TicketModel.buildTicket(changes);
if (ticket != null) {
- ticket.project = repository.projectPath;
+ ticket.project = repository.getProject();
ticket.repository = repository.name;
ticket.number = ticketId;
}
diff --git a/src/main/java/com/gitblit/tickets/RedisTicketService.java b/src/main/java/com/gitblit/tickets/RedisTicketService.java
index d773b0bd..465bda31 100644
--- a/src/main/java/com/gitblit/tickets/RedisTicketService.java
+++ b/src/main/java/com/gitblit/tickets/RedisTicketService.java
@@ -276,7 +276,7 @@ public class RedisTicketService extends ITicketService {
continue;
}
TicketModel ticket = TicketModel.buildTicket(changes);
- ticket.project = repository.projectPath;
+ ticket.project = repository.getProject();
ticket.repository = repository.name;
ticket.number = ticketId;
@@ -325,7 +325,7 @@ public class RedisTicketService extends ITicketService {
return null;
}
TicketModel ticket = TicketModel.buildTicket(changes);
- ticket.project = repository.projectPath;
+ ticket.project = repository.getProject();
ticket.repository = repository.name;
ticket.number = ticketId;
log.debug("rebuilt ticket {} from Redis @ {}", ticketId, getUrl());
diff --git a/src/main/java/com/gitblit/tickets/TicketNotifier.java b/src/main/java/com/gitblit/tickets/TicketNotifier.java
index 07371b1b..d4307106 100644
--- a/src/main/java/com/gitblit/tickets/TicketNotifier.java
+++ b/src/main/java/com/gitblit/tickets/TicketNotifier.java
@@ -49,6 +49,7 @@ import com.gitblit.manager.IRepositoryManager;
import com.gitblit.manager.IRuntimeManager;
import com.gitblit.manager.IUserManager;
import com.gitblit.models.Mailing;
+import com.gitblit.models.Owner;
import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.TicketModel;
@@ -551,11 +552,6 @@ public class TicketNotifier {
//
Set<String> ccs = new TreeSet<String>();
- // repository owners
- if (!ArrayUtils.isEmpty(repository.owners)) {
- ccs.addAll(repository.owners);
- }
-
// cc users mentioned in last comment
Change lastChange = ticket.changes.get(ticket.changes.size() - 1);
if (lastChange.hasComment()) {
@@ -573,6 +569,7 @@ public class TicketNotifier {
// TODO cc users who are watching the repository
Set<String> ccAddresses = new TreeSet<String>();
+
for (String name : ccs) {
UserModel user = userManager.getUserModel(name);
if (user != null && !user.disabled) {
@@ -588,6 +585,16 @@ public class TicketNotifier {
}
}
+ // repository owners
+ for (Owner owner : userManager.getOwners(repository)) {
+ if (owner instanceof UserModel) {
+ UserModel user = (UserModel) owner;
+ if (!StringUtils.isEmpty(user.emailAddress)) {
+ ccAddresses.add(user.emailAddress);
+ }
+ }
+ }
+
// cc repository mailing list addresses
if (!ArrayUtils.isEmpty(repository.mailingLists)) {
ccAddresses.addAll(repository.mailingLists);