mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-12-22 08:20:10 +00:00
correct name of SkLatestNote
This commit is contained in:
parent
b15f25758a
commit
fea993f6b2
7 changed files with 16 additions and 16 deletions
|
@ -14,7 +14,7 @@ import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mf
|
||||||
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
||||||
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
||||||
import { MiNote } from '@/models/Note.js';
|
import { MiNote } from '@/models/Note.js';
|
||||||
import { LatestNote } from '@/models/LatestNote.js';
|
import { SkLatestNote } from '@/models/LatestNote.js';
|
||||||
import type { ChannelFollowingsRepository, ChannelsRepository, FollowingsRepository, InstancesRepository, LatestNotesRepository, MiFollowing, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserListMembershipsRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
import type { ChannelFollowingsRepository, ChannelsRepository, FollowingsRepository, InstancesRepository, LatestNotesRepository, MiFollowing, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserListMembershipsRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
||||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||||
import type { MiApp } from '@/models/App.js';
|
import type { MiApp } from '@/models/App.js';
|
||||||
|
@ -1159,7 +1159,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
if (currentLatest != null && currentLatest.noteId >= note.id) return;
|
if (currentLatest != null && currentLatest.noteId >= note.id) return;
|
||||||
|
|
||||||
// Record this as the latest note for the given user
|
// Record this as the latest note for the given user
|
||||||
const latestNote = new LatestNote({
|
const latestNote = new SkLatestNote({
|
||||||
userId: note.userId,
|
userId: note.userId,
|
||||||
noteId: note.id,
|
noteId: note.id,
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { Brackets, In, Not } from 'typeorm';
|
||||||
import { Injectable, Inject } from '@nestjs/common';
|
import { Injectable, Inject } from '@nestjs/common';
|
||||||
import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/User.js';
|
import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/User.js';
|
||||||
import type { MiNote, IMentionedRemoteUsers } from '@/models/Note.js';
|
import type { MiNote, IMentionedRemoteUsers } from '@/models/Note.js';
|
||||||
import { LatestNote } from '@/models/LatestNote.js';
|
import { SkLatestNote } from '@/models/LatestNote.js';
|
||||||
import type { InstancesRepository, LatestNotesRepository, NotesRepository, UsersRepository } from '@/models/_.js';
|
import type { InstancesRepository, LatestNotesRepository, NotesRepository, UsersRepository } from '@/models/_.js';
|
||||||
import { RelayService } from '@/core/RelayService.js';
|
import { RelayService } from '@/core/RelayService.js';
|
||||||
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||||
|
@ -268,7 +268,7 @@ export class NoteDeleteService {
|
||||||
if (!nextLatest) return;
|
if (!nextLatest) return;
|
||||||
|
|
||||||
// Record it as the latest
|
// Record it as the latest
|
||||||
const latestNote = new LatestNote({
|
const latestNote = new SkLatestNote({
|
||||||
userId: note.userId,
|
userId: note.userId,
|
||||||
noteId: nextLatest.id,
|
noteId: nextLatest.id,
|
||||||
});
|
});
|
||||||
|
@ -278,7 +278,7 @@ export class NoteDeleteService {
|
||||||
await this.latestNotesRepository
|
await this.latestNotesRepository
|
||||||
.createQueryBuilder('latest')
|
.createQueryBuilder('latest')
|
||||||
.insert()
|
.insert()
|
||||||
.into(LatestNote)
|
.into(SkLatestNote)
|
||||||
.values(latestNote)
|
.values(latestNote)
|
||||||
.orIgnore()
|
.orIgnore()
|
||||||
.execute();
|
.execute();
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { MiNote } from '@/models/Note.js';
|
||||||
* DMs are not counted.
|
* DMs are not counted.
|
||||||
*/
|
*/
|
||||||
@Entity('latest_note')
|
@Entity('latest_note')
|
||||||
export class LatestNote {
|
export class SkLatestNote {
|
||||||
@PrimaryColumn({
|
@PrimaryColumn({
|
||||||
name: 'user_id',
|
name: 'user_id',
|
||||||
type: 'varchar' as const,
|
type: 'varchar' as const,
|
||||||
|
@ -44,7 +44,7 @@ export class LatestNote {
|
||||||
})
|
})
|
||||||
public note: MiNote | null;
|
public note: MiNote | null;
|
||||||
|
|
||||||
constructor(data?: Partial<LatestNote>) {
|
constructor(data?: Partial<SkLatestNote>) {
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
|
||||||
for (const [k, v] of Object.entries(data)) {
|
for (const [k, v] of Object.entries(data)) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import type { Provider } from '@nestjs/common';
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import {
|
import {
|
||||||
LatestNote,
|
SkLatestNote,
|
||||||
MiAbuseReportNotificationRecipient,
|
MiAbuseReportNotificationRecipient,
|
||||||
MiAbuseUserReport,
|
MiAbuseUserReport,
|
||||||
MiAccessToken,
|
MiAccessToken,
|
||||||
|
@ -121,7 +121,7 @@ const $avatarDecorationsRepository: Provider = {
|
||||||
|
|
||||||
const $latestNotesRepository: Provider = {
|
const $latestNotesRepository: Provider = {
|
||||||
provide: DI.latestNotesRepository,
|
provide: DI.latestNotesRepository,
|
||||||
useFactory: (db: DataSource) => db.getRepository(LatestNote).extend(miRepository as MiRepository<LatestNote>),
|
useFactory: (db: DataSource) => db.getRepository(SkLatestNote).extend(miRepository as MiRepository<SkLatestNote>),
|
||||||
inject: [DI.db],
|
inject: [DI.db],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { RelationIdLoader } from 'typeorm/query-builder/relation-id/RelationIdLo
|
||||||
import { RawSqlResultsToEntityTransformer } from 'typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js';
|
import { RawSqlResultsToEntityTransformer } from 'typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js';
|
||||||
import { ObjectUtils } from 'typeorm/util/ObjectUtils.js';
|
import { ObjectUtils } from 'typeorm/util/ObjectUtils.js';
|
||||||
import { OrmUtils } from 'typeorm/util/OrmUtils.js';
|
import { OrmUtils } from 'typeorm/util/OrmUtils.js';
|
||||||
import { LatestNote } from '@/models/LatestNote.js';
|
import { SkLatestNote } from '@/models/LatestNote.js';
|
||||||
import { MiAbuseUserReport } from '@/models/AbuseUserReport.js';
|
import { MiAbuseUserReport } from '@/models/AbuseUserReport.js';
|
||||||
import { MiAbuseReportNotificationRecipient } from '@/models/AbuseReportNotificationRecipient.js';
|
import { MiAbuseReportNotificationRecipient } from '@/models/AbuseReportNotificationRecipient.js';
|
||||||
import { MiAccessToken } from '@/models/AccessToken.js';
|
import { MiAccessToken } from '@/models/AccessToken.js';
|
||||||
|
@ -127,7 +127,7 @@ export const miRepository = {
|
||||||
} satisfies MiRepository<ObjectLiteral>;
|
} satisfies MiRepository<ObjectLiteral>;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
LatestNote,
|
SkLatestNote,
|
||||||
MiAbuseUserReport,
|
MiAbuseUserReport,
|
||||||
MiAbuseReportNotificationRecipient,
|
MiAbuseReportNotificationRecipient,
|
||||||
MiAccessToken,
|
MiAccessToken,
|
||||||
|
@ -226,7 +226,7 @@ export type GalleryPostsRepository = Repository<MiGalleryPost> & MiRepository<Mi
|
||||||
export type HashtagsRepository = Repository<MiHashtag> & MiRepository<MiHashtag>;
|
export type HashtagsRepository = Repository<MiHashtag> & MiRepository<MiHashtag>;
|
||||||
export type InstancesRepository = Repository<MiInstance> & MiRepository<MiInstance>;
|
export type InstancesRepository = Repository<MiInstance> & MiRepository<MiInstance>;
|
||||||
export type MetasRepository = Repository<MiMeta> & MiRepository<MiMeta>;
|
export type MetasRepository = Repository<MiMeta> & MiRepository<MiMeta>;
|
||||||
export type LatestNotesRepository = Repository<LatestNote> & MiRepository<LatestNote>;
|
export type LatestNotesRepository = Repository<SkLatestNote> & MiRepository<SkLatestNote>;
|
||||||
export type ModerationLogsRepository = Repository<MiModerationLog> & MiRepository<MiModerationLog>;
|
export type ModerationLogsRepository = Repository<MiModerationLog> & MiRepository<MiModerationLog>;
|
||||||
export type MutingsRepository = Repository<MiMuting> & MiRepository<MiMuting>;
|
export type MutingsRepository = Repository<MiMuting> & MiRepository<MiMuting>;
|
||||||
export type RenoteMutingsRepository = Repository<MiRenoteMuting> & MiRepository<MiRenoteMuting>;
|
export type RenoteMutingsRepository = Repository<MiRenoteMuting> & MiRepository<MiRenoteMuting>;
|
||||||
|
|
|
@ -83,7 +83,7 @@ import { MiReversiGame } from '@/models/ReversiGame.js';
|
||||||
import { Config } from '@/config.js';
|
import { Config } from '@/config.js';
|
||||||
import MisskeyLogger from '@/logger.js';
|
import MisskeyLogger from '@/logger.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { LatestNote } from '@/models/LatestNote.js';
|
import { SkLatestNote } from '@/models/LatestNote.js';
|
||||||
|
|
||||||
pg.types.setTypeParser(20, Number);
|
pg.types.setTypeParser(20, Number);
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class MyCustomLogger implements Logger {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const entities = [
|
export const entities = [
|
||||||
LatestNote,
|
SkLatestNote,
|
||||||
MiAnnouncement,
|
MiAnnouncement,
|
||||||
MiAnnouncementRead,
|
MiAnnouncementRead,
|
||||||
MiMeta,
|
MiMeta,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { LatestNote, MiFollowing } from '@/models/_.js';
|
import { SkLatestNote, MiFollowing } from '@/models/_.js';
|
||||||
import type { NotesRepository } from '@/models/_.js';
|
import type { NotesRepository } from '@/models/_.js';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
|
@ -57,7 +57,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
.setParameter('me', me.id)
|
.setParameter('me', me.id)
|
||||||
|
|
||||||
// Limit to latest notes
|
// Limit to latest notes
|
||||||
.innerJoin(LatestNote, 'latest', 'note.id = latest.note_id')
|
.innerJoin(SkLatestNote, 'latest', 'note.id = latest.note_id')
|
||||||
|
|
||||||
// Avoid N+1 queries from the "pack" method
|
// Avoid N+1 queries from the "pack" method
|
||||||
.innerJoinAndSelect('note.user', 'user')
|
.innerJoinAndSelect('note.user', 'user')
|
||||||
|
|
Loading…
Reference in a new issue