public async Task <int> InviteOtherMembersToConversationAsync(int conversationId, List <int> userIds, int invitedByUserId, int workspaceId) { if (userIds == null || userIds.Count < 1) { throw new ArgumentException("Invalid users"); } if (!_conversationQueryService.IsUserInConversation(conversationId, invitedByUserId)) { throw new ArgumentException($"User is not in conversation."); } var memberIds = (await _conversationQueryService.GetAllConversationUserIdsAsync(conversationId)).ToList(); memberIds.AddRange(userIds); var existingConversationId = GetConversationIdIfExists(memberIds, workspaceId); if (existingConversationId != null) { return(existingConversationId.Value); } await AddUsersToConversation(userIds, conversationId); await _messageCommandService.PostJoinConversationSystemMessageAsync(conversationId, userIds, invitedByUserId, workspaceId); return(conversationId); }
private async Task SendConversationMessageItemChangedNotificationAsync(int conversationId, int messageId, MessageChangeType type) { var userIds = (await _conversationQueryService.GetAllConversationUserIdsAsync(conversationId)).ToList(); await _notificationService.SendConversationMessageItemChangedNotificationAsync(userIds, conversationId, type, messageId); }
public async Task <ActionResult <IEnumerable <int> > > GetAllConversationUserIdsAsync(int id) { var userIds = await _conversationQueryService.GetAllConversationUserIdsAsync(id); return(userIds.ToList()); }