optionally hide invoice descriptions
This commit is contained in:
parent
0ad886ffc0
commit
172d6c3c2f
|
@ -186,7 +186,7 @@ export default {
|
|||
const description = `${amount} sats for @${user.name} on stacker.news`
|
||||
try {
|
||||
const invoice = await createInvoice({
|
||||
description,
|
||||
description: user.hideInvoiceDesc ? undefined : description,
|
||||
lnd,
|
||||
tokens: amount,
|
||||
expires_at: expiresAt
|
||||
|
|
|
@ -30,7 +30,7 @@ export default gql`
|
|||
setName(name: String!): Boolean
|
||||
setSettings(tipDefault: Int!, noteItemSats: Boolean!, noteEarning: Boolean!,
|
||||
noteAllDescendants: Boolean!, noteMentions: Boolean!, noteDeposits: Boolean!,
|
||||
noteInvites: Boolean!, noteJobIndicator: Boolean!): Boolean
|
||||
noteInvites: Boolean!, noteJobIndicator: Boolean!, hideInvoiceDesc: Boolean!): Boolean
|
||||
setPhoto(photoId: ID!): Int!
|
||||
upsertBio(bio: String!): User!
|
||||
setWalkthrough(tipPopover: Boolean, upvotePopover: Boolean): Boolean
|
||||
|
@ -70,6 +70,7 @@ export default gql`
|
|||
noteDeposits: Boolean!
|
||||
noteInvites: Boolean!
|
||||
noteJobIndicator: Boolean!
|
||||
hideInvoiceDesc: Boolean!
|
||||
lastCheckedJobs: String
|
||||
authMethods: AuthMethods!
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ export const ME = gql`
|
|||
noteDeposits
|
||||
noteInvites
|
||||
noteJobIndicator
|
||||
hideInvoiceDesc
|
||||
lastCheckedJobs
|
||||
}
|
||||
}`
|
||||
|
@ -48,6 +49,7 @@ export const ME_SSR = gql`
|
|||
noteDeposits
|
||||
noteInvites
|
||||
noteJobIndicator
|
||||
hideInvoiceDesc
|
||||
lastCheckedJobs
|
||||
}
|
||||
}`
|
||||
|
@ -63,6 +65,7 @@ export const SETTINGS = gql`
|
|||
noteDeposits
|
||||
noteInvites
|
||||
noteJobIndicator
|
||||
hideInvoiceDesc
|
||||
authMethods {
|
||||
lightning
|
||||
email
|
||||
|
|
|
@ -20,7 +20,7 @@ export default async ({ query: { username, amount } }, res) => {
|
|||
const descriptionHash = lnurlPayDescriptionHashForUser(username)
|
||||
try {
|
||||
const invoice = await createInvoice({
|
||||
description,
|
||||
description: user.hideInvoiceDesc ? undefined : description,
|
||||
description_hash: descriptionHash,
|
||||
lnd,
|
||||
mtokens: amount,
|
||||
|
|
|
@ -11,6 +11,7 @@ import ModalButton from '../components/modal-button'
|
|||
import { LightningAuth } from '../components/lightning-auth'
|
||||
import { SETTINGS } from '../fragments/users'
|
||||
import { useRouter } from 'next/router'
|
||||
import Info from '../components/info'
|
||||
|
||||
export const getServerSideProps = getGetServerSideProps(SETTINGS)
|
||||
|
||||
|
@ -31,11 +32,11 @@ export default function Settings ({ data: { settings } }) {
|
|||
gql`
|
||||
mutation setSettings($tipDefault: Int!, $noteItemSats: Boolean!, $noteEarning: Boolean!,
|
||||
$noteAllDescendants: Boolean!, $noteMentions: Boolean!, $noteDeposits: Boolean!,
|
||||
$noteInvites: Boolean!, $noteJobIndicator: Boolean!) {
|
||||
$noteInvites: Boolean!, $noteJobIndicator: Boolean!, $hideInvoiceDesc: Boolean!) {
|
||||
setSettings(tipDefault: $tipDefault, noteItemSats: $noteItemSats,
|
||||
noteEarning: $noteEarning, noteAllDescendants: $noteAllDescendants,
|
||||
noteMentions: $noteMentions, noteDeposits: $noteDeposits, noteInvites: $noteInvites,
|
||||
noteJobIndicator: $noteJobIndicator)
|
||||
noteJobIndicator: $noteJobIndicator, hideInvoiceDesc: $hideInvoiceDesc)
|
||||
}`
|
||||
)
|
||||
|
||||
|
@ -57,7 +58,8 @@ export default function Settings ({ data: { settings } }) {
|
|||
noteMentions: settings?.noteMentions,
|
||||
noteDeposits: settings?.noteDeposits,
|
||||
noteInvites: settings?.noteInvites,
|
||||
noteJobIndicator: settings?.noteJobIndicator
|
||||
noteJobIndicator: settings?.noteJobIndicator,
|
||||
hideInvoiceDesc: settings?.hideInvoiceDesc
|
||||
}}
|
||||
schema={SettingsSchema}
|
||||
onSubmit={async ({ tipDefault, ...values }) => {
|
||||
|
@ -108,6 +110,25 @@ export default function Settings ({ data: { settings } }) {
|
|||
label='there is a new job'
|
||||
name='noteJobIndicator'
|
||||
/>
|
||||
<div className='form-label'>privacy</div>
|
||||
<Checkbox
|
||||
label={
|
||||
<>hide invoice descriptions
|
||||
<Info>
|
||||
<ul className='font-weight-bold'>
|
||||
<li>Use this if you don't want funding sources to be linkable to your SN identity.</li>
|
||||
<li>It makes your invoice descriptions blank.</li>
|
||||
<li>This only applies invoices you create
|
||||
<ul>
|
||||
<li>lnurl-pay or lightning addresses still reference your nym</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</Info>
|
||||
</>
|
||||
}
|
||||
name='hideInvoiceDesc'
|
||||
/>
|
||||
<div className='d-flex'>
|
||||
<SubmitButton variant='info' className='ml-auto mt-1 px-4'>save</SubmitButton>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "users" ADD COLUMN "hideInvoiceDesc" BOOLEAN NOT NULL DEFAULT false;
|
|
@ -56,6 +56,9 @@ model User {
|
|||
noteInvites Boolean @default(true)
|
||||
noteJobIndicator Boolean @default(true)
|
||||
|
||||
// privacy settings
|
||||
hideInvoiceDesc Boolean @default(false)
|
||||
|
||||
Earn Earn[]
|
||||
Upload Upload[] @relation(name: "Uploads")
|
||||
PollVote PollVote[]
|
||||
|
|
Loading…
Reference in New Issue