Compare commits
6 Commits
657ce1a4f8
...
1d154ec9b5
Author | SHA1 | Date | |
---|---|---|---|
|
1d154ec9b5 | ||
|
1f466970b3 | ||
|
3472670df5 | ||
|
9b98843541 | ||
|
0b07962e1c | ||
|
ba8b37ffb9 |
@ -186,6 +186,7 @@ export default {
|
||||
|
||||
const subs = await models.$queryRawUnsafe(`
|
||||
SELECT "Sub".*,
|
||||
"Sub".created_at as "createdAt",
|
||||
COALESCE(floor(sum(msats_revenue)/1000), 0) as revenue,
|
||||
COALESCE(floor(sum(msats_stacked)/1000), 0) as stacked,
|
||||
COALESCE(floor(sum(msats_spent)/1000), 0) as spent,
|
||||
@ -394,7 +395,8 @@ export default {
|
||||
},
|
||||
meSubscription: async (sub, args, { me, models }) => {
|
||||
return sub.meSubscription || sub.SubSubscription?.length > 0
|
||||
}
|
||||
},
|
||||
createdAt: sub => sub.createdAt || sub.created_at
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -516,8 +516,15 @@ export default function Notifications ({ ssrData }) {
|
||||
const router = useRouter()
|
||||
const dat = useData(data, ssrData)
|
||||
|
||||
const { notifications: { notifications, lastChecked, cursor } } = useMemo(() => {
|
||||
return dat || { notifications: {} }
|
||||
const { notifications, lastChecked, cursor } = useMemo(() => {
|
||||
if (!dat?.notifications) return {}
|
||||
|
||||
// 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])
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -220,6 +220,7 @@ function getClient (uri) {
|
||||
}
|
||||
}),
|
||||
assumeImmutableResults: true,
|
||||
queryDeduplication: true,
|
||||
defaultOptions: {
|
||||
watchQuery: {
|
||||
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
|
||||
if (req.cookies.sn_referrer && user?.id) {
|
||||
const referrer = await prisma.user.findUnique({ where: { name: req.cookies.sn_referrer } })
|
||||
if (referrer) {
|
||||
if (referrer && referrer.id !== Number(user.id)) {
|
||||
await prisma.user.updateMany({ where: { id: user.id, referrerId: null }, data: { referrerId: referrer.id } })
|
||||
notifyReferral(referrer.id)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user