fix(backend): prohibit posting whitespace-only notes
This commit is contained in:
parent
b92c9726bd
commit
d83c01af6c
|
@ -48,6 +48,11 @@ describe('api:notes/create', () => {
|
||||||
expect(v({ text: await tooLong }))
|
expect(v({ text: await tooLong }))
|
||||||
.toBe(INVALID);
|
.toBe(INVALID);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('whitespace-only post', () => {
|
||||||
|
expect(v({ text: ' ' }))
|
||||||
|
.toBe(INVALID);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('cw', () => {
|
describe('cw', () => {
|
||||||
|
|
|
@ -138,6 +138,7 @@ export const paramDef = {
|
||||||
minLength: 1,
|
minLength: 1,
|
||||||
maxLength: MAX_NOTE_TEXT_LENGTH,
|
maxLength: MAX_NOTE_TEXT_LENGTH,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
pattern: '[^\\s]+',
|
||||||
},
|
},
|
||||||
fileIds: {
|
fileIds: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
|
@ -195,6 +196,7 @@ export const paramDef = {
|
||||||
minLength: 1,
|
minLength: 1,
|
||||||
maxLength: MAX_NOTE_TEXT_LENGTH,
|
maxLength: MAX_NOTE_TEXT_LENGTH,
|
||||||
nullable: false,
|
nullable: false,
|
||||||
|
pattern: '[^\\s]+',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
required: ['text'],
|
required: ['text'],
|
||||||
|
|
Loading…
Reference in a new issue