Merge tag '2023.12.0-beta.3' into merge-upstream
This commit is contained in:
commit
e77ddfce91
423 changed files with 42868 additions and 10814 deletions
|
|
@ -34,3 +34,7 @@ export function parseAid(id: string): { date: Date; } {
|
|||
const time = parseInt(id.slice(0, 8), 36) + TIME2000;
|
||||
return { date: new Date(time) };
|
||||
}
|
||||
|
||||
export function isSafeAidT(t: number): boolean {
|
||||
return t > TIME2000;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,3 +41,7 @@ export function parseAidx(id: string): { date: Date; } {
|
|||
const time = parseInt(id.slice(0, TIME_LENGTH), 36) + TIME2000;
|
||||
return { date: new Date(time) };
|
||||
}
|
||||
|
||||
export function isSafeAidxT(t: number): boolean {
|
||||
return t > TIME2000;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,3 +38,7 @@ export function parseMeid(id: string): { date: Date; } {
|
|||
date: new Date(parseInt(id.slice(0, 12), 16) - 0x800000000000),
|
||||
};
|
||||
}
|
||||
|
||||
export function isSafeMeidT(t: number): boolean {
|
||||
return t > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,3 +38,7 @@ export function parseMeidg(id: string): { date: Date; } {
|
|||
date: new Date(parseInt(id.slice(1, 12), 16)),
|
||||
};
|
||||
}
|
||||
|
||||
export function isSafeMeidgT(t: number): boolean {
|
||||
return t > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,3 +38,7 @@ export function parseObjectId(id: string): { date: Date; } {
|
|||
date: new Date(parseInt(id.slice(0, 8), 16) * 1000),
|
||||
};
|
||||
}
|
||||
|
||||
export function isSafeObjectIdT(t: number): boolean {
|
||||
return t > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { MiNote } from '@/models/Note.js';
|
||||
import type { Packed } from './json-schema.js';
|
||||
|
||||
export function isInstanceMuted(note: Packed<'Note'>, mutedInstances: Set<string>): boolean {
|
||||
if (mutedInstances.has(note.user.host ?? '')) return true;
|
||||
if (mutedInstances.has(note.reply?.user.host ?? '')) return true;
|
||||
if (mutedInstances.has(note.renote?.user.host ?? '')) return true;
|
||||
export function isInstanceMuted(note: Packed<'Note'> | MiNote, mutedInstances: Set<string>): boolean {
|
||||
if (mutedInstances.has(note.user?.host ?? '')) return true;
|
||||
if (mutedInstances.has(note.reply?.user?.host ?? '')) return true;
|
||||
if (mutedInstances.has(note.renote?.user?.host ?? '')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
10
packages/backend/src/misc/is-reply.ts
Normal file
10
packages/backend/src/misc/is-reply.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { MiUser } from '@/models/User.js';
|
||||
|
||||
export function isReply(note: any, viewerId?: MiUser['id'] | undefined | null): boolean {
|
||||
return note.replyId && note.replyUserId !== note.userId && note.replyUserId !== viewerId;
|
||||
}
|
||||
|
|
@ -36,9 +36,10 @@ import { packedPageLikeSchema, packedPageSchema } from '@/models/json-schema/pag
|
|||
import { packedQueueCountSchema } from '@/models/json-schema/queue.js';
|
||||
import { packedEmojiDetailedSchema, packedEmojiSimpleSchema } from '@/models/json-schema/emoji.js';
|
||||
import { packedRenoteMutingSchema } from '@/models/json-schema/renote-muting.js';
|
||||
import { packedRoleSchema } from '@/models/json-schema/role.js';
|
||||
import { packedUserListMembershipSchema, packedUserListSchema } from '@/models/json-schema/user-list.js';
|
||||
import { packedAnnouncementSchema } from '@/models/json-schema/announcement.js';
|
||||
import { packedSigninSchema } from '@/models/json-schema/signin.js';
|
||||
import { packedRoleLiteSchema, packedRoleSchema } from '@/models/json-schema/role.js';
|
||||
|
||||
export const refs = {
|
||||
UserLite: packedUserLiteSchema,
|
||||
|
|
@ -80,6 +81,8 @@ export const refs = {
|
|||
Flash: packedFlashSchema,
|
||||
FlashLike: packedFlashLikeSchema,
|
||||
|
||||
Signin: packedSigninSchema,
|
||||
RoleLite: packedRoleLiteSchema,
|
||||
Role: packedRoleSchema,
|
||||
AbuseUserReport: packedAbuseUserReportSchema,
|
||||
ModerationLog: packedModerationLogSchema,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue