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)
|
SYSTEM_OR_TENANT_AUTHORITY_PARAGRAPH)
|
||||||
@GetMapping("/notification/deliveryMethods")
|
@GetMapping("/notification/deliveryMethods")
|
||||||
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
|
@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());
|
return notificationCenter.getAvailableDeliveryMethods(user.getTenantId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -417,7 +417,7 @@ public class DefaultNotificationCenter extends AbstractSubscriptionService imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<NotificationDeliveryMethod> getAvailableDeliveryMethods(TenantId tenantId) {
|
public List<NotificationDeliveryMethod> getAvailableDeliveryMethods(TenantId tenantId) {
|
||||||
return channels.values().stream()
|
return channels.values().stream()
|
||||||
.filter(channel -> {
|
.filter(channel -> {
|
||||||
try {
|
try {
|
||||||
@ -428,7 +428,7 @@ public class DefaultNotificationCenter extends AbstractSubscriptionService imple
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.map(NotificationChannel::getDeliveryMethod)
|
.map(NotificationChannel::getDeliveryMethod)
|
||||||
.collect(Collectors.toSet());
|
.sorted().toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.targets.platform.UsersFilter;
|
||||||
import org.thingsboard.server.common.data.notification.template.NotificationTemplate;
|
import org.thingsboard.server.common.data.notification.template.NotificationTemplate;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
|
|
||||||
public interface NotificationCenter {
|
public interface NotificationCenter {
|
||||||
|
|
||||||
@ -48,6 +48,6 @@ public interface NotificationCenter {
|
|||||||
|
|
||||||
void deleteNotification(TenantId tenantId, UserId recipientId, NotificationId notificationId);
|
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