Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 private async Task SendChannelMessageItemChangedNotificationAsync(int channelId, int messageId, MessageChangeType type)
 {
     var userIds = (await _channelQueryService.GetAllChannelUserIdsAsync(channelId)).ToList();
     await _notificationService.SendChannelMessageItemChangedNotificationAsync(userIds, channelId, type, messageId);
 }