From daa22d68fa8a55a2e65a1de541f903edb64ff042 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Wed, 24 Oct 2018 04:00:04 +0900 Subject: Make max allowed text length configurable (#2992) * Make max allowed text length configurable * Fix canPost --- src/models/note.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/models/note.ts') diff --git a/src/models/note.ts b/src/models/note.ts index aeec075636..6edf6ec317 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -14,6 +14,7 @@ import NoteReaction from './note-reaction'; import Favorite, { deleteFavorite } from './favorite'; import Notification, { deleteNotification } from './notification'; import Following from './following'; +import config from '../config'; const Note = db.get('notes'); Note.createIndex('uri', { sparse: true, unique: true }); @@ -29,7 +30,7 @@ Note.createIndex({ export default Note; export function isValidText(text: string): boolean { - return length(text.trim()) <= 1000 && text.trim() != ''; + return length(text.trim()) <= config.maxNoteTextLength && text.trim() != ''; } export function isValidCw(text: string): boolean { -- cgit v1.2.3-freya