mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-21 01:21:54 +08:00
send different notification for partial approval
Signed-off-by: MiniDigger <admin@minidigger.me>
This commit is contained in:
parent
0e26eed9b5
commit
53a1b288d7
@ -359,6 +359,7 @@ const msgs: LocaleMessageObject = {
|
||||
},
|
||||
project: {
|
||||
reviewed: '{0} {1} has been reviewed and is approved',
|
||||
reviewedPartial: '{0} {1} has been reviewed and is partially approved',
|
||||
},
|
||||
},
|
||||
visibility: {
|
||||
|
@ -5,5 +5,6 @@ public enum NotificationType {
|
||||
PROJECT_INVITE,
|
||||
ORGANIZATION_INVITE,
|
||||
NEW_PROJECT_VERSION,
|
||||
VERSION_REVIEWED
|
||||
VERSION_REVIEWED,
|
||||
VERSION_REVIEWED_PARTIAL,
|
||||
}
|
||||
|
@ -58,12 +58,18 @@ public class NotificationService extends HangarService {
|
||||
notificationsDAO.insert(notificationTables);
|
||||
}
|
||||
|
||||
public void notifyUsersVersionReviewed(ProjectVersionTable projectVersionTable) {
|
||||
public void notifyUsersVersionReviewed(ProjectVersionTable projectVersionTable, boolean partial) {
|
||||
List<NotificationTable> notificationTables = new ArrayList<>();
|
||||
ProjectTable projectTable = projectsDAO.getById(projectVersionTable.getProjectId());
|
||||
permissionService.getProjectMemberPermissions(projectVersionTable.getProjectId()).forEach((user, perm) -> {
|
||||
if (perm.has(Permission.EditVersion)) {
|
||||
notificationTables.add(new NotificationTable(user.getId(), NotificationType.VERSION_REVIEWED, null, null, new String[]{"notifications.project.reviewed", projectTable.getSlug(), projectVersionTable.getVersionString()}));
|
||||
if (partial) {
|
||||
notificationTables.add(new NotificationTable(user.getId(), NotificationType.VERSION_REVIEWED_PARTIAL, null, null,
|
||||
new String[]{"notifications.project.reviewedPartial", projectTable.getSlug(), projectVersionTable.getVersionString()}));
|
||||
} else {
|
||||
notificationTables.add(new NotificationTable(user.getId(), NotificationType.VERSION_REVIEWED, null, null,
|
||||
new String[]{"notifications.project.reviewed", projectTable.getSlug(), projectVersionTable.getVersionString()}));
|
||||
}
|
||||
}
|
||||
});
|
||||
notificationsDAO.insert(notificationTables);
|
||||
|
@ -98,7 +98,7 @@ public class ReviewService extends HangarService {
|
||||
projectVersionReviewsDAO.insertMessage(new ProjectVersionReviewMessageTable(latestUnfinishedReview.getId(), msg.getMessage(), new JSONB(msg.getArgs()), reviewAction));
|
||||
projectVersionReviewsDAO.update(latestUnfinishedReview);
|
||||
ProjectVersionTable projectVersionTable = projectVersionsDAO.getProjectVersionTable(versionId);
|
||||
notificationService.notifyUsersVersionReviewed(projectVersionTable);
|
||||
notificationService.notifyUsersVersionReviewed(projectVersionTable, reviewAction == ReviewAction.PARTIALLY_APPROVE);
|
||||
}
|
||||
|
||||
public void undoApproval(long versionId, ReviewMessage msg) {
|
||||
|
Loading…
Reference in New Issue
Block a user