Skip to content

Commit 92acded

Browse files
committed
fix: update slug handling in metadata generation and comments area styling
1 parent e978387 commit 92acded

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

app/(app)/feed/[sourceSlug]/[shortId]/page.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
2121
return { title: "Post Not Found" };
2222
}
2323

24-
// Find the post by slug (shortId is part of the slug) and sourceId
24+
// Find the post by slug (shortId is used as slug in new schema) and sourceId
2525
const post = await db.query.posts.findFirst({
26-
where: and(eq(posts.sourceId, source.id), eq(posts.type, "link")),
26+
where: and(
27+
eq(posts.sourceId, source.id),
28+
eq(posts.type, "link"),
29+
eq(posts.slug, shortId),
30+
),
2731
with: {
2832
source: true,
2933
},
@@ -56,9 +60,13 @@ export default async function Page({ params }: Props) {
5660
notFound();
5761
}
5862

59-
// Verify post exists - the shortId is part of the slug
63+
// Verify post exists by slug (shortId is used as slug in new schema)
6064
const post = await db.query.posts.findFirst({
61-
where: and(eq(posts.sourceId, source.id), eq(posts.type, "link")),
65+
where: and(
66+
eq(posts.sourceId, source.id),
67+
eq(posts.type, "link"),
68+
eq(posts.slug, shortId),
69+
),
6270
});
6371

6472
if (!post) {

components/Comments/CommentsArea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
317317
onClick={() => likeComment(id, userVote)}
318318
>
319319
<HeartIcon
320-
className={`w-6 h-6${
320+
className={`w-6 h-6 ${
321321
userVote === "up"
322322
? "fill-red-400"
323323
: "fill-neutral-400 dark:fill-neutral-600"

components/Feed/AggregatedItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ const FeedItemAggregated = ({
176176
signIn();
177177
return;
178178
}
179-
openReport("article", id);
179+
openReport("post", id);
180180
};
181181

182182
const dateTime = publishedAt

0 commit comments

Comments
 (0)