Compare commits
No commits in common. "1d154ec9b5a373247ea55615c2cd1b2de92e7689" and "657ce1a4f8fa9f9485137a75efcb954159962aac" have entirely different histories.
1d154ec9b5
...
657ce1a4f8
@ -186,7 +186,6 @@ export default {
|
|||||||
|
|
||||||
const subs = await models.$queryRawUnsafe(`
|
const subs = await models.$queryRawUnsafe(`
|
||||||
SELECT "Sub".*,
|
SELECT "Sub".*,
|
||||||
"Sub".created_at as "createdAt",
|
|
||||||
COALESCE(floor(sum(msats_revenue)/1000), 0) as revenue,
|
COALESCE(floor(sum(msats_revenue)/1000), 0) as revenue,
|
||||||
COALESCE(floor(sum(msats_stacked)/1000), 0) as stacked,
|
COALESCE(floor(sum(msats_stacked)/1000), 0) as stacked,
|
||||||
COALESCE(floor(sum(msats_spent)/1000), 0) as spent,
|
COALESCE(floor(sum(msats_spent)/1000), 0) as spent,
|
||||||
@ -395,8 +394,7 @@ export default {
|
|||||||
},
|
},
|
||||||
meSubscription: async (sub, args, { me, models }) => {
|
meSubscription: async (sub, args, { me, models }) => {
|
||||||
return sub.meSubscription || sub.SubSubscription?.length > 0
|
return sub.meSubscription || sub.SubSubscription?.length > 0
|
||||||
},
|
}
|
||||||
createdAt: sub => sub.createdAt || sub.created_at
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,15 +516,8 @@ export default function Notifications ({ ssrData }) {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const dat = useData(data, ssrData)
|
const dat = useData(data, ssrData)
|
||||||
|
|
||||||
const { notifications, lastChecked, cursor } = useMemo(() => {
|
const { notifications: { notifications, lastChecked, cursor } } = useMemo(() => {
|
||||||
if (!dat?.notifications) return {}
|
return dat || { notifications: {} }
|
||||||
|
|
||||||
// make sure we're using the oldest lastChecked we've seen
|
|
||||||
const retDat = { ...dat.notifications }
|
|
||||||
if (ssrData?.notifications?.lastChecked < retDat.lastChecked) {
|
|
||||||
retDat.lastChecked = ssrData.notifications.lastChecked
|
|
||||||
}
|
|
||||||
return retDat
|
|
||||||
}, [dat])
|
}, [dat])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -220,7 +220,6 @@ function getClient (uri) {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
assumeImmutableResults: true,
|
assumeImmutableResults: true,
|
||||||
queryDeduplication: true,
|
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
watchQuery: {
|
watchQuery: {
|
||||||
initialFetchPolicy: defaultFetchPolicy,
|
initialFetchPolicy: defaultFetchPolicy,
|
||||||
|
@ -57,7 +57,7 @@ function getCallbacks (req) {
|
|||||||
// this means users can update their referrer if they don't have one, which is fine
|
// this means users can update their referrer if they don't have one, which is fine
|
||||||
if (req.cookies.sn_referrer && user?.id) {
|
if (req.cookies.sn_referrer && user?.id) {
|
||||||
const referrer = await prisma.user.findUnique({ where: { name: req.cookies.sn_referrer } })
|
const referrer = await prisma.user.findUnique({ where: { name: req.cookies.sn_referrer } })
|
||||||
if (referrer && referrer.id !== Number(user.id)) {
|
if (referrer) {
|
||||||
await prisma.user.updateMany({ where: { id: user.id, referrerId: null }, data: { referrerId: referrer.id } })
|
await prisma.user.updateMany({ where: { id: user.id, referrerId: null }, data: { referrerId: referrer.id } })
|
||||||
notifyReferral(referrer.id)
|
notifyReferral(referrer.id)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user