mirror of
https://codeberg.org/yeentown/barkey
synced 2024-12-29 07:31:06 +00:00
copy changes from NoteCreateService to NoteEditService
This commit is contained in:
parent
cfa9b852df
commit
b678580453
2 changed files with 20 additions and 14 deletions
|
@ -581,9 +581,10 @@ seems to do a decent job)
|
|||
*after that commit*, do all the extra work, on the same branch:
|
||||
|
||||
* copy all changes:
|
||||
* from `NoteCreateService.create` to `NoteCreateService.import` (and
|
||||
vice versa if `git` got confused!)
|
||||
* from `NoteCreateService` to `NoteEditService`
|
||||
* in `packages/backend/src/core/NoteCreateService.ts`, from `create` to
|
||||
`import` (and vice versa if `git` got confused!)
|
||||
* from `packages/backend/src/core/NoteCreateService.ts` to
|
||||
`packages/backend/src/core/NoteEditService.vue`
|
||||
* from `ApNoteService.createNote` to `ApNoteService.updateNote`
|
||||
* from `endoints/notes/create.ts` to `endoints/notes/edit.ts`
|
||||
* from `MkNote*` to `SkNote*` (if sensible)
|
||||
|
|
|
@ -31,7 +31,7 @@ import InstanceChart from '@/core/chart/charts/instance.js';
|
|||
import ActiveUsersChart from '@/core/chart/charts/active-users.js';
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { NotificationService } from '@/core/NotificationService.js';
|
||||
import { WebhookService } from '@/core/WebhookService.js';
|
||||
import { UserWebhookService } from '@/core/UserWebhookService.js';
|
||||
import { QueueService } from '@/core/QueueService.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
|
@ -51,7 +51,6 @@ import { CacheService } from '@/core/CacheService.js';
|
|||
import { isReply } from '@/misc/is-reply.js';
|
||||
import { trackPromise } from '@/misc/promise-tracker.js';
|
||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { isNotNull } from '@/misc/is-not-null.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
|
||||
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention' | 'edited';
|
||||
|
@ -203,7 +202,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
|||
private notificationService: NotificationService,
|
||||
private relayService: RelayService,
|
||||
private federatedInstanceService: FederatedInstanceService,
|
||||
private webhookService: WebhookService,
|
||||
private webhookService: UserWebhookService,
|
||||
private remoteUserResolveService: RemoteUserResolveService,
|
||||
private apDeliverManagerService: ApDeliverManagerService,
|
||||
private apRendererService: ApRendererService,
|
||||
|
@ -388,6 +387,9 @@ export class NoteEditService implements OnApplicationShutdown {
|
|||
mentionedUsers = data.apMentions ?? await this.extractMentionedUsers(user, combinedTokens);
|
||||
}
|
||||
|
||||
// if the host is media-silenced, custom emojis are not allowed
|
||||
if (this.utilityService.isMediaSilencedHost(meta.mediaSilencedHosts, user.host)) emojis = [];
|
||||
|
||||
tags = tags.filter(tag => Array.from(tag ?? '').length <= 128).splice(0, 32);
|
||||
|
||||
if (data.reply && (user.id !== data.reply.userId) && !mentionedUsers.some(u => u.id === data.reply!.userId)) {
|
||||
|
@ -631,7 +633,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
|||
this.webhookService.getActiveWebhooks().then(webhooks => {
|
||||
webhooks = webhooks.filter(x => x.userId === user.id && x.on.includes('note'));
|
||||
for (const webhook of webhooks) {
|
||||
this.queueService.webhookDeliver(webhook, 'note', {
|
||||
this.queueService.userWebhookDeliver(webhook, 'note', {
|
||||
note: noteObj,
|
||||
});
|
||||
}
|
||||
|
@ -666,7 +668,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
|||
|
||||
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === data.reply!.userId && x.on.includes('edited'));
|
||||
for (const webhook of webhooks) {
|
||||
this.queueService.webhookDeliver(webhook, 'edited', {
|
||||
this.queueService.userWebhookDeliver(webhook, 'edited', {
|
||||
note: noteObj,
|
||||
});
|
||||
}
|
||||
|
@ -801,7 +803,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
|||
|
||||
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === u.id && x.on.includes('edited'));
|
||||
for (const webhook of webhooks) {
|
||||
this.queueService.webhookDeliver(webhook, 'edited', {
|
||||
this.queueService.userWebhookDeliver(webhook, 'edited', {
|
||||
note: detailPackedNote,
|
||||
});
|
||||
}
|
||||
|
@ -838,7 +840,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
|||
const mentions = extractMentions(tokens);
|
||||
let mentionedUsers = (await Promise.all(mentions.map(m =>
|
||||
this.remoteUserResolveService.resolveUser(m.username, m.host ?? user.host).catch(() => null),
|
||||
))).filter(isNotNull) as MiUser[];
|
||||
))).filter(x => x !== null) as MiUser[];
|
||||
|
||||
// Drop duplicate users
|
||||
mentionedUsers = mentionedUsers.filter((u, i, self) =>
|
||||
|
@ -933,10 +935,13 @@ export class NoteEditService implements OnApplicationShutdown {
|
|||
}
|
||||
}
|
||||
|
||||
if (note.visibility !== 'specified' || !note.visibleUserIds.some(v => v === user.id)) { // 自分自身のHTL
|
||||
this.fanoutTimelineService.push(`homeTimeline:${user.id}`, note.id, meta.perUserHomeTimelineCacheMax, r);
|
||||
if (note.fileIds.length > 0) {
|
||||
this.fanoutTimelineService.push(`homeTimelineWithFiles:${user.id}`, note.id, meta.perUserHomeTimelineCacheMax / 2, r);
|
||||
// 自分自身のHTL
|
||||
if (note.userHost == null) {
|
||||
if (note.visibility !== 'specified' || !note.visibleUserIds.some(v => v === user.id)) {
|
||||
this.fanoutTimelineService.push(`homeTimeline:${user.id}`, note.id, meta.perUserHomeTimelineCacheMax, r);
|
||||
if (note.fileIds.length > 0) {
|
||||
this.fanoutTimelineService.push(`homeTimelineWithFiles:${user.id}`, note.id, meta.perUserHomeTimelineCacheMax / 2, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue