Search in sources :

Example 1 with Notification

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);
}
Also used : User(amu.zhcet.data.user.User) Notification(amu.zhcet.notification.Notification)

Example 2 with Notification

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);
    });
}
Also used : NotificationRecipient(amu.zhcet.notification.recipient.NotificationRecipient) Notification(amu.zhcet.notification.Notification) Test(org.junit.Test)

Example 3 with Notification

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);
    });
}
Also used : NotificationRecipient(amu.zhcet.notification.recipient.NotificationRecipient) Notification(amu.zhcet.notification.Notification) Test(org.junit.Test)

Example 4 with Notification

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);
}
Also used : Notification(amu.zhcet.notification.Notification)

Example 5 with 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);
}
Also used : Notification(amu.zhcet.notification.Notification)

Aggregations

Notification (amu.zhcet.notification.Notification)8 Test (org.junit.Test)4 NotificationRecipient (amu.zhcet.notification.recipient.NotificationRecipient)3 User (amu.zhcet.data.user.User)2 AccessDeniedException (org.springframework.security.access.AccessDeniedException)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1