diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2021-02-20 20:20:05 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2021-02-20 20:20:05 +0900 |
| commit | 25d37302a8bfda954c7ede1e9d355db587c82228 (patch) | |
| tree | 8d2eff01cc738a84776976d36cabc8a143b40798 /src/server/api/stream/index.ts | |
| parent | Improve usability (diff) | |
| download | sharkey-25d37302a8bfda954c7ede1e9d355db587c82228.tar.gz sharkey-25d37302a8bfda954c7ede1e9d355db587c82228.tar.bz2 sharkey-25d37302a8bfda954c7ede1e9d355db587c82228.zip | |
チャンネルで入力中ユーザーを表示するように、Chat UIでタイムラインでは投稿フォームを上に表示するように
Diffstat (limited to 'src/server/api/stream/index.ts')
| -rw-r--r-- | src/server/api/stream/index.ts | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index 5b975d07db..b04bed0c06 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -12,6 +12,7 @@ import { Users, Followings, Mutings, UserProfiles, ChannelFollowings } from '../ import { ApiError } from '../error'; import { AccessToken } from '../../../models/entities/access-token'; import { UserProfile } from '../../../models/entities/user-profile'; +import { publishChannelStream } from '../../../services/stream'; /** * Main stream connection @@ -27,10 +28,10 @@ export default class Connection { public subscriber: EventEmitter; private channels: Channel[] = []; private subscribingNotes: any = {}; - private followingClock: NodeJS.Timer; - private mutingClock: NodeJS.Timer; - private followingChannelsClock: NodeJS.Timer; - private userProfileClock: NodeJS.Timer; + private followingClock: ReturnType<typeof setInterval>; + private mutingClock: ReturnType<typeof setInterval>; + private followingChannelsClock: ReturnType<typeof setInterval>; + private userProfileClock: ReturnType<typeof setInterval>; constructor( wsConnection: websocket.connection, @@ -93,6 +94,7 @@ export default class Connection { case 'disconnect': this.onChannelDisconnectRequested(body); break; case 'channel': this.onChannelMessageRequested(body); break; case 'ch': this.onChannelMessageRequested(body); break; // alias + case 'typingOnChannel': this.typingOnChannel(body.channel); break; } } @@ -259,6 +261,13 @@ export default class Connection { } @autobind + private typingOnChannel(channel: ChannelModel['id']) { + if (this.user) { + publishChannelStream(channel, 'typing', this.user.id); + } + } + + @autobind private async updateFollowing() { const followings = await Followings.find({ where: { |