Browse Source
Merge pull request #12196 from thingsboard/fix/notification-settings
Fixed ordering for available notification delivery methods
pull/12198/head
Viacheslav Klimov
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
5 additions and
5 deletions
-
application/src/main/java/org/thingsboard/server/controller/NotificationController.java
-
application/src/main/java/org/thingsboard/server/service/notification/DefaultNotificationCenter.java
-
rule-engine/rule-engine-api/src/main/java/org/thingsboard/rule/engine/api/NotificationCenter.java
|
|
@ -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); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|