lint fixes
This commit is contained in:
parent
a2d3544a08
commit
4f20c87186
16 changed files with 124 additions and 92 deletions
|
@ -76,11 +76,13 @@ export class QueryService {
|
||||||
// 投稿の引用元の作者にブロックされていない
|
// 投稿の引用元の作者にブロックされていない
|
||||||
q
|
q
|
||||||
.andWhere(`note.userId NOT IN (${ blockingQuery.getQuery() })`)
|
.andWhere(`note.userId NOT IN (${ blockingQuery.getQuery() })`)
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.replyUserId IS NULL')
|
.where('note.replyUserId IS NULL')
|
||||||
.orWhere(`note.replyUserId NOT IN (${ blockingQuery.getQuery() })`);
|
.orWhere(`note.replyUserId NOT IN (${ blockingQuery.getQuery() })`);
|
||||||
}))
|
}))
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.renoteUserId IS NULL')
|
.where('note.renoteUserId IS NULL')
|
||||||
.orWhere(`note.renoteUserId NOT IN (${ blockingQuery.getQuery() })`);
|
.orWhere(`note.renoteUserId NOT IN (${ blockingQuery.getQuery() })`);
|
||||||
}));
|
}));
|
||||||
|
@ -112,7 +114,8 @@ export class QueryService {
|
||||||
.where('threadMuted.userId = :userId', { userId: me.id });
|
.where('threadMuted.userId = :userId', { userId: me.id });
|
||||||
|
|
||||||
q.andWhere(`note.id NOT IN (${ mutedQuery.getQuery() })`);
|
q.andWhere(`note.id NOT IN (${ mutedQuery.getQuery() })`);
|
||||||
q.andWhere(new Brackets(qb => { qb
|
q.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.threadId IS NULL')
|
.where('note.threadId IS NULL')
|
||||||
.orWhere(`note.threadId NOT IN (${ mutedQuery.getQuery() })`);
|
.orWhere(`note.threadId NOT IN (${ mutedQuery.getQuery() })`);
|
||||||
}));
|
}));
|
||||||
|
@ -139,24 +142,29 @@ export class QueryService {
|
||||||
// 投稿の引用元の作者をミュートしていない
|
// 投稿の引用元の作者をミュートしていない
|
||||||
q
|
q
|
||||||
.andWhere(`note.userId NOT IN (${ mutingQuery.getQuery() })`)
|
.andWhere(`note.userId NOT IN (${ mutingQuery.getQuery() })`)
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.replyUserId IS NULL')
|
.where('note.replyUserId IS NULL')
|
||||||
.orWhere(`note.replyUserId NOT IN (${ mutingQuery.getQuery() })`);
|
.orWhere(`note.replyUserId NOT IN (${ mutingQuery.getQuery() })`);
|
||||||
}))
|
}))
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.renoteUserId IS NULL')
|
.where('note.renoteUserId IS NULL')
|
||||||
.orWhere(`note.renoteUserId NOT IN (${ mutingQuery.getQuery() })`);
|
.orWhere(`note.renoteUserId NOT IN (${ mutingQuery.getQuery() })`);
|
||||||
}))
|
}))
|
||||||
// mute instances
|
// mute instances
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.andWhere('note.userHost IS NULL')
|
.andWhere('note.userHost IS NULL')
|
||||||
.orWhere(`NOT ((${ mutingInstanceQuery.getQuery() })::jsonb ? note.userHost)`);
|
.orWhere(`NOT ((${ mutingInstanceQuery.getQuery() })::jsonb ? note.userHost)`);
|
||||||
}))
|
}))
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.replyUserHost IS NULL')
|
.where('note.replyUserHost IS NULL')
|
||||||
.orWhere(`NOT ((${ mutingInstanceQuery.getQuery() })::jsonb ? note.replyUserHost)`);
|
.orWhere(`NOT ((${ mutingInstanceQuery.getQuery() })::jsonb ? note.replyUserHost)`);
|
||||||
}))
|
}))
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.renoteUserHost IS NULL')
|
.where('note.renoteUserHost IS NULL')
|
||||||
.orWhere(`NOT ((${ mutingInstanceQuery.getQuery() })::jsonb ? note.renoteUserHost)`);
|
.orWhere(`NOT ((${ mutingInstanceQuery.getQuery() })::jsonb ? note.renoteUserHost)`);
|
||||||
}));
|
}));
|
||||||
|
@ -180,7 +188,8 @@ export class QueryService {
|
||||||
public generateVisibilityQuery(q: SelectQueryBuilder<any>, me?: { id: MiUser['id'] } | null): void {
|
public generateVisibilityQuery(q: SelectQueryBuilder<any>, me?: { id: MiUser['id'] } | null): void {
|
||||||
// This code must always be synchronized with the checks in Notes.isVisibleForMe.
|
// This code must always be synchronized with the checks in Notes.isVisibleForMe.
|
||||||
if (me == null) {
|
if (me == null) {
|
||||||
q.andWhere(new Brackets(qb => { qb
|
q.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.visibility = \'public\'')
|
.where('note.visibility = \'public\'')
|
||||||
.orWhere('note.visibility = \'home\'');
|
.orWhere('note.visibility = \'home\'');
|
||||||
}));
|
}));
|
||||||
|
@ -189,9 +198,11 @@ export class QueryService {
|
||||||
.select('following.followeeId')
|
.select('following.followeeId')
|
||||||
.where('following.followerId = :meId');
|
.where('following.followerId = :meId');
|
||||||
|
|
||||||
q.andWhere(new Brackets(qb => { qb
|
q.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
// 公開投稿である
|
// 公開投稿である
|
||||||
.where(new Brackets(qb => { qb
|
.where(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.visibility = \'public\'')
|
.where('note.visibility = \'public\'')
|
||||||
.orWhere('note.visibility = \'home\'');
|
.orWhere('note.visibility = \'home\'');
|
||||||
}))
|
}))
|
||||||
|
@ -200,10 +211,12 @@ export class QueryService {
|
||||||
// または 自分宛て
|
// または 自分宛て
|
||||||
.orWhere(':meId = ANY(note.visibleUserIds)')
|
.orWhere(':meId = ANY(note.visibleUserIds)')
|
||||||
.orWhere(':meId = ANY(note.mentions)')
|
.orWhere(':meId = ANY(note.mentions)')
|
||||||
.orWhere(new Brackets(qb => { qb
|
.orWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
// または フォロワー宛ての投稿であり、
|
// または フォロワー宛ての投稿であり、
|
||||||
.where('note.visibility = \'followers\'')
|
.where('note.visibility = \'followers\'')
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
// 自分がフォロワーである
|
// 自分がフォロワーである
|
||||||
.where(`note.userId IN (${ followingQuery.getQuery() })`)
|
.where(`note.userId IN (${ followingQuery.getQuery() })`)
|
||||||
// または 自分の投稿へのリプライ
|
// または 自分の投稿へのリプライ
|
||||||
|
|
|
@ -33,7 +33,8 @@ export class RoleEntityService {
|
||||||
|
|
||||||
const assignedCount = await this.roleAssignmentsRepository.createQueryBuilder('assign')
|
const assignedCount = await this.roleAssignmentsRepository.createQueryBuilder('assign')
|
||||||
.where('assign.roleId = :roleId', { roleId: role.id })
|
.where('assign.roleId = :roleId', { roleId: role.id })
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('assign.expiresAt IS NULL')
|
.where('assign.expiresAt IS NULL')
|
||||||
.orWhere('assign.expiresAt > :now', { now: new Date() });
|
.orWhere('assign.expiresAt > :now', { now: new Date() });
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -379,7 +379,8 @@ export class ActivityPubServerService {
|
||||||
if (page) {
|
if (page) {
|
||||||
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), sinceId, untilId)
|
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), sinceId, untilId)
|
||||||
.andWhere('note.userId = :userId', { userId: user.id })
|
.andWhere('note.userId = :userId', { userId: user.id })
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.visibility = \'public\'')
|
.where('note.visibility = \'public\'')
|
||||||
.orWhere('note.visibility = \'home\'');
|
.orWhere('note.visibility = \'home\'');
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -61,7 +61,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
const query = this.queryService.makePaginationQuery(this.roleAssignmentsRepository.createQueryBuilder('assign'), ps.sinceId, ps.untilId)
|
const query = this.queryService.makePaginationQuery(this.roleAssignmentsRepository.createQueryBuilder('assign'), ps.sinceId, ps.untilId)
|
||||||
.andWhere('assign.roleId = :roleId', { roleId: role.id })
|
.andWhere('assign.roleId = :roleId', { roleId: role.id })
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('assign.expiresAt IS NULL')
|
.where('assign.expiresAt IS NULL')
|
||||||
.orWhere('assign.expiresAt > :now', { now: new Date() });
|
.orWhere('assign.expiresAt > :now', { now: new Date() });
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -55,7 +55,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
if (ps.query !== '') {
|
if (ps.query !== '') {
|
||||||
if (ps.type === 'nameAndDescription') {
|
if (ps.type === 'nameAndDescription') {
|
||||||
query.andWhere(new Brackets(qb => { qb
|
query.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('channel.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` })
|
.where('channel.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` })
|
||||||
.orWhere('channel.description ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` });
|
.orWhere('channel.description ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` });
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -49,11 +49,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.replyId = :noteId', { noteId: ps.noteId })
|
.where('note.replyId = :noteId', { noteId: ps.noteId })
|
||||||
.orWhere(new Brackets(qb => { qb
|
.orWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.renoteId = :noteId', { noteId: ps.noteId })
|
.where('note.renoteId = :noteId', { noteId: ps.noteId })
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('note.text IS NOT NULL')
|
.where('note.text IS NOT NULL')
|
||||||
.orWhere('note.fileIds != \'{}\'')
|
.orWhere('note.fileIds != \'{}\'')
|
||||||
.orWhere('note.hasPoll = TRUE');
|
.orWhere('note.hasPoll = TRUE');
|
||||||
|
|
|
@ -59,7 +59,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
.where('following.followerId = :followerId', { followerId: me.id });
|
.where('following.followerId = :followerId', { followerId: me.id });
|
||||||
|
|
||||||
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId)
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where(`'{"${me.id}"}' <@ note.mentions`)
|
.where(`'{"${me.id}"}' <@ note.mentions`)
|
||||||
.orWhere(`'{"${me.id}"}' <@ note.visibleUserIds`);
|
.orWhere(`'{"${me.id}"}' <@ note.visibleUserIds`);
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -57,7 +57,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
.where('poll.userHost IS NULL')
|
.where('poll.userHost IS NULL')
|
||||||
.andWhere('poll.userId != :meId', { meId: me.id })
|
.andWhere('poll.userId != :meId', { meId: me.id })
|
||||||
.andWhere('poll.noteVisibility = \'public\'')
|
.andWhere('poll.noteVisibility = \'public\'')
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('poll.expiresAt IS NULL')
|
.where('poll.expiresAt IS NULL')
|
||||||
.orWhere('poll.expiresAt > :now', { now: new Date() });
|
.orWhere('poll.expiresAt > :now', { now: new Date() });
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -62,7 +62,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
const query = this.queryService.makePaginationQuery(this.roleAssignmentsRepository.createQueryBuilder('assign'), ps.sinceId, ps.untilId)
|
const query = this.queryService.makePaginationQuery(this.roleAssignmentsRepository.createQueryBuilder('assign'), ps.sinceId, ps.untilId)
|
||||||
.andWhere('assign.roleId = :roleId', { roleId: role.id })
|
.andWhere('assign.roleId = :roleId', { roleId: role.id })
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('assign.expiresAt IS NULL')
|
.where('assign.expiresAt IS NULL')
|
||||||
.orWhere('assign.expiresAt > :now', { now: new Date() });
|
.orWhere('assign.expiresAt > :now', { now: new Date() });
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -92,7 +92,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
.andWhere(`user.id IN (${ followingQuery.getQuery() })`)
|
.andWhere(`user.id IN (${ followingQuery.getQuery() })`)
|
||||||
.andWhere('user.id != :meId', { meId: me.id })
|
.andWhere('user.id != :meId', { meId: me.id })
|
||||||
.andWhere('user.isSuspended = FALSE')
|
.andWhere('user.isSuspended = FALSE')
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('user.updatedAt IS NULL')
|
.where('user.updatedAt IS NULL')
|
||||||
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -64,7 +64,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
if (isUsername) {
|
if (isUsername) {
|
||||||
const usernameQuery = this.usersRepository.createQueryBuilder('user')
|
const usernameQuery = this.usersRepository.createQueryBuilder('user')
|
||||||
.where('user.usernameLower LIKE :username', { username: sqlLikeEscape(ps.query.replace('@', '').toLowerCase()) + '%' })
|
.where('user.usernameLower LIKE :username', { username: sqlLikeEscape(ps.query.replace('@', '').toLowerCase()) + '%' })
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('user.updatedAt IS NULL')
|
.where('user.updatedAt IS NULL')
|
||||||
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
||||||
}))
|
}))
|
||||||
|
@ -91,7 +92,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
qb.orWhere('user.usernameLower LIKE :username', { username: '%' + sqlLikeEscape(ps.query.toLowerCase()) + '%' });
|
qb.orWhere('user.usernameLower LIKE :username', { username: '%' + sqlLikeEscape(ps.query.toLowerCase()) + '%' });
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('user.updatedAt IS NULL')
|
.where('user.updatedAt IS NULL')
|
||||||
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
||||||
}))
|
}))
|
||||||
|
@ -122,7 +124,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
const query = this.usersRepository.createQueryBuilder('user')
|
const query = this.usersRepository.createQueryBuilder('user')
|
||||||
.where(`user.id IN (${ profQuery.getQuery() })`)
|
.where(`user.id IN (${ profQuery.getQuery() })`)
|
||||||
.andWhere(new Brackets(qb => { qb
|
.andWhere(new Brackets(qb => {
|
||||||
|
qb
|
||||||
.where('user.updatedAt IS NULL')
|
.where('user.updatedAt IS NULL')
|
||||||
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
.orWhere('user.updatedAt > :activeThreshold', { activeThreshold: activeThreshold });
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -2755,6 +2755,9 @@ type Notification_2 = {
|
||||||
invitation: UserGroup;
|
invitation: UserGroup;
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
|
} | {
|
||||||
|
type: 'achievementEarned';
|
||||||
|
achievement: string;
|
||||||
} | {
|
} | {
|
||||||
type: 'app';
|
type: 'app';
|
||||||
header?: string | null;
|
header?: string | null;
|
||||||
|
@ -2765,7 +2768,7 @@ type Notification_2 = {
|
||||||
});
|
});
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const notificationTypes: readonly ["note", "follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded", "receiveFollowRequest", "followRequestAccepted", "groupInvited", "app"];
|
export const notificationTypes: readonly ["note", "follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded", "receiveFollowRequest", "followRequestAccepted", "groupInvited", "app", "achievementEarned"];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type OriginType = 'combined' | 'local' | 'remote';
|
type OriginType = 'combined' | 'local' | 'remote';
|
||||||
|
@ -2981,7 +2984,7 @@ type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+u
|
||||||
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
|
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
|
||||||
// src/api.types.ts:630:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
|
// src/api.types.ts:630:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
|
||||||
// src/entities.ts:107:2 - (ae-forgotten-export) The symbol "notificationTypes_2" needs to be exported by the entry point index.d.ts
|
// src/entities.ts:107:2 - (ae-forgotten-export) The symbol "notificationTypes_2" needs to be exported by the entry point index.d.ts
|
||||||
// src/entities.ts:597:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
|
// src/entities.ts:600:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
|
||||||
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts
|
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts
|
||||||
|
|
||||||
// (No @packageDocumentation comment for this package)
|
// (No @packageDocumentation comment for this package)
|
||||||
|
|
|
@ -67,8 +67,7 @@ export class APIClient {
|
||||||
IsCaseMatched<E, P, 8> extends true ? GetCaseResult<E, P, 8> :
|
IsCaseMatched<E, P, 8> extends true ? GetCaseResult<E, P, 8> :
|
||||||
IsCaseMatched<E, P, 9> extends true ? GetCaseResult<E, P, 9> :
|
IsCaseMatched<E, P, 9> extends true ? GetCaseResult<E, P, 9> :
|
||||||
Endpoints[E]['res']['$switch']['$default']
|
Endpoints[E]['res']['$switch']['$default']
|
||||||
: Endpoints[E]['res']>
|
: Endpoints[E]['res']> {
|
||||||
{
|
|
||||||
const promise = new Promise((resolve, reject) => {
|
const promise = new Promise((resolve, reject) => {
|
||||||
this.fetch(`${this.origin}/api/${endpoint}`, {
|
this.fetch(`${this.origin}/api/${endpoint}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export const notificationTypes = ['note', 'follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app'] as const;
|
export const notificationTypes = ['note', 'follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app', 'achievementEarned'] as const;
|
||||||
|
|
||||||
export const noteVisibilities = ['public', 'home', 'followers', 'specified'] as const;
|
export const noteVisibilities = ['public', 'home', 'followers', 'specified'] as const;
|
||||||
|
|
||||||
|
|
|
@ -277,6 +277,9 @@ export type Notification = {
|
||||||
invitation: UserGroup;
|
invitation: UserGroup;
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
|
} | {
|
||||||
|
type: 'achievementEarned';
|
||||||
|
achievement: string;
|
||||||
} | {
|
} | {
|
||||||
type: 'app';
|
type: 'app';
|
||||||
header?: string | null;
|
header?: string | null;
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { getUrlWithLoginId } from '@/scripts/login-id.js';
|
||||||
export const cli = new Misskey.api.APIClient({ origin, fetch: (...args): Promise<Response> => fetch(...args) });
|
export const cli = new Misskey.api.APIClient({ origin, fetch: (...args): Promise<Response> => fetch(...args) });
|
||||||
|
|
||||||
export async function api<E extends keyof Misskey.Endpoints, O extends Misskey.Endpoints[E]['req']>(endpoint: E, userId?: string, options?: O): Promise<void | ReturnType<typeof cli.request<E, O>>> {
|
export async function api<E extends keyof Misskey.Endpoints, O extends Misskey.Endpoints[E]['req']>(endpoint: E, userId?: string, options?: O): Promise<void | ReturnType<typeof cli.request<E, O>>> {
|
||||||
let account: { token: string; id: string } | void;
|
let account: { token: string; id: string } | void = undefined;
|
||||||
|
|
||||||
if (userId) {
|
if (userId) {
|
||||||
account = await getAccountFromId(userId);
|
account = await getAccountFromId(userId);
|
||||||
|
|
Loading…
Reference in a new issue