Add bot badge to items created with API key (#1209)
This commit is contained in:
parent
050122c665
commit
d2a981ca5d
|
@ -1311,6 +1311,9 @@ export const createItem = async (parent, { forward, options, ...item }, { me, mo
|
|||
item.url = removeTracking(item.url)
|
||||
}
|
||||
|
||||
// mark item as created with API key
|
||||
item.apiKey = me?.apiKey
|
||||
|
||||
const uploadIds = uploadIdsFromText(item.text, { models })
|
||||
const { totalFees: imgFees } = await imageFeesInfo(uploadIds, { models, me })
|
||||
|
||||
|
@ -1433,7 +1436,7 @@ export const SELECT =
|
|||
"Item".ncomments, "Item"."commentMsats", "Item"."lastCommentAt", "Item"."weightedVotes",
|
||||
"Item"."weightedDownVotes", "Item".freebie, "Item".bio, "Item"."otsHash", "Item"."bountyPaidTo",
|
||||
ltree2text("Item"."path") AS "path", "Item"."weightedComments", "Item"."imgproxyUrls", "Item".outlawed,
|
||||
"Item"."pollExpiresAt"`
|
||||
"Item"."pollExpiresAt", "Item"."apiKey"`
|
||||
|
||||
function topOrderByWeightedSats (me, models) {
|
||||
return `ORDER BY ${orderByNumerator(models)} DESC NULLS LAST, "Item".id DESC`
|
||||
|
|
|
@ -125,6 +125,7 @@ export default gql`
|
|||
forwards: [ItemForward]
|
||||
imgproxyUrls: JSONObject
|
||||
rel: String
|
||||
apiKey: Boolean
|
||||
}
|
||||
|
||||
input ItemForwardInput {
|
||||
|
|
|
@ -136,6 +136,9 @@ export default function ItemInfo ({
|
|||
{' '}<Badge className={styles.newComment} bg={null}>freebie</Badge>
|
||||
</Link>
|
||||
)}
|
||||
{(item.apiKey &&
|
||||
<>{' '}<Badge className={styles.newComment} bg={null}>bot</Badge></>
|
||||
)}
|
||||
{extraBadges}
|
||||
{canEdit && !item.deletedAt &&
|
||||
<>
|
||||
|
|
|
@ -34,6 +34,7 @@ export const COMMENT_FIELDS = gql`
|
|||
ncomments
|
||||
imgproxyUrls
|
||||
rel
|
||||
apiKey
|
||||
}
|
||||
`
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ export const ITEM_FIELDS = gql`
|
|||
mine
|
||||
imgproxyUrls
|
||||
rel
|
||||
apiKey
|
||||
}`
|
||||
|
||||
export const ITEM_FULL_FIELDS = gql`
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "Item" ADD COLUMN "apiKey" BOOLEAN NOT NULL DEFAULT false;
|
|
@ -419,6 +419,7 @@ model Item {
|
|||
ItemUpload ItemUpload[]
|
||||
uploadId Int?
|
||||
outlawed Boolean @default(false)
|
||||
apiKey Boolean @default(false)
|
||||
pollExpiresAt DateTime?
|
||||
Ancestors Reply[] @relation("AncestorReplyItem")
|
||||
Replies Reply[]
|
||||
|
|
Loading…
Reference in New Issue