Fixed ordering for available notification delivery methods
This commit is contained in:
		
							parent
							
								
									cca4ac3629
								
							
						
					
					
						commit
						b2c934a4a4
					
				@ -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());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user