cleanup: translate japanese, use SECOND constant

This commit is contained in:
Johann150 2023-01-02 21:07:56 +01:00
parent b423d23cf6
commit 6010884e62
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
5 changed files with 13 additions and 12 deletions

View file

@ -22,5 +22,5 @@ export default async (actor: CacheableRemoteUser, activity: IAccept): Promise<st
return 'ok: unfollowed';
}
return 'skip: フォローされていない';
return 'skip: not followed';
};

View file

@ -22,7 +22,7 @@ export const paramDef = {
} as const;
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps, me) => {
export default define(meta, paramDef, async (ps) => {
const instanceExists = await Instances.countBy({ host: toPuny(ps.host) });
if (!instanceExists) {

View file

@ -5,6 +5,7 @@ import { genId } from '@/misc/gen-id.js';
import { isUserRelated } from '@/misc/is-user-related.js';
import { publishAntennaStream, publishMainStream } from '@/services/stream.js';
import { User } from '@/models/entities/user.js';
import { SECOND } from '@/const.js';
export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: { id: User['id']; }): Promise<void> {
// If it's set to not notify the user, or if it's the user's own post, read it.
@ -49,6 +50,6 @@ export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: {
if (unread) {
publishMainStream(antenna.userId, 'unreadAntenna', antenna);
}
}, 2000);
}, 2 * SECOND);
}
}

View file

@ -166,7 +166,7 @@ export default async function(_follower: { id: User['id'] }, _followee: { id: Us
if (followee.isLocked || (followeeProfile.carefulBot && follower.isBot) || (Users.isLocalUser(follower) && Users.isRemoteUser(followee))) {
let autoAccept = false;
// 鍵アカウントであっても、既にフォローされていた場合はスルー
// Even for locked accounts, if they are already following, go through immediately.
const following = await Followings.countBy({
followerId: follower.id,
followeeId: followee.id,
@ -175,7 +175,7 @@ export default async function(_follower: { id: User['id'] }, _followee: { id: Us
autoAccept = true;
}
// フォローしているユーザーは自動承認オプション
// handle automatic approval for users that follow you, if enabled
if (!autoAccept && (Users.isLocalUser(followee) && followeeProfile.autoAcceptFollowed)) {
const followed = await Followings.countBy({
followerId: followee.id,

View file

@ -3,27 +3,27 @@ import { publishMainStream } from '@/services/stream.js';
import { User } from '@/models/entities/user.js';
import { Mutings, NoteThreadMutings, NoteUnreads } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import { SECOND } from '@/const.js';
export async function insertNoteUnread(userId: User['id'], note: Note, params: {
// NOTE: isSpecifiedがtrueならisMentionedは必ずfalse
// NOTE: if isSpecified is true, isMentioned is always false
isSpecified: boolean;
isMentioned: boolean;
}): Promise<void> {
//#region ミュートしているなら無視
// TODO: 現在の仕様ではChannelにミュートは適用されないのでよしなにケアする
//#region ignore if muted
// TODO: The current design does not apply mutes to channels.
const muted = await Mutings.countBy({
muterId: userId,
muteeId: note.userId,
});
if (muted) return;
//#endregion
const threadMuted = await NoteThreadMutings.countBy({
// スレッドミュート
userId,
threadId: note.threadId || note.id,
});
if (threadMuted) return;
//#endregion
const unread = {
id: genId(),
@ -37,7 +37,7 @@ export async function insertNoteUnread(userId: User['id'], note: Note, params: {
await NoteUnreads.insert(unread);
// 2秒経っても既読にならなかったら「未読の投稿がありますよ」イベントを発行する
// Issue the events for unread messages if it hasn't been read after 2 seconds.
setTimeout(async () => {
const exist = await NoteUnreads.countBy({ id: unread.id });
@ -52,5 +52,5 @@ export async function insertNoteUnread(userId: User['id'], note: Note, params: {
if (note.channelId) {
publishMainStream(userId, 'unreadChannel', note.id);
}
}, 2000);
}, 2 * SECOND);
}