Add event to AP publishing
This commit is contained in:
parent
b515673cbd
commit
4df0407a28
|
@ -19,7 +19,7 @@ import { MfmService } from '@/core/MfmService.js';
|
|||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
||||
import type { UserKeypair } from '@/models/entities/UserKeypair.js';
|
||||
import type { UsersRepository, UserProfilesRepository, NotesRepository, DriveFilesRepository, EmojisRepository, PollsRepository } from '@/models/index.js';
|
||||
import type { UsersRepository, UserProfilesRepository, NotesRepository, DriveFilesRepository, EmojisRepository, PollsRepository, EventsRepository } from '@/models/index.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||
import { isNotNull } from '@/misc/is-not-null.js';
|
||||
|
@ -52,6 +52,9 @@ export class ApRendererService {
|
|||
@Inject(DI.pollsRepository)
|
||||
private pollsRepository: PollsRepository,
|
||||
|
||||
@Inject(DI.eventsRepository)
|
||||
private eventsRepository: EventsRepository,
|
||||
|
||||
private customEmojiService: CustomEmojiService,
|
||||
private userEntityService: UserEntityService,
|
||||
private driveFileEntityService: DriveFileEntityService,
|
||||
|
@ -424,6 +427,17 @@ export class ApRendererService {
|
|||
})),
|
||||
} as const : {};
|
||||
|
||||
let asEvent = {};
|
||||
if (note.hasEvent) {
|
||||
const event = await this.eventsRepository.findOneBy({ noteId: note.id });
|
||||
asEvent = event ? {
|
||||
type: 'Event',
|
||||
name: event.title,
|
||||
startTime: event.start,
|
||||
endTime: event.end,
|
||||
} as const : {};
|
||||
}
|
||||
|
||||
return {
|
||||
id: `${this.config.url}/notes/${note.id}`,
|
||||
type: 'Note',
|
||||
|
@ -444,6 +458,7 @@ export class ApRendererService {
|
|||
attachment: files.map(x => this.renderDocument(x)),
|
||||
sensitive: note.cw != null || files.some(file => file.isSensitive),
|
||||
tag,
|
||||
...asEvent,
|
||||
...asPoll,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue