enhance(word-mute): ワードミュートの制限を文字数から設定項目数に (MisskeyIO#242)
This commit is contained in:
		| @@ -236,8 +236,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- | |||||||
| 			if (ps.birthday !== undefined) profileUpdates.birthday = ps.birthday; | 			if (ps.birthday !== undefined) profileUpdates.birthday = ps.birthday; | ||||||
| 			if (ps.ffVisibility !== undefined) profileUpdates.ffVisibility = ps.ffVisibility; | 			if (ps.ffVisibility !== undefined) profileUpdates.ffVisibility = ps.ffVisibility; | ||||||
| 			if (ps.mutedWords !== undefined) { | 			if (ps.mutedWords !== undefined) { | ||||||
| 				// TODO: ちゃんと数える | 				const length = ps.mutedWords.length; | ||||||
| 				const length = JSON.stringify(ps.mutedWords).length; |  | ||||||
| 				if (length > (await this.roleService.getUserPolicies(user.id)).wordMuteLimit) { | 				if (length > (await this.roleService.getUserPolicies(user.id)).wordMuteLimit) { | ||||||
| 					throw new ApiError(meta.errors.tooManyMutedWords); | 					throw new ApiError(meta.errors.tooManyMutedWords); | ||||||
| 				} | 				} | ||||||
|   | |||||||
| @@ -338,7 +338,7 @@ SPDX-License-Identifier: AGPL-3.0-only | |||||||
| 					</MkRange> | 					</MkRange> | ||||||
| 				</div> | 				</div> | ||||||
| 			</MkFolder> | 			</MkFolder> | ||||||
| 			 |  | ||||||
| 			<MkFolder v-if="matchQuery([i18n.ts._role._options.canSearchNotes, 'canSearchNotes'])"> | 			<MkFolder v-if="matchQuery([i18n.ts._role._options.canSearchNotes, 'canSearchNotes'])"> | ||||||
| 				<template #label>{{ i18n.ts._role._options.canSearchNotes }}</template> | 				<template #label>{{ i18n.ts._role._options.canSearchNotes }}</template> | ||||||
| 				<template #suffix> | 				<template #suffix> | ||||||
| @@ -469,7 +469,7 @@ SPDX-License-Identifier: AGPL-3.0-only | |||||||
| 						<template #label>{{ i18n.ts._role.useBaseValue }}</template> | 						<template #label>{{ i18n.ts._role.useBaseValue }}</template> | ||||||
| 					</MkSwitch> | 					</MkSwitch> | ||||||
| 					<MkInput v-model="role.policies.wordMuteLimit.value" :disabled="role.policies.wordMuteLimit.useDefault" type="number" :readonly="readonly"> | 					<MkInput v-model="role.policies.wordMuteLimit.value" :disabled="role.policies.wordMuteLimit.useDefault" type="number" :readonly="readonly"> | ||||||
| 						<template #suffix>chars</template> | 						<template #suffix>items</template> | ||||||
| 					</MkInput> | 					</MkInput> | ||||||
| 					<MkRange v-model="role.policies.wordMuteLimit.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''"> | 					<MkRange v-model="role.policies.wordMuteLimit.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''"> | ||||||
| 						<template #label>{{ i18n.ts._role.priority }}</template> | 						<template #label>{{ i18n.ts._role.priority }}</template> | ||||||
|   | |||||||
| @@ -169,7 +169,7 @@ SPDX-License-Identifier: AGPL-3.0-only | |||||||
| 							<template #label>{{ i18n.ts._role._options.wordMuteMax }}</template> | 							<template #label>{{ i18n.ts._role._options.wordMuteMax }}</template> | ||||||
| 							<template #suffix>{{ policies.wordMuteLimit }}</template> | 							<template #suffix>{{ policies.wordMuteLimit }}</template> | ||||||
| 							<MkInput v-model="policies.wordMuteLimit" type="number"> | 							<MkInput v-model="policies.wordMuteLimit" type="number"> | ||||||
| 								<template #suffix>chars</template> | 								<template #suffix>items</template> | ||||||
| 							</MkInput> | 							</MkInput> | ||||||
| 						</MkFolder> | 						</MkFolder> | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 まっちゃとーにゅ
					まっちゃとーにゅ