Browse Source

fix: subscribers may not be queried

pull/679/head
cKey 3 years ago
parent
commit
f0ca79cab3
  1. 18
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs
  2. 2
      aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs

18
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs

@ -207,21 +207,9 @@ namespace LINGYUN.Abp.MessageService.Notifications
{
using (_currentTenant.Change(tenantId))
{
var userSubscriptions = new List<UserSubscribe>();
if (identifiers == null)
{
userSubscriptions = await _userSubscribeRepository
.GetUserSubscribesAsync(notificationName, null, cancellationToken);
}
else
{
userSubscriptions = await _userSubscribeRepository
.GetUserSubscribesAsync(
notificationName,
identifiers.Select(ids => ids.UserId),
cancellationToken);
}
var userIds = identifiers?.Select(ids => ids.UserId);
var userSubscriptions = await _userSubscribeRepository
.GetUserSubscribesAsync(notificationName, userIds, cancellationToken);
return _objectMapper.Map<List<UserSubscribe>, List<NotificationSubscriptionInfo>>(userSubscriptions);
}

2
aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.cs

@ -29,7 +29,7 @@ namespace LINGYUN.Abp.MessageService.Subscriptions
var userSubscribes = await (await GetDbSetAsync())
.Distinct()
.Where(x => x.NotificationName.Equals(notificationName))
.WhereIf(userIds != null, x => userIds.Contains(x.UserId))
.WhereIf(userIds?.Any() == true, x => userIds.Contains(x.UserId))
.AsNoTracking()
.ToListAsync(GetCancellationToken(cancellationToken));

Loading…
Cancel
Save