remove no longer needed "as PackedUser/PackedNote"

This commit is contained in:
tamaina 2021-09-06 03:32:52 +09:00
parent c86ac1c6ec
commit 93fd76f841
6 changed files with 9 additions and 11 deletions

View File

@ -95,7 +95,7 @@ export class NoteRepository extends Repository<Note> {
hide = true;
} else if (meId === packedNote.userId) {
hide = false;
} else if (packedNote.reply && (meId === (packedNote.reply as PackedNote).userId)) {
} else if (packedNote.reply && (meId === packedNote.reply.userId)) {
// 自分の投稿に対するリプライ
hide = false;
} else if (packedNote.mentions && packedNote.mentions.some(id => meId === id)) {

View File

@ -43,7 +43,7 @@ export default class extends Channel {
// 関係ない返信は除外
if (note.reply) {
const reply = note.reply as PackedNote;
const reply = note.reply;
// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return;
}

View File

@ -51,7 +51,7 @@ export default class extends Channel {
// 関係ない返信は除外
if (note.reply) {
const reply = note.reply as PackedNote;
const reply = note.reply;
// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return;
}

View File

@ -4,7 +4,6 @@ import Channel from '../channel';
import { fetchMeta } from '@/misc/fetch-meta';
import { Notes } from '@/models/index';
import { PackedNote } from '@/models/repositories/note';
import { PackedUser } from '@/models/repositories/user';
import { checkWordMute } from '@/misc/check-word-mute';
import { isBlockerUserRelated } from '@/misc/is-blocker-user-related';
@ -31,7 +30,7 @@ export default class extends Channel {
if (!(
(note.channelId == null && this.user!.id === note.userId) ||
(note.channelId == null && this.following.has(note.userId)) ||
(note.channelId == null && ((note.user as PackedUser).host == null && note.visibility === 'public')) ||
(note.channelId == null && (note.user.host == null && note.visibility === 'public')) ||
(note.channelId != null && this.followingChannels.has(note.channelId))
)) return;
@ -60,7 +59,7 @@ export default class extends Channel {
// 関係ない返信は除外
if (note.reply) {
const reply = note.reply as PackedNote;
const reply = note.reply;
// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return;
}

View File

@ -4,7 +4,6 @@ import Channel from '../channel';
import { fetchMeta } from '@/misc/fetch-meta';
import { Notes } from '@/models/index';
import { PackedNote } from '@/models/repositories/note';
import { PackedUser } from '@/models/repositories/user';
import { checkWordMute } from '@/misc/check-word-mute';
import { isBlockerUserRelated } from '@/misc/is-blocker-user-related';
@ -26,7 +25,7 @@ export default class extends Channel {
@autobind
private async onNote(note: PackedNote) {
if ((note.user as PackedUser).host !== null) return;
if (note.user.host !== null) return;
if (note.visibility !== 'public') return;
if (note.channelId != null && !this.followingChannels.has(note.channelId)) return;
@ -45,7 +44,7 @@ export default class extends Channel {
// 関係ない返信は除外
if (note.reply) {
const reply = note.reply as PackedNote;
const reply = note.reply;
// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return;
}

View File

@ -165,8 +165,8 @@ export default class Connection {
};
add(note);
if (note.reply) add(note.reply as PackedNote);
if (note.renote) add(note.renote as PackedNote);
if (note.reply) add(note.reply);
if (note.renote) add(note.renote);
}
@autobind