use of amu.zhcet.notification.Notification in project zhcet-web by zhcet-amu.
the class NotificationSendingService method completeNotificationDistribution.
private void completeNotificationDistribution(NotificationRecipient notificationRecipient) {
Notification notification = notificationRecipient.getNotification();
User user = notificationRecipient.getRecipient();
cachedNotificationService.resetUnreadCount(user.getUserId());
if (!notification.isStopEmailPropagation())
emailSendingService.sendEmailForNotification(notificationRecipient);
if (!notification.isStopFirebasePropagation())
firebaseNotificationSender.sendFirebaseNotification(notificationRecipient);
}
use of amu.zhcet.notification.Notification in project zhcet-web by zhcet-amu.
the class NotificationSendingServiceTest method saveNotificationWithoutEmailPropagation.
@Test
public void saveNotificationWithoutEmailPropagation() {
Notification notification = getNotification();
notification.setStopEmailPropagation(true);
setBehaviour();
notificationSendingService.sendNotification(notification);
List<NotificationRecipient> recipients = getRecipients();
verify(emailSendingService, never()).sendEmailForNotification(notification, userList);
recipients.forEach(notificationRecipient -> {
verify(emailSendingService, never()).sendEmailForNotification(notificationRecipient);
});
}
use of amu.zhcet.notification.Notification in project zhcet-web by zhcet-amu.
the class NotificationSendingServiceTest method saveNotificationWithoutFirebasePropagation.
@Test
public void saveNotificationWithoutFirebasePropagation() {
Notification notification = getNotification();
notification.setStopFirebasePropagation(true);
setBehaviour();
notificationSendingService.sendNotification(notification);
List<NotificationRecipient> recipients = getRecipients();
recipients.forEach(notificationRecipient -> {
verify(firebaseNotificationSender, never()).sendFirebaseNotification(notificationRecipient);
});
}
use of amu.zhcet.notification.Notification in project zhcet-web by zhcet-amu.
the class AttendanceUploadListener method sendNotification.
private void sendNotification(FacultyMember sender, Course course) {
Notification notification = fromStudent(sender, course);
notification.setLinkMessageConverter(notification1 -> LinkMessage.builder().title(notification1.getTitle()).subject(String.format("ZHCET Course %s %s", notification1.getRecipientChannel(), notification1.getTitle())).relativeLink("/dashboard/student/attendance").linkText("View Attendance").preMessage(notification1.getMessage() + "\nPlease click the button below to view your attendance").markdown(true).build());
notificationSendingService.sendNotification(notification);
}
use of amu.zhcet.notification.Notification in project zhcet-web by zhcet-amu.
the class DuplicateEmailListener method sendEmailChangeNotification.
private void sendEmailChangeNotification(User recipient, User claimant, String email) {
Notification notification = Notification.builder().automated(true).channelType(fromUser(recipient)).recipientChannel(recipient.getUserId()).sender(claimant).title("Email Claimed").message(String.format("Your previously set email **%s** is now claimed by `%s` *(%s)*.\n" + "Please change it or claim it back by verifying it", email, claimant.getName(), claimant.getUserId())).build();
notificationSendingService.sendNotification(notification);
}
Aggregations