mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-26 02:55:30 +00:00
check prohibited words when creating notes
some small differences (between Misskey and us) inside the `create` method made `git` put all the changes inside the `import` method… I thought I had copied them all, but I had missed one, and it's a pretty important one: prohibited words were not being checked!
This commit is contained in:
parent
4c69cbcd2b
commit
ff0117a1a5
1 changed files with 12 additions and 2 deletions
|
@ -266,6 +266,16 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasProhibitedWords = await this.checkProhibitedWordsContain({
|
||||||
|
cw: data.cw,
|
||||||
|
text: data.text,
|
||||||
|
pollChoices: data.poll?.choices,
|
||||||
|
}, meta.prohibitedWords);
|
||||||
|
|
||||||
|
if (hasProhibitedWords) {
|
||||||
|
throw new IdentifiableError('689ee33f-f97c-479a-ac49-1b9f8140af99', 'Note contains prohibited words');
|
||||||
|
}
|
||||||
|
|
||||||
const inSilencedInstance = this.utilityService.isSilencedHost(meta.silencedHosts, user.host);
|
const inSilencedInstance = this.utilityService.isSilencedHost(meta.silencedHosts, user.host);
|
||||||
|
|
||||||
if (data.visibility === 'public' && inSilencedInstance && user.host !== null) {
|
if (data.visibility === 'public' && inSilencedInstance && user.host !== null) {
|
||||||
|
@ -299,7 +309,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check blocking
|
// Check blocking
|
||||||
if (data.renote && data.text == null && data.poll == null && (data.files == null || data.files.length === 0)) {
|
if (data.renote && !this.isQuote(data)) {
|
||||||
if (data.renote.userHost === null) {
|
if (data.renote.userHost === null) {
|
||||||
if (data.renote.userId !== user.id) {
|
if (data.renote.userId !== user.id) {
|
||||||
const blocked = await this.userBlockingService.checkBlocked(data.renote.userId, user.id);
|
const blocked = await this.userBlockingService.checkBlocked(data.renote.userId, user.id);
|
||||||
|
|
Loading…
Reference in a new issue