refactor: Use ESM (#8358)

* wip

* wip

* fix

* clean up

* Update tsconfig.json

* Update activitypub.ts

* wip
This commit is contained in:
syuilo 2022-02-27 11:07:39 +09:00 committed by GitHub
parent 0a882471f3
commit d071d18dd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
737 changed files with 4135 additions and 3678 deletions

View file

@ -1,24 +1,26 @@
import autobind from 'autobind-decorator';
import { isMutedUserRelated } from '@/misc/is-muted-user-related';
import Channel from '../channel';
import { Notes } from '@/models/index';
import { checkWordMute } from '@/misc/check-word-mute';
import { isBlockerUserRelated } from '@/misc/is-blocker-user-related';
import { isInstanceMuted } from '@/misc/is-instance-muted';
import { Packed } from '@/misc/schema';
import { isMutedUserRelated } from '@/misc/is-muted-user-related.js';
import Channel from '../channel.js';
import { Notes } from '@/models/index.js';
import { checkWordMute } from '@/misc/check-word-mute.js';
import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js';
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
import { Packed } from '@/misc/schema.js';
export default class extends Channel {
public readonly chName = 'homeTimeline';
public static shouldShare = true;
public static requireCredential = true;
@autobind
constructor(id: string, connection: Channel['connection']) {
super(id, connection);
this.onNote = this.onNote.bind(this);
}
public async init(params: any) {
// Subscribe events
this.subscriber.on('notesStream', this.onNote);
}
@autobind
private async onNote(note: Packed<'Note'>) {
if (note.channelId) {
if (!this.followingChannels.has(note.channelId)) return;
@ -77,7 +79,6 @@ export default class extends Channel {
this.send('note', note);
}
@autobind
public dispose() {
// Unsubscribe events
this.subscriber.off('notesStream', this.onNote);