public async Task <IActionResult> LeaveChannelAsync([FromBody] int channelId) { await _channelCommandService.RemoveUserFromChannelAsync(channelId, User.GetUserId()); var allChannelUserIds = await _channelQueryService.GetAllChannelUserIdsAsync(channelId); await _notificationService.SendChannelUserListChangedNotificationAsync(allChannelUserIds, channelId); return(Ok()); }
public async Task NotifyTypingAsync(int channelId, int currentUserId, bool isFinished) { var currentUser = await _userQueryService.GetUserByIdAsync(currentUserId); if (currentUser == null) { return; } var userIds = (await _channelQueryService.GetAllChannelUserIdsAsync(channelId)).ToList(); userIds.Remove(currentUserId); if (isFinished) { await _notificationService.SendUserFinishedTypingNotificationAsync(userIds, currentUser.DisplayName, true, channelId); } else { await _notificationService.SendUserTypingNotificationAsync(userIds, currentUser.DisplayName, true, channelId); } }
private async Task SendChannelMessageItemChangedNotificationAsync(int channelId, int messageId, MessageChangeType type) { var userIds = (await _channelQueryService.GetAllChannelUserIdsAsync(channelId)).ToList(); await _notificationService.SendChannelMessageItemChangedNotificationAsync(userIds, channelId, type, messageId); }