mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-08 04:54:32 +00:00
fix backend type errors
This commit is contained in:
parent
7ff15816d1
commit
383633873d
9 changed files with 32 additions and 28 deletions
|
@ -243,7 +243,7 @@ export class WebhookTestService {
|
|||
break;
|
||||
}
|
||||
case 'edited': {
|
||||
send('edited', { note: toPackedNote(dummyNote1) });
|
||||
send('edited', { note: await this.toPackedNote(dummyNote1) });
|
||||
break;
|
||||
}
|
||||
case 'follow': {
|
||||
|
@ -426,6 +426,7 @@ export class WebhookTestService {
|
|||
@bindThis
|
||||
private async toPackedUserLite(user: MiUser, override?: Packed<'UserLite'>): Promise<Packed<'UserLite'>> {
|
||||
return {
|
||||
...user,
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
username: user.username,
|
||||
|
@ -445,6 +446,9 @@ export class WebhookTestService {
|
|||
emojis: await this.customEmojiService.populateEmojis(user.emojis, user.host),
|
||||
onlineStatus: 'active',
|
||||
badgeRoles: [],
|
||||
isAdmin: false,
|
||||
isModerator: false,
|
||||
isSystem: false,
|
||||
...override,
|
||||
};
|
||||
}
|
||||
|
@ -462,6 +466,9 @@ export class WebhookTestService {
|
|||
lastFetchedAt: user.lastFetchedAt?.toISOString() ?? null,
|
||||
bannerUrl: user.bannerUrl,
|
||||
bannerBlurhash: user.bannerBlurhash,
|
||||
backgroundUrl: user.backgroundUrl,
|
||||
backgroundBlurhash: user.backgroundBlurhash,
|
||||
listenbrainz: null,
|
||||
isLocked: user.isLocked,
|
||||
isSilenced: false,
|
||||
isSuspended: user.isSuspended,
|
||||
|
|
|
@ -7,8 +7,8 @@ import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
|||
import ActiveUsersChart from '@/core/chart/charts/active-users.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['notes'],
|
||||
|
@ -93,8 +93,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.leftJoinAndSelect('renote.user', 'renoteUser');
|
||||
|
||||
if (me) {
|
||||
this.queryService.generateMutedUserQuery(query, me);
|
||||
this.queryService.generateBlockedUserQuery(query, me);
|
||||
this.queryService.generateMutedUserQueryForNotes(query, me);
|
||||
this.queryService.generateBlockedUserQueryForNotes(query, me);
|
||||
this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
|
||||
}
|
||||
|
||||
|
|
|
@ -144,8 +144,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
}
|
||||
|
||||
// Respect blocks and mutes
|
||||
this.queryService.generateBlockedUserQuery(query, me);
|
||||
this.queryService.generateMutedUserQuery(query, me);
|
||||
this.queryService.generateBlockedUserQueryForNotes(query, me);
|
||||
this.queryService.generateMutedUserQueryForNotes(query, me);
|
||||
|
||||
// Support pagination
|
||||
this.queryService
|
||||
|
|
|
@ -80,8 +80,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
query.andWhere('reaction.reaction = :type', { type });
|
||||
}
|
||||
|
||||
if (me) this.queryService.generateMutedUserQuery(query, me);
|
||||
if (me) this.queryService.generateBlockedUserQuery(query, me);
|
||||
if (me) this.queryService.generateMutedUserQueryForNotes(query, me);
|
||||
if (me) this.queryService.generateBlockedUserQueryForNotes(query, me);
|
||||
|
||||
const reactions = await query.limit(ps.limit).getMany();
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
this.queryService.generateVisibilityQuery(query, me);
|
||||
if (me) {
|
||||
this.queryService.generateBlockedUserQuery(query, me);
|
||||
this.queryService.generateBlockedUserQueryForNotes(query, me);
|
||||
}
|
||||
|
||||
const note = await query.getOne();
|
||||
|
|
|
@ -56,7 +56,7 @@ export class MastodonDataService {
|
|||
// Restrict visibility
|
||||
this.queryService.generateVisibilityQuery(query, me);
|
||||
if (me) {
|
||||
this.queryService.generateBlockedUserQuery(query, me);
|
||||
this.queryService.generateBlockedUserQueryForNotes(query, me);
|
||||
}
|
||||
|
||||
return await query.getOne();
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { IsNull } from 'typeorm';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { FILE_TYPE_BROWSERSAFE } from '@/const.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { MiMeta, UsersRepository } from '@/models/_.js';
|
||||
import type { MiMeta } from '@/models/_.js';
|
||||
import { MastodonConverters } from '@/server/api/mastodon/MastodonConverters.js';
|
||||
import { MastodonClientService } from '@/server/api/mastodon/MastodonClientService.js';
|
||||
import { RoleService } from '@/core/RoleService.js';
|
||||
|
@ -21,9 +20,6 @@ export class ApiInstanceMastodon {
|
|||
@Inject(DI.meta)
|
||||
private readonly meta: MiMeta,
|
||||
|
||||
@Inject(DI.usersRepository)
|
||||
private readonly usersRepository: UsersRepository,
|
||||
|
||||
@Inject(DI.config)
|
||||
private readonly config: Config,
|
||||
|
||||
|
@ -36,19 +32,12 @@ export class ApiInstanceMastodon {
|
|||
fastify.get('/v1/instance', async (_request, reply) => {
|
||||
const { client, me } = await this.clientService.getAuthClient(_request);
|
||||
const data = await client.getInstance();
|
||||
const instance = data.data;
|
||||
const admin = await this.usersRepository.findOne({
|
||||
where: {
|
||||
host: IsNull(),
|
||||
isRoot: true,
|
||||
isDeleted: false,
|
||||
isSuspended: false,
|
||||
},
|
||||
order: { id: 'ASC' },
|
||||
});
|
||||
const contact = admin == null ? null : await this.mastoConverters.convertAccount((await client.getAccount(admin.id)).data);
|
||||
const contact = this.meta.rootUser != null
|
||||
? await this.mastoConverters.convertAccount(this.meta.rootUser)
|
||||
: null;
|
||||
const roles = await this.roleService.getUserPolicies(me?.id ?? null);
|
||||
|
||||
const instance = data.data;
|
||||
const response: MastodonEntity.Instance = {
|
||||
uri: this.config.url,
|
||||
title: this.meta.name || 'Sharkey',
|
||||
|
|
|
@ -8,6 +8,7 @@ import { bindThis } from '@/decorators.js';
|
|||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import { ChatService } from '@/core/ChatService.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
class ChatRoomChannel extends Channel {
|
||||
|
@ -22,8 +23,9 @@ class ChatRoomChannel extends Channel {
|
|||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
noteEntityService: NoteEntityService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
@ -64,6 +66,7 @@ export class ChatRoomChannelService implements MiChannelService<true> {
|
|||
|
||||
constructor(
|
||||
private chatService: ChatService,
|
||||
private readonly noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -73,6 +76,7 @@ export class ChatRoomChannelService implements MiChannelService<true> {
|
|||
this.chatService,
|
||||
id,
|
||||
connection,
|
||||
this.noteEntityService,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import { bindThis } from '@/decorators.js';
|
|||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import { ChatService } from '@/core/ChatService.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
class ChatUserChannel extends Channel {
|
||||
|
@ -22,8 +23,9 @@ class ChatUserChannel extends Channel {
|
|||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
noteEntityService: NoteEntityService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
@ -64,6 +66,7 @@ export class ChatUserChannelService implements MiChannelService<true> {
|
|||
|
||||
constructor(
|
||||
private chatService: ChatService,
|
||||
private readonly noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -73,6 +76,7 @@ export class ChatUserChannelService implements MiChannelService<true> {
|
|||
this.chatService,
|
||||
id,
|
||||
connection,
|
||||
this.noteEntityService,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue