diff --git a/api/resolvers/item.js b/api/resolvers/item.js
index 781409e0..7e09c97f 100644
--- a/api/resolvers/item.js
+++ b/api/resolvers/item.js
@@ -697,7 +697,11 @@ export default {
status: 'ACTIVE',
deletedAt: null,
outlawed: false,
- parentId: null
+ parentId: null,
+ OR: [
+ { invoiceActionState: 'PAID' },
+ { invoiceActionState: { is: null } }
+ ]
}
if (id) {
where.id = { not: Number(id) }
diff --git a/components/adv-post-form.js b/components/adv-post-form.js
index af40d3f8..d1dd53cd 100644
--- a/components/adv-post-form.js
+++ b/components/adv-post-form.js
@@ -2,7 +2,7 @@ import { useState, useEffect, useMemo, useCallback } from 'react'
import AccordianItem from './accordian-item'
import { Input, InputUserSuggest, VariableInput, Checkbox } from './form'
import InputGroup from 'react-bootstrap/InputGroup'
-import { BOOST_MIN, BOOST_MULT, MAX_FORWARDS, SSR } from '@/lib/constants'
+import { BOOST_MIN, BOOST_MAX, BOOST_MULT, MAX_FORWARDS, SSR } from '@/lib/constants'
import { DEFAULT_CROSSPOSTING_RELAYS } from '@/lib/nostr'
import Info from './info'
import { abbrNum, numWithUnits } from '@/lib/format'
@@ -37,6 +37,7 @@ export function BoostHelp () {
The highest boost in a territory over the last 30 days is pinned to the top of the territory
The highest boost across all territories over the last 30 days is pinned to the top of the homepage
The minimum boost is {numWithUnits(BOOST_MIN, { abbreviate: false })}
+ The maximum boost is {numWithUnits(BOOST_MAX, { abbreviate: false })}
Each {numWithUnits(BOOST_MULT, { abbreviate: false })} of boost is equivalent to a zap-vote from a maximally trusted stacker (very rare)
- e.g. {numWithUnits(BOOST_MULT * 5, { abbreviate: false })} is like five zap-votes from a maximally trusted stacker
diff --git a/lib/constants.js b/lib/constants.js
index a2feb4df..10ba34f8 100644
--- a/lib/constants.js
+++ b/lib/constants.js
@@ -19,6 +19,7 @@ export const UPLOAD_SIZE_MAX = 50 * 1024 * 1024
export const UPLOAD_SIZE_MAX_AVATAR = 5 * 1024 * 1024
export const BOOST_MULT = 10000
export const BOOST_MIN = BOOST_MULT
+export const BOOST_MAX = 1_000_000
export const IMAGE_PIXELS_MAX = 35000000
// backwards compatibile with old media domain env var and precedence for docker url if set
export const MEDIA_URL = process.env.MEDIA_URL_DOCKER || process.env.NEXT_PUBLIC_MEDIA_URL || `https://${process.env.NEXT_PUBLIC_MEDIA_DOMAIN}`
diff --git a/lib/validate.js b/lib/validate.js
index 98c78da1..5bc4fe7d 100644
--- a/lib/validate.js
+++ b/lib/validate.js
@@ -3,7 +3,8 @@ import {
BOOST_MIN, MAX_POLL_CHOICE_LENGTH, MAX_TITLE_LENGTH, MAX_POLL_NUM_CHOICES,
MIN_POLL_NUM_CHOICES, MAX_FORWARDS, BOOST_MULT, MAX_TERRITORY_DESC_LENGTH, POST_TYPES,
TERRITORY_BILLING_TYPES, MAX_COMMENT_TEXT_LENGTH, MAX_POST_TEXT_LENGTH, MIN_TITLE_LENGTH, BOUNTY_MIN, BOUNTY_MAX,
- RESERVED_SUB_NAMES
+ RESERVED_SUB_NAMES,
+ BOOST_MAX
} from './constants'
import { SUPPORTED_CURRENCIES } from './currency'
import { NOSTR_MAX_RELAY_NUM, NOSTR_PUBKEY_BECH32, NOSTR_PUBKEY_HEX } from './nostr'
@@ -125,10 +126,12 @@ export function advPostSchemaMembers ({ me, existingBoost = 0, ...args }) {
const boostMin = existingBoost || BOOST_MIN
return {
boost: intValidator
- .min(boostMin, `must be ${existingBoost ? '' : 'blank or '}at least ${boostMin}`).test({
+ .min(boostMin, `must be ${existingBoost ? '' : 'blank or '}at least ${numWithUnits(boostMin)}`)
+ .max(BOOST_MAX, `must be less than or equal to ${numWithUnits(BOOST_MAX)}`)
+ .test({
name: 'boost',
test: async boost => (!existingBoost && !boost) || boost % BOOST_MULT === 0,
- message: `must be divisble be ${BOOST_MULT}`
+ message: `must be divisble by ${BOOST_MULT}`
}),
forward: array()
.max(MAX_FORWARDS, `you can only configure ${MAX_FORWARDS} forward recipients`)
@@ -416,6 +419,7 @@ export const boostValidator = intValidator
test: async boost => boost % BOOST_MULT === 0,
message: `must be divisble be ${BOOST_MULT}`
})
+ .max(BOOST_MAX, `must be less than or equal to ${numWithUnits(BOOST_MAX)}`)
export const boostSchema = object({
amount: boostValidator.required('required').positive('must be positive')