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
},
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 }) => {
return me?.id === item.userId
},

View File

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

View File

@ -109,7 +109,7 @@ export default function Comment ({
<div className={`${itemStyles.hunk} ${styles.hunk}`}>
<div className='d-flex align-items-center'>
<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>
{item.boost > 0 &&
<>
@ -186,7 +186,7 @@ export default function Comment ({
<div className={`${styles.children}`}>
{!noReply &&
<Reply
depth={depth + 1} parentId={item.id} meComments={item.meComments} replyOpen={replyOpen}
depth={depth + 1} parentId={item.id} replyOpen={replyOpen}
/>}
{children}
<div className={`${styles.comments} ml-sm-1 ml-md-3`}>

View File

@ -31,7 +31,7 @@ function BioItem ({ item, handleClick }) {
>edit bio
</Button>
</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.url && <ItemEmbed item={item} />}
{item.poll && <Poll item={item} />}
{!noReply && <Reply parentId={item.id} meComments={item.meComments} replyOpen />}
{!noReply && <Reply parentId={item.id} replyOpen />}
</ItemComponent>
)
}

View File

@ -73,7 +73,7 @@ export default function Item ({ item, rank, showFwdUser, toc, children }) {
<div className={`${styles.other}`}>
{!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>
</>}
{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 me = useMe()
const [hasImgLink, setHasImgLink] = useState()
@ -55,9 +55,6 @@ export default function Reply ({ parentId, meComments, onSuccess, replyOpen }) {
},
ncomments (existingNComments = 0) {
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 (
<div>
{replyOpen

View File

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

View File

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