Compare commits

..

No commits in common. "1d154ec9b5a373247ea55615c2cd1b2de92e7689" and "657ce1a4f8fa9f9485137a75efcb954159962aac" have entirely different histories.

5 changed files with 5 additions and 15 deletions

View File

@ -186,7 +186,6 @@ 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,
@ -395,8 +394,7 @@ export default {
},
meSubscription: async (sub, args, { me, models }) => {
return sub.meSubscription || sub.SubSubscription?.length > 0
},
createdAt: sub => sub.createdAt || sub.created_at
}
}
}

View File

@ -516,15 +516,8 @@ export default function Notifications ({ ssrData }) {
const router = useRouter()
const dat = useData(data, ssrData)
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
const { notifications: { notifications, lastChecked, cursor } } = useMemo(() => {
return dat || { notifications: {} }
}, [dat])
useEffect(() => {

View File

@ -43,7 +43,7 @@ export function TerritoryInfo ({ sub }) {
<Link href={`/${sub.user.name}`}>
@{sub.user.name}<span> </span><Hat className='fill-grey' user={sub.user} height={12} width={12} />
</Link>
<span> on </span>
<span>on </span>
<span className='fw-bold'>{new Date(sub.createdAt).toDateString()}</span>
</div>
<div className='text-muted'>

View File

@ -220,7 +220,6 @@ function getClient (uri) {
}
}),
assumeImmutableResults: true,
queryDeduplication: true,
defaultOptions: {
watchQuery: {
initialFetchPolicy: defaultFetchPolicy,

View File

@ -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 && referrer.id !== Number(user.id)) {
if (referrer) {
await prisma.user.updateMany({ where: { id: user.id, referrerId: null }, data: { referrerId: referrer.id } })
notifyReferral(referrer.id)
}