align NoteCreateService create & import

This commit is contained in:
dakkar 2024-08-30 13:23:55 +01:00
parent 311d26547a
commit 8b8ee72a81

View file

@ -281,7 +281,7 @@ export class NoteCreateService implements OnApplicationShutdown {
data.visibility = 'home'; data.visibility = 'home';
} }
if (this.isRenote(data)) { if (data.renote) {
switch (data.renote.visibility) { switch (data.renote.visibility) {
case 'public': case 'public':
// public noteは無条件にrenote可能 // public noteは無条件にrenote可能
@ -367,6 +367,9 @@ export class NoteCreateService implements OnApplicationShutdown {
mentionedUsers = data.apMentions ?? await this.extractMentionedUsers(user, combinedTokens); 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); 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)) { if (data.reply && (user.id !== data.reply.userId) && !mentionedUsers.some(u => u.id === data.reply!.userId)) {
@ -1018,12 +1021,14 @@ export class NoteCreateService implements OnApplicationShutdown {
followeeId: user.id, followeeId: user.id,
notify: 'normal', notify: 'normal',
}).then(followings => { }).then(followings => {
if (note.visibility !== 'specified') {
for (const following of followings) { for (const following of followings) {
// TODO: ワードミュート考慮 // TODO: ワードミュート考慮
this.notificationService.createNotification(following.followerId, 'note', { this.notificationService.createNotification(following.followerId, 'note', {
noteId: note.id, noteId: note.id,
}, user.id); }, user.id);
} }
}
}); });
} }