set boost max (#2109)
* set boost max * reduce max and apply to boost act * make boost position aware paid action state --------- Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com> Co-authored-by: k00b <k00b@stacker.news>
This commit is contained in:
parent
ab87ad5b11
commit
5965b3d090
@ -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) }
|
||||
|
@ -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 () {
|
||||
<li>The highest boost in a territory over the last 30 days is pinned to the top of the territory</li>
|
||||
<li>The highest boost across all territories over the last 30 days is pinned to the top of the homepage</li>
|
||||
<li>The minimum boost is {numWithUnits(BOOST_MIN, { abbreviate: false })}</li>
|
||||
<li>The maximum boost is {numWithUnits(BOOST_MAX, { abbreviate: false })}</li>
|
||||
<li>Each {numWithUnits(BOOST_MULT, { abbreviate: false })} of boost is equivalent to a zap-vote from a maximally trusted stacker (very rare)
|
||||
<ul>
|
||||
<li>e.g. {numWithUnits(BOOST_MULT * 5, { abbreviate: false })} is like five zap-votes from a maximally trusted stacker</li>
|
||||
|
@ -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}`
|
||||
|
@ -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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user