Skip to content

Commit

Permalink
fix : Users without device IDs did not generate message records (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
wzh425 authored Aug 30, 2023
1 parent f5e9a2c commit c24ef16
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ public async Task<IEnumerable<MessageReceiverUser>> TransformUserReceivers(AppCh
private async Task<Dictionary<Guid, string>> GetUserClientIds(AppChannel channel, List<Guid> userIds)
{
var userSystemDatas = await _authClient.UserService.GetSystemListDataAsync<UserSystemData>(userIds, $"{MasaStackProject.MC.Name}:{channel.Code}");
return userSystemDatas.ToDictionary(x => x.Key, x => x.Value?.ClientId ?? string.Empty);
var userClientIds = userIds.ToDictionary(x => x, x =>
{
if (!userSystemDatas.Any(y => y.Key == x))
{
return string.Empty;
}
var userSystemData = userSystemDatas.FirstOrDefault(y => y.Key == x);
return userSystemData.Value?.ClientId ?? string.Empty;
});
return userClientIds;
}

private async Task<IEnumerable<MessageReceiverUser>> TransformDepartmentReceiversAsync(AppChannel channel, ExtraPropertyDictionary variables, IEnumerable<MessageTaskReceiver> receivers)
Expand Down

0 comments on commit c24ef16

Please sign in to comment.