mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-12 13:48:28 +09:00
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 { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
||||||
import type { UserKeypair } from '@/models/entities/UserKeypair.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 { bindThis } from '@/decorators.js';
|
||||||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
import { isNotNull } from '@/misc/is-not-null.js';
|
||||||
@ -52,6 +52,9 @@ export class ApRendererService {
|
|||||||
@Inject(DI.pollsRepository)
|
@Inject(DI.pollsRepository)
|
||||||
private pollsRepository: PollsRepository,
|
private pollsRepository: PollsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.eventsRepository)
|
||||||
|
private eventsRepository: EventsRepository,
|
||||||
|
|
||||||
private customEmojiService: CustomEmojiService,
|
private customEmojiService: CustomEmojiService,
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
private driveFileEntityService: DriveFileEntityService,
|
private driveFileEntityService: DriveFileEntityService,
|
||||||
@ -424,6 +427,17 @@ export class ApRendererService {
|
|||||||
})),
|
})),
|
||||||
} as const : {};
|
} 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 {
|
return {
|
||||||
id: `${this.config.url}/notes/${note.id}`,
|
id: `${this.config.url}/notes/${note.id}`,
|
||||||
type: 'Note',
|
type: 'Note',
|
||||||
@ -444,6 +458,7 @@ export class ApRendererService {
|
|||||||
attachment: files.map(x => this.renderDocument(x)),
|
attachment: files.map(x => this.renderDocument(x)),
|
||||||
sensitive: note.cw != null || files.some(file => file.isSensitive),
|
sensitive: note.cw != null || files.some(file => file.isSensitive),
|
||||||
tag,
|
tag,
|
||||||
|
...asEvent,
|
||||||
...asPoll,
|
...asPoll,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user