Browse Source
Merge pull request #679 from colinin/Fix-User-Subscribers
fix: subscribers may not be queried
pull/712/head
yx lin
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
16 deletions
-
aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs
-
aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Subscriptions/EfCoreUserSubscribeRepository.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); |
|
|
|
} |
|
|
|
|
|
|
|
@ -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)); |
|
|
|
|
|
|
|
|