remove meComments and clean up sats title

This commit is contained in:
keyan 2022-09-01 16:20:20 -05:00
parent 4be5cfa5c7
commit f65f6c1b28
8 changed files with 6 additions and 20 deletions

View File

@ -768,11 +768,6 @@ export default {
return sats || 0 return sats || 0
}, },
meComments: async (item, args, { me, models }) => {
if (!me) return 0
return await models.item.count({ where: { userId: me.id, parentId: item.id } })
},
mine: async (item, args, { me, models }) => { mine: async (item, args, { me, models }) => {
return me?.id === item.userId return me?.id === item.userId
}, },

View File

@ -79,7 +79,6 @@ export default gql`
upvotes: Int! upvotes: Int!
meSats: Int! meSats: Int!
paidImgLink: Boolean paidImgLink: Boolean
meComments: Int!
ncomments: Int! ncomments: Int!
comments: [Item!]! comments: [Item!]!
path: String path: String

View File

@ -109,7 +109,7 @@ export default function Comment ({
<div className={`${itemStyles.hunk} ${styles.hunk}`}> <div className={`${itemStyles.hunk} ${styles.hunk}`}>
<div className='d-flex align-items-center'> <div className='d-flex align-items-center'>
<div className={`${itemStyles.other} ${styles.other}`}> <div className={`${itemStyles.other} ${styles.other}`}>
<span title={`from ${item.upvotes} users (${item.meSats} from me)`}>{item.sats} sats</span> <span title={`from ${item.upvotes} users ${item.mine ? `\\ ${item.meSats} sats to post` : `(${item.meSats} sats from me)`}`}>{item.sats} sats</span>
<span> \ </span> <span> \ </span>
{item.boost > 0 && {item.boost > 0 &&
<> <>
@ -186,7 +186,7 @@ export default function Comment ({
<div className={`${styles.children}`}> <div className={`${styles.children}`}>
{!noReply && {!noReply &&
<Reply <Reply
depth={depth + 1} parentId={item.id} meComments={item.meComments} replyOpen={replyOpen} depth={depth + 1} parentId={item.id} replyOpen={replyOpen}
/>} />}
{children} {children}
<div className={`${styles.comments} ml-sm-1 ml-md-3`}> <div className={`${styles.comments} ml-sm-1 ml-md-3`}>

View File

@ -31,7 +31,7 @@ function BioItem ({ item, handleClick }) {
>edit bio >edit bio
</Button> </Button>
</div>} </div>}
<Reply parentId={item.id} meComments={item.meComments} /> <Reply parentId={item.id} />
</> </>
) )
} }
@ -89,7 +89,7 @@ function TopLevelItem ({ item, noReply, ...props }) {
{item.text && <ItemText item={item} />} {item.text && <ItemText item={item} />}
{item.url && <ItemEmbed item={item} />} {item.url && <ItemEmbed item={item} />}
{item.poll && <Poll item={item} />} {item.poll && <Poll item={item} />}
{!noReply && <Reply parentId={item.id} meComments={item.meComments} replyOpen />} {!noReply && <Reply parentId={item.id} replyOpen />}
</ItemComponent> </ItemComponent>
) )
} }

View File

@ -73,7 +73,7 @@ export default function Item ({ item, rank, showFwdUser, toc, children }) {
<div className={`${styles.other}`}> <div className={`${styles.other}`}>
{!item.position && {!item.position &&
<> <>
<span title={`from ${item.upvotes} users (${item.meSats} sats from me)`}>{item.sats} sats</span> <span title={`from ${item.upvotes} users ${item.mine ? `\\ ${item.meSats} sats to post` : `(${item.meSats} sats from me)`} `}>{item.sats} sats</span>
<span> \ </span> <span> \ </span>
</>} </>}
{item.boost > 0 && {item.boost > 0 &&

View File

@ -21,7 +21,7 @@ export function ReplyOnAnotherPage ({ parentId }) {
) )
} }
export default function Reply ({ parentId, meComments, onSuccess, replyOpen }) { export default function Reply ({ parentId, onSuccess, replyOpen }) {
const [reply, setReply] = useState(replyOpen) const [reply, setReply] = useState(replyOpen)
const me = useMe() const me = useMe()
const [hasImgLink, setHasImgLink] = useState() const [hasImgLink, setHasImgLink] = useState()
@ -55,9 +55,6 @@ export default function Reply ({ parentId, meComments, onSuccess, replyOpen }) {
}, },
ncomments (existingNComments = 0) { ncomments (existingNComments = 0) {
return existingNComments + 1 return existingNComments + 1
},
meComments (existingMeComments = 0) {
return existingMeComments + 1
} }
} }
}) })
@ -65,8 +62,6 @@ export default function Reply ({ parentId, meComments, onSuccess, replyOpen }) {
} }
) )
// const cost = me?.freeComments ? 0 : Math.pow(10, meComments)
return ( return (
<div> <div>
{replyOpen {replyOpen

View File

@ -14,7 +14,6 @@ export const COMMENT_FIELDS = gql`
upvotes upvotes
boost boost
meSats meSats
meComments
path path
mine mine
paidImgLink paidImgLink

View File

@ -111,7 +111,6 @@ export const ITEM_FULL = gql`
item(id: $id) { item(id: $id) {
...ItemFields ...ItemFields
prior prior
meComments
position position
text text
...PollFields ...PollFields
@ -127,7 +126,6 @@ export const ITEM_WITH_COMMENTS = gql`
fragment ItemWithComments on Item { fragment ItemWithComments on Item {
...ItemFields ...ItemFields
text text
meComments
comments { comments {
...CommentsRecursive ...CommentsRecursive
} }