From 44e12a4b44f1b4deb4ba44da4ac6f2fc9b53b3bb Mon Sep 17 00:00:00 2001 From: SatsAllDay <128755788+SatsAllDay@users.noreply.github.com> Date: Mon, 20 Nov 2023 09:33:59 -0500 Subject: [PATCH] Move the `AD` badge to be alongside other item info badges (#647) --- components/item-info.js | 3 ++- components/item.js | 2 +- prisma/seed.js | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/components/item-info.js b/components/item-info.js index 35f170de..e7bdce5b 100644 --- a/components/item-info.js +++ b/components/item-info.js @@ -22,7 +22,7 @@ import MuteDropdownItem from './mute' export default function ItemInfo ({ item, pendingSats, full, commentsText = 'comments', commentTextSingular = 'comment', className, embellishUser, extraInfo, onEdit, editText, - onQuoteReply, nofollow + onQuoteReply, nofollow, extraBadges }) { const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000 const me = useMe() @@ -116,6 +116,7 @@ export default function ItemInfo ({ {' '}freebie )} + {extraBadges} {canEdit && !item.deletedAt && <> \ diff --git a/components/item.js b/components/item.js index 0e97c631..49e0a8ad 100644 --- a/components/item.js +++ b/components/item.js @@ -96,7 +96,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s full={full} item={item} pendingSats={pendingSats} onQuoteReply={replyRef?.current?.quoteReply} nofollow={nofollow} - embellishUser={Number(item?.user?.id) === AD_USER_ID && AD} + extraBadges={Number(item?.user?.id) === AD_USER_ID && AD} /> {belowTitle} diff --git a/prisma/seed.js b/prisma/seed.js index 6202eb61..da713f1a 100644 --- a/prisma/seed.js +++ b/prisma/seed.js @@ -55,6 +55,10 @@ async function main () { where: { name: 'anon' } }) + const ad = await prisma.user.findUnique({ + where: { name: 'ad' } + }) + await prisma.item.create({ data: { title: 'System76 Developing “Cosmic” Desktop Environment', @@ -178,6 +182,21 @@ async function main () { } }) + await prisma.item.create({ + data: { + title: 'An ad post', + url: 'https://www.google.com', + userId: ad.id, + subName: 'bitcoin', + children: { + create: { + userId: anon.id, + text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' + } + } + } + }) + const bigCommentPost = await prisma.item.create({ data: { title: 'a discussion post with a lot of comments',