Fixed ordering for available notification delivery methods

This commit is contained in:
ViacheslavKlimov 2024-12-05 10:57:29 +02:00
parent cca4ac3629
commit b2c934a4a4
3 changed files with 5 additions and 5 deletions

View File

@ -477,7 +477,7 @@ public class NotificationController extends BaseController {
SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
@GetMapping("/notification/deliveryMethods")
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
public Set<NotificationDeliveryMethod> getAvailableDeliveryMethods(@AuthenticationPrincipal SecurityUser user) throws ThingsboardException {
public List<NotificationDeliveryMethod> getAvailableDeliveryMethods(@AuthenticationPrincipal SecurityUser user) throws ThingsboardException {
return notificationCenter.getAvailableDeliveryMethods(user.getTenantId());
}

View File

@ -417,7 +417,7 @@ public class DefaultNotificationCenter extends AbstractSubscriptionService imple
}
@Override
public Set<NotificationDeliveryMethod> getAvailableDeliveryMethods(TenantId tenantId) {
public List<NotificationDeliveryMethod> getAvailableDeliveryMethods(TenantId tenantId) {
return channels.values().stream()
.filter(channel -> {
try {
@ -428,7 +428,7 @@ public class DefaultNotificationCenter extends AbstractSubscriptionService imple
}
})
.map(NotificationChannel::getDeliveryMethod)
.collect(Collectors.toSet());
.sorted().toList();
}
@Override

View File

@ -30,7 +30,7 @@ import org.thingsboard.server.common.data.notification.info.NotificationInfo;
import org.thingsboard.server.common.data.notification.targets.platform.UsersFilter;
import org.thingsboard.server.common.data.notification.template.NotificationTemplate;
import java.util.Set;
import java.util.List;
public interface NotificationCenter {
@ -48,6 +48,6 @@ public interface NotificationCenter {
void deleteNotification(TenantId tenantId, UserId recipientId, NotificationId notificationId);
Set<NotificationDeliveryMethod> getAvailableDeliveryMethods(TenantId tenantId);
List<NotificationDeliveryMethod> getAvailableDeliveryMethods(TenantId tenantId);
}