Add setting for no referral links on copy

This commit is contained in:
ekzyis 2024-03-17 15:57:50 +01:00
parent b451ecaf8c
commit 2ba4063645
7 changed files with 17 additions and 2 deletions

View File

@ -64,6 +64,7 @@ export default gql`
input SettingsInput {
autoDropBolt11s: Boolean!
diagnostics: Boolean!
noReferralLinks: Boolean!
fiatCurrency: String!
greeterMode: Boolean!
hideBookmarks: Boolean!
@ -128,6 +129,7 @@ export default gql`
"""
autoDropBolt11s: Boolean!
diagnostics: Boolean!
noReferralLinks: Boolean!
fiatCurrency: String!
greeterMode: Boolean!
hideBookmarks: Boolean!

View File

@ -9,7 +9,8 @@ import { commentSubTreeRootId } from '../lib/item'
import { useRouter } from 'next/router'
const referrurl = (ipath, me) => {
const path = `${ipath}${me ? `/r/${me.name}` : ''}`
const referral = me && !me.privates?.noReferralLinks
const path = `${ipath}${referral ? `/r/${me.name}` : ''}`
if (!SSR) {
return `${window.location.protocol}//${window.location.host}${path}`
}

View File

@ -12,6 +12,7 @@ export const ME = gql`
privates {
autoDropBolt11s
diagnostics
noReferralLinks
fiatCurrency
greeterMode
hideCowboyHat
@ -87,6 +88,7 @@ export const SETTINGS_FIELDS = gql`
imgproxyOnly
hideWalletBalance
diagnostics
noReferralLinks
nostrPubkey
nostrCrossposting
nostrRelays

View File

@ -531,6 +531,7 @@ export const settingsSchema = object({
hideTwitter: boolean(),
hideWalletBalance: boolean(),
diagnostics: boolean(),
noReferralLinks: boolean(),
hideIsContributor: boolean()
})

View File

@ -94,7 +94,8 @@ export default function Settings ({ ssrData }) {
hideBookmarks: settings?.hideBookmarks,
hideWalletBalance: settings?.hideWalletBalance,
diagnostics: settings?.diagnostics,
hideIsContributor: settings?.hideIsContributor
hideIsContributor: settings?.hideIsContributor,
noReferralLinks: settings?.noReferralLinks
}}
schema={settingsSchema}
onSubmit={async ({ tipDefault, withdrawMaxFeeDefault, nostrPubkey, nostrRelays, ...values }) => {
@ -410,6 +411,11 @@ export default function Settings ({ ssrData }) {
</div>
}
name='diagnostics'
groupClassName='mb-0'
/>
<Checkbox
label={<>don't create referral links on copy</>}
name='noReferralLinks'
/>
<div className='form-label'>content</div>
<Checkbox

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "users" ADD COLUMN "noReferralLinks" BOOLEAN NOT NULL DEFAULT false;

View File

@ -98,6 +98,7 @@ model User {
hideGithub Boolean @default(true)
hideNostr Boolean @default(true)
hideTwitter Boolean @default(true)
noReferralLinks Boolean @default(false)
githubId String?
twitterId String?
followers UserSubscription[] @relation("follower")