mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1018 Closes #861 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
commit
f8b2e272f1
2 changed files with 8 additions and 3 deletions
|
@ -93,7 +93,7 @@ export const DEFAULT_POLICIES: RolePolicies = {
|
|||
canUpdateBioMedia: true,
|
||||
pinLimit: 5,
|
||||
antennaLimit: 5,
|
||||
wordMuteLimit: 200,
|
||||
wordMuteLimit: 1000,
|
||||
webhookLimit: 3,
|
||||
clipLimit: 10,
|
||||
noteEachClipsLimit: 200,
|
||||
|
|
|
@ -330,8 +330,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
if (ps.chatScope !== undefined) updates.chatScope = ps.chatScope;
|
||||
|
||||
function checkMuteWordCount(mutedWords: (string[] | string)[], limit: number) {
|
||||
// TODO: ちゃんと数える
|
||||
const length = JSON.stringify(mutedWords).length;
|
||||
const length = mutedWords.reduce((sum, word) => {
|
||||
const wordLength = Array.isArray(word)
|
||||
? word.reduce((l, w) => l + w.length, 0)
|
||||
: word.length;
|
||||
return sum + wordLength;
|
||||
}, 0);
|
||||
|
||||
if (length > limit) {
|
||||
throw new ApiError(meta.errors.tooManyMutedWords);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue