click to comment goes to root thread
This commit is contained in:
parent
cb3a731785
commit
996d0a9352
@ -374,6 +374,9 @@ export default {
|
||||
|
||||
return sats || 0
|
||||
},
|
||||
mine: async (item, args, { me, models }) => {
|
||||
return me?.id === item.userId
|
||||
},
|
||||
meBoost: async (item, args, { me, models }) => {
|
||||
if (!me) return 0
|
||||
|
||||
|
@ -54,6 +54,7 @@ export default gql`
|
||||
sats: Int!
|
||||
boost: Int!
|
||||
tips: Int!
|
||||
mine: Boolean!
|
||||
meVote: Int!
|
||||
meBoost: Int!
|
||||
meTip: Int!
|
||||
|
@ -9,7 +9,6 @@ import UpVote from './upvote'
|
||||
import Eye from '../svgs/eye-fill.svg'
|
||||
import EyeClose from '../svgs/eye-close-line.svg'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useMe } from './me'
|
||||
import CommentEdit from './comment-edit'
|
||||
import Countdown from './countdown'
|
||||
import { NOFOLLOW_LIMIT } from '../lib/constants'
|
||||
@ -47,8 +46,7 @@ export default function Comment ({
|
||||
const [collapse, setCollapse] = useState(false)
|
||||
const ref = useRef(null)
|
||||
const router = useRouter()
|
||||
const me = useMe()
|
||||
const mine = me?.id === item.user.id
|
||||
const mine = item.mine
|
||||
const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000
|
||||
const [canEdit, setCanEdit] =
|
||||
useState(mine && (Date.now() < editThreshold))
|
||||
|
@ -27,8 +27,8 @@ export default function CommentsFlat ({ variables, comments, cursor, ...props })
|
||||
onClick={() => {
|
||||
router.push({
|
||||
pathname: '/items/[id]',
|
||||
query: { id: item.parentId, commentId: item.id }
|
||||
}, `/items/${item.parentId}`)
|
||||
query: { id: item.root.id, commentId: item.id }
|
||||
}, `/items/${item.root.id}`)
|
||||
}}
|
||||
>
|
||||
<Comment item={item} {...props} />
|
||||
|
@ -2,14 +2,12 @@ import Link from 'next/link'
|
||||
import styles from './item.module.css'
|
||||
import { timeSince } from '../lib/time'
|
||||
import UpVote from './upvote'
|
||||
import { useMe } from './me'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import Countdown from './countdown'
|
||||
import { NOFOLLOW_LIMIT } from '../lib/constants'
|
||||
|
||||
export default function Item ({ item, rank, children }) {
|
||||
const me = useMe()
|
||||
const mine = me?.id === item.user.id
|
||||
const mine = item.mine
|
||||
const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000
|
||||
const [canEdit, setCanEdit] =
|
||||
useState(mine && (Date.now() < editThreshold))
|
||||
|
@ -14,8 +14,8 @@ function Notification ({ n }) {
|
||||
if (n.__typename === 'Reply' || !n.item.title) {
|
||||
router.push({
|
||||
pathname: '/items/[id]',
|
||||
query: { id: n.item.parentId, commentId: n.item.id }
|
||||
}, `/items/${n.item.parentId}`)
|
||||
query: { id: n.item.root.id, commentId: n.item.id }
|
||||
}, `/items/${n.item.root.id}`)
|
||||
} else {
|
||||
router.push({
|
||||
pathname: '/items/[id]',
|
||||
|
@ -84,8 +84,8 @@ export default function UpVote ({ item, className }) {
|
||||
return '1 sat'
|
||||
}
|
||||
|
||||
const noSelfTips = item?.meVote && item?.user?.id === me?.id
|
||||
const Arrow = item?.meVote ? BoltAdd : UpArrow
|
||||
const noSelfTips = item?.meVote && item?.mine
|
||||
const Arrow = item?.meVote && !item?.mine ? BoltAdd : UpArrow
|
||||
|
||||
return (
|
||||
<LightningConsumer>
|
||||
|
@ -16,6 +16,7 @@ export const COMMENT_FIELDS = gql`
|
||||
meVote
|
||||
meBoost
|
||||
meTip
|
||||
mine
|
||||
ncomments
|
||||
root {
|
||||
id
|
||||
|
@ -19,6 +19,7 @@ export const ITEM_FIELDS = gql`
|
||||
meBoost
|
||||
meTip
|
||||
ncomments
|
||||
mine
|
||||
root {
|
||||
id
|
||||
title
|
||||
|
Loading…
x
Reference in New Issue
Block a user