Skip to content

Commit c81043e

Browse files
committed
add vote weight threshold to social poster
1 parent ec902eb commit c81043e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

worker/socialPoster.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { TwitterApi } from 'twitter-api-v2'
33
import { msatsToSats, numWithUnits } from '@/lib/format'
44

55
const isProd = process.env.NODE_ENV === 'production'
6+
const WEIGHTED_VOTE_THRESHOLD = 3
67

78
async function postToTwitter ({ message }) {
89
if (!isProd ||
@@ -73,6 +74,7 @@ async function getHottestItem ({ models }) {
7374
LEFT JOIN "AutoSocialPost" ON "Item"."id" = "AutoSocialPost"."itemId"
7475
WHERE "AutoSocialPost"."id" IS NULL
7576
AND "Item"."parentId" IS NULL
77+
AND "Item"."weightedVotes" - "Item"."weightedDownVotes" > ${WEIGHTED_VOTE_THRESHOLD}
7678
AND NOT "Item".bio
7779
AND "Item"."deletedAt" IS NULL
7880
ORDER BY "hot_score_view"."hot_score" DESC

0 commit comments

Comments
 (0)