mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-03 23:16:28 +09:00
refactor: remove duplicate code (#8895)
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import Channel from '../channel.js';
|
||||
import { Notes } from '@/models/index.js';
|
||||
import { isMutedUserRelated } from '@/misc/is-muted-user-related.js';
|
||||
import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js';
|
||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { StreamMessages } from '../types.js';
|
||||
|
||||
export default class extends Channel {
|
||||
@ -27,9 +26,9 @@ export default class extends Channel {
|
||||
const note = await Notes.pack(data.body.id, this.user, { detail: true });
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isMutedUserRelated(note, this.muting)) return;
|
||||
if (isUserRelated(note, this.muting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isBlockerUserRelated(note, this.blocking)) return;
|
||||
if (isUserRelated(note, this.blocking)) return;
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Channel from '../channel.js';
|
||||
import { Notes, Users } from '@/models/index.js';
|
||||
import { isMutedUserRelated } from '@/misc/is-muted-user-related.js';
|
||||
import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js';
|
||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { StreamMessages } from '../types.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
@ -45,9 +44,9 @@ export default class extends Channel {
|
||||
}
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isMutedUserRelated(note, this.muting)) return;
|
||||
if (isUserRelated(note, this.muting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isBlockerUserRelated(note, this.blocking)) return;
|
||||
if (isUserRelated(note, this.blocking)) return;
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { isMutedUserRelated } from '@/misc/is-muted-user-related.js';
|
||||
import Channel from '../channel.js';
|
||||
import { fetchMeta } from '@/misc/fetch-meta.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 { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
|
||||
export default class extends Channel {
|
||||
@ -55,9 +54,9 @@ export default class extends Channel {
|
||||
if (isInstanceMuted(note, new Set<string>(this.userProfile?.mutedInstances ?? []))) return;
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isMutedUserRelated(note, this.muting)) return;
|
||||
if (isUserRelated(note, this.muting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isBlockerUserRelated(note, this.blocking)) return;
|
||||
if (isUserRelated(note, this.blocking)) return;
|
||||
|
||||
// 流れてきたNoteがミュートすべきNoteだったら無視する
|
||||
// TODO: 将来的には、単にMutedNoteテーブルにレコードがあるかどうかで判定したい(以下の理由により難しそうではある)
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { isMutedUserRelated } from '@/misc/is-muted-user-related.js';
|
||||
import Channel from '../channel.js';
|
||||
import { Notes } from '@/models/index.js';
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||
import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js';
|
||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
|
||||
export default class extends Channel {
|
||||
@ -38,9 +37,9 @@ export default class extends Channel {
|
||||
}
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isMutedUserRelated(note, this.muting)) return;
|
||||
if (isUserRelated(note, this.muting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isBlockerUserRelated(note, this.blocking)) return;
|
||||
if (isUserRelated(note, this.blocking)) return;
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
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 { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
|
||||
@ -63,9 +62,9 @@ export default class extends Channel {
|
||||
}
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isMutedUserRelated(note, this.muting)) return;
|
||||
if (isUserRelated(note, this.muting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isBlockerUserRelated(note, this.blocking)) return;
|
||||
if (isUserRelated(note, this.blocking)) return;
|
||||
|
||||
// 流れてきたNoteがミュートすべきNoteだったら無視する
|
||||
// TODO: 将来的には、単にMutedNoteテーブルにレコードがあるかどうかで判定したい(以下の理由により難しそうではある)
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { isMutedUserRelated } from '@/misc/is-muted-user-related.js';
|
||||
import Channel from '../channel.js';
|
||||
import { fetchMeta } from '@/misc/fetch-meta.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 { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
|
||||
@ -71,9 +70,9 @@ export default class extends Channel {
|
||||
}
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isMutedUserRelated(note, this.muting)) return;
|
||||
if (isUserRelated(note, this.muting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isBlockerUserRelated(note, this.blocking)) return;
|
||||
if (isUserRelated(note, this.blocking)) return;
|
||||
|
||||
// 流れてきたNoteがミュートすべきNoteだったら無視する
|
||||
// TODO: 将来的には、単にMutedNoteテーブルにレコードがあるかどうかで判定したい(以下の理由により難しそうではある)
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { isMutedUserRelated } from '@/misc/is-muted-user-related.js';
|
||||
import Channel from '../channel.js';
|
||||
import { fetchMeta } from '@/misc/fetch-meta.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 { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
|
||||
export default class extends Channel {
|
||||
@ -52,9 +51,9 @@ export default class extends Channel {
|
||||
}
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isMutedUserRelated(note, this.muting)) return;
|
||||
if (iUserRelated(note, this.muting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isBlockerUserRelated(note, this.blocking)) return;
|
||||
if (isUserRelated(note, this.blocking)) return;
|
||||
|
||||
// 流れてきたNoteがミュートすべきNoteだったら無視する
|
||||
// TODO: 将来的には、単にMutedNoteテーブルにレコードがあるかどうかで判定したい(以下の理由により難しそうではある)
|
||||
|
@ -1,8 +1,7 @@
|
||||
import Channel from '../channel.js';
|
||||
import { Notes, UserListJoinings, UserLists } from '@/models/index.js';
|
||||
import { isMutedUserRelated } from '@/misc/is-muted-user-related.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { isBlockerUserRelated } from '@/misc/is-blocker-user-related.js';
|
||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
|
||||
export default class extends Channel {
|
||||
@ -76,9 +75,9 @@ export default class extends Channel {
|
||||
}
|
||||
|
||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||
if (isMutedUserRelated(note, this.muting)) return;
|
||||
if (isUserRelated(note, this.muting)) return;
|
||||
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
|
||||
if (isBlockerUserRelated(note, this.blocking)) return;
|
||||
if (isUserRelated(note, this.blocking)) return;
|
||||
|
||||
this.send('note', note);
|
||||
}
|
||||
|
Reference in New Issue
Block a user