Remove OP badge for comments by anon on posts by anon (#422)

Add a post to the seed file from anon, with a comment by anon for easier testing
This commit is contained in:
SatsAllDay 2023-08-19 17:03:07 -04:00 committed by GitHub
parent df6575d701
commit b9a8ec84bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -9,7 +9,7 @@ import Eye from '../svgs/eye-fill.svg'
import EyeClose from '../svgs/eye-close-line.svg'
import { useRouter } from 'next/router'
import CommentEdit from './comment-edit'
import { COMMENT_DEPTH_LIMIT, NOFOLLOW_LIMIT } from '../lib/constants'
import { ANON_USER_ID, COMMENT_DEPTH_LIMIT, NOFOLLOW_LIMIT } from '../lib/constants'
import { ignoreClick } from '../lib/clicks'
import PayBounty from './pay-bounty'
import BountyIcon from '../svgs/bounty-bag.svg'
@ -129,7 +129,8 @@ export default function Comment ({
}, [item.id])
const bottomedOut = depth === COMMENT_DEPTH_LIMIT
const op = root.user.name === item.user.name
// Don't show OP badge when anon user comments on anon user posts
const op = root.user.name === item.user.name && Number(item.user.id) !== ANON_USER_ID
const bountyPaid = root.bountyPaidTo?.includes(Number(item.id))
return (

View File

@ -29,6 +29,9 @@ async function main () {
name: 'stan'
}
})
const anon = await prisma.user.findUnique({
where: { name: 'anon' }
})
await prisma.item.create({
data: {
@ -137,6 +140,21 @@ async function main () {
}
}
})
await prisma.item.create({
data: {
title: 'An anonymous post',
url: 'https://www.google.com',
userId: anon.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.'
}
}
}
})
}
main()
.catch(e => {