Minor refactoring of freeURL condition check
Signed-off-by: Nicolas Dietrich <nidi@mailbox.org>
This commit is contained in:
parent
ea52746104
commit
3331c0947c
@ -51,10 +51,12 @@ exports.newNote = function (req, res, body) {
|
|||||||
} else if (!config.allowAnonymous) {
|
} else if (!config.allowAnonymous) {
|
||||||
return errors.errorForbidden(res)
|
return errors.errorForbidden(res)
|
||||||
}
|
}
|
||||||
if (config.allowFreeURL && noteId && !config.forbiddenNoteIDs.includes(noteId)) {
|
if (noteId) {
|
||||||
req.alias = noteId
|
if (config.allowFreeURL && !config.forbiddenNoteIDs.includes(noteId)) {
|
||||||
} else if (noteId) {
|
req.alias = noteId
|
||||||
return req.method === 'POST' ? errors.errorForbidden(res) : errors.errorNotFound(res)
|
} else {
|
||||||
|
return req.method === 'POST' ? errors.errorForbidden(res) : errors.errorNotFound(res)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
models.Note.create({
|
models.Note.create({
|
||||||
ownerId: owner,
|
ownerId: owner,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user