fix(api): update review editing endpoint
when checking for whether the requester is the author, treat the author field as an object rather than a number (id)
This commit is contained in:
parent
c9f5d5466d
commit
fa27a16e65
@ -1,5 +1,6 @@
|
||||
import san from "sanitize-html";
|
||||
import { messages } from "~/lib/server/constants";
|
||||
import { log } from "~/lib/server/logger";
|
||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
||||
import { Review } from "~/models/stories/review";
|
||||
|
||||
@ -13,7 +14,10 @@ export default eventHandler(async (ev) => {
|
||||
message: messages[404],
|
||||
});
|
||||
}
|
||||
if (c?.author != ev.context.currentUser?._id) {
|
||||
log.silly(`${ev.context.currentUser!._id!} || ${c.author}`, {
|
||||
label: "what the fuck",
|
||||
});
|
||||
if (c?.author._id != ev.context.currentUser?._id) {
|
||||
throw createError({
|
||||
message: messages[403],
|
||||
statusCode: 403,
|
||||
|
Loading…
Reference in New Issue
Block a user