RocketChat/Rocket.Chat

View on GitHub
apps/meteor/server/services/federation/infrastructure/matrix/handlers/User.ts

Summary

Maintainability
A
3 hrs
Test Coverage
import type { FederationUserServiceReceiver } from '../../../application/user/receiver/UserServiceReceiver';
import { MatrixUserReceiverConverter } from '../converters/user/UserReceiver';
import { MatrixEventType } from '../definitions/MatrixEventType';
import type { MatrixEventUserTypingStatusChanged } from '../definitions/events/UserTypingStatusChanged';
import { MatrixBaseEventHandler } from './BaseEvent';

export class MatrixUserTypingStatusChangedHandler extends MatrixBaseEventHandler {
    public eventType: string = MatrixEventType.USER_TYPING_STATUS_CHANGED;

    constructor(private userService: FederationUserServiceReceiver) {
        super();
    }

    public async handle(externalEvent: MatrixEventUserTypingStatusChanged): Promise<void> {
        await this.userService.onUserTyping(MatrixUserReceiverConverter.toUserTypingDto(externalEvent));
    }
}