Merge pull request 'Fix: 500 server error when attempting to fetch followers-only reply as guest' (#9983) from s1idewhist1e/calckey:issue/9075 into develop
Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9983
This commit is contained in:
commit
93309db051
|
@ -399,28 +399,31 @@ router.get("/notes/:note", async (ctx, next) => {
|
||||||
visibility: In(["public", "home"]),
|
visibility: In(["public", "home"]),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (note) {
|
try {
|
||||||
const _note = await Notes.pack(note);
|
if (note) {
|
||||||
const profile = await UserProfiles.findOneByOrFail({ userId: note.userId });
|
const _note = await Notes.pack(note);
|
||||||
const meta = await fetchMeta();
|
|
||||||
await ctx.render("note", {
|
|
||||||
note: _note,
|
|
||||||
profile,
|
|
||||||
avatarUrl: await Users.getAvatarUrl(
|
|
||||||
await Users.findOneByOrFail({ id: note.userId }),
|
|
||||||
),
|
|
||||||
// TODO: Let locale changeable by instance setting
|
|
||||||
summary: getNoteSummary(_note),
|
|
||||||
instanceName: meta.name || "Calckey",
|
|
||||||
icon: meta.iconUrl,
|
|
||||||
privateMode: meta.privateMode,
|
|
||||||
themeColor: meta.themeColor,
|
|
||||||
});
|
|
||||||
|
|
||||||
ctx.set("Cache-Control", "public, max-age=15");
|
const profile = await UserProfiles.findOneByOrFail({ userId: note.userId });
|
||||||
|
const meta = await fetchMeta();
|
||||||
|
await ctx.render("note", {
|
||||||
|
note: _note,
|
||||||
|
profile,
|
||||||
|
avatarUrl: await Users.getAvatarUrl(
|
||||||
|
await Users.findOneByOrFail({ id: note.userId }),
|
||||||
|
),
|
||||||
|
// TODO: Let locale changeable by instance setting
|
||||||
|
summary: getNoteSummary(_note),
|
||||||
|
instanceName: meta.name || "Calckey",
|
||||||
|
icon: meta.iconUrl,
|
||||||
|
privateMode: meta.privateMode,
|
||||||
|
themeColor: meta.themeColor,
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
ctx.set("Cache-Control", "public, max-age=15");
|
||||||
}
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
|
||||||
await next();
|
await next();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue