Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Referral Notifications #1211

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions api/resolvers/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,29 +252,6 @@ export default {
)
}

if (meFull.noteInvites) {
queries.push(
`(SELECT "Invite".id, MAX(users.created_at) AS "sortTime", NULL as "earnedSats",
'Invitification' AS type
FROM users JOIN "Invite" on users."inviteId" = "Invite".id
WHERE "Invite"."userId" = $1
AND users.created_at < $2
GROUP BY "Invite".id
ORDER BY "sortTime" DESC
LIMIT ${LIMIT})`
)
Comment on lines -256 to -265
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to keep these ones. It's just the referrals we are axing.

queries.push(
`(SELECT users.id::text, users.created_at AS "sortTime", NULL as "earnedSats",
'Referral' AS type
FROM users
WHERE "users"."referrerId" = $1
AND "inviteId" IS NULL
AND users.created_at < $2
ORDER BY "sortTime" DESC
LIMIT ${LIMIT})`
)
}

if (meFull.noteEarning) {
queries.push(
`(SELECT min(id)::text, created_at AS "sortTime", FLOOR(sum(msats) / 1000) as "earnedSats",
Expand Down
27 changes: 0 additions & 27 deletions api/resolvers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,33 +449,6 @@ export default {
}
}

// check if new invites have been redeemed
if (user.noteInvites) {
const [newInvites] = await models.$queryRawUnsafe(`
SELECT EXISTS(
SELECT *
FROM users JOIN "Invite" on users."inviteId" = "Invite".id
WHERE "Invite"."userId" = $1
AND users.created_at > $2)`, me.id, lastChecked)
if (newInvites.exists) {
foundNotes()
return true
}
Comment on lines -454 to -463
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, we want to keep the invites.


const referral = await models.user.findFirst({
where: {
referrerId: me.id,
createdAt: {
gt: lastChecked
}
}
})
if (referral) {
foundNotes()
return true
}
}

if (user.noteCowboyHat) {
const streak = await models.streak.findFirst({
where: {
Expand Down
2 changes: 0 additions & 2 deletions api/typeDefs/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export default gql`
noteWithdrawals: Boolean!,
noteEarning: Boolean!
noteForwardedSats: Boolean!
noteInvites: Boolean!
noteItemSats: Boolean!
noteJobIndicator: Boolean!
noteMentions: Boolean!
Expand Down Expand Up @@ -158,7 +157,6 @@ export default gql`
noteWithdrawals: Boolean!
noteEarning: Boolean!
noteForwardedSats: Boolean!
noteInvites: Boolean!
noteItemSats: Boolean!
noteJobIndicator: Boolean!
noteMentions: Boolean!
Expand Down
2 changes: 0 additions & 2 deletions fragments/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const ME = gql`
noteWithdrawals
noteEarning
noteForwardedSats
noteInvites
noteItemSats
noteJobIndicator
noteMentions
Expand Down Expand Up @@ -77,7 +76,6 @@ export const SETTINGS_FIELDS = gql`
noteItemMentions
noteDeposits
noteWithdrawals
noteInvites
noteJobIndicator
noteCowboyHat
noteForwardedSats
Expand Down
2 changes: 0 additions & 2 deletions lib/webPush.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ const createUserFilter = (tag) => {
ITEM_MENTION: 'noteItemMentions',
TIP: 'noteItemSats',
FORWARDEDTIP: 'noteForwardedSats',
REFERRAL: 'noteInvites',
INVITE: 'noteInvites',
EARN: 'noteEarning',
DEPOSIT: 'noteDeposits',
WITHDRAWAL: 'noteWithdrawals',
Expand Down
6 changes: 0 additions & 6 deletions pages/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export default function Settings ({ ssrData }) {
noteItemMentions: settings?.noteItemMentions,
noteDeposits: settings?.noteDeposits,
noteWithdrawals: settings?.noteWithdrawals,
noteInvites: settings?.noteInvites,
noteJobIndicator: settings?.noteJobIndicator,
noteCowboyHat: settings?.noteCowboyHat,
noteForwardedSats: settings?.noteForwardedSats,
Expand Down Expand Up @@ -262,11 +261,6 @@ export default function Settings ({ ssrData }) {
name='noteAllDescendants'
groupClassName='mb-0'
/>
<Checkbox
label='someone joins using my invite or referral links'
name='noteInvites'
groupClassName='mb-0'
/>
<Checkbox
label='sats are deposited in my account'
name='noteDeposits'
Expand Down
Loading