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

Reminder #48

Merged
merged 7 commits into from
Aug 7, 2023
Merged

Reminder #48

merged 7 commits into from
Aug 7, 2023

Conversation

jho44
Copy link
Collaborator

@jho44 jho44 commented Aug 6, 2023

moved sendNotif to lib/server and start cron job in hooks.server.ts

added PUBLIC_URL to GHA

  • apologies on not doing it sooner -- apparently there was a gitpod permission gatekeeper which I have resolved ouo

@jho44
Copy link
Collaborator Author

jho44 commented Aug 6, 2023

@lilith i've gotten the test.yml file closer to where we need it to be but it's still missing some env vars :')

could you set these as github secrets and add them to test.yml? o.o
TWILIO_MESSAGING_SERVICE_SID
TWILIO_PHONE_NUMBER
TWILIO_ACCOUNT_SID
TWILIO_API_SECRET

lmk if you'd like me to msg you what vals i used~

@jho44 jho44 requested a review from lilith August 6, 2023 08:56
@lilith
Copy link
Owner

lilith commented Aug 6, 2023

For the intergration tests, how do we ensure that the api is disabled?

@jho44
Copy link
Collaborator Author

jho44 commented Aug 6, 2023

For the intergration tests, how do we ensure that the api is disabled?

I'm a bit confused. are you asking how we know whether the api is disabled for non-authenticated queries to our endpoints?

@lilith
Copy link
Owner

lilith commented Aug 6, 2023 via email

@jho44
Copy link
Collaborator Author

jho44 commented Aug 6, 2023

Sorry. I mean when we run yarn test, will any SMSes be sent? The keys I put into github should likely be sandbox mode or something

Ah I see. Yeah as long as you use the test keys, we should be fine. I never got a login link SMS to my personal number while i was testing

@lilith
Copy link
Owner

lilith commented Aug 6, 2023 via email

src/lib/server/twilio.ts Outdated Show resolved Hide resolved
@lilith
Copy link
Owner

lilith commented Aug 6, 2023

Github Actions is now working

@lilith
Copy link
Owner

lilith commented Aug 7, 2023 via email

@lilith
Copy link
Owner

lilith commented Aug 7, 2023 via email

@jho44
Copy link
Collaborator Author

jho44 commented Aug 7, 2023

If it expires it still populates the phone number field, right?

On Mon, Aug 7, 2023, 12:49 AM Jessica Ho @.> wrote: @.* commented on this pull request. ------------------------------ In src/lib/server/twilio.ts <#48 (comment)>: > @@ -94,12 +94,24 @@ const msgToSend = async ( msg = Thanks for subscribing to reminders and friend availability notifications from ${url}! You can disable this at any time on your Profile page or by responding STOP.; break; } + case 'reminder': { + const { phone } = msgComps; + msg = Hi! It's your periodic reminder to update your schedule: [https://playdate.help/login/${phone}](https://playdate.help/login/%24%7Bphone%7D%60) <https://playdate.help/login/$%7Bphone%7D>; mmm yeah we can do that. the only downside is the session could expire between when the reminder is sent and when the user finally clicks on the link but i think that's fine — Reply to this email directly, view it on GitHub <#48 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LH5H2KVOLEJ5BOZXHQDXUCFWHANCNFSM6AAAAAA3FYNZEE . You are receiving this because you were mentioned.Message ID: @.***>

If it expires it still populates the phone number field, right?

At the moment, I don't think so. it just redirects you back to the homepage

@jho44
Copy link
Collaborator Author

jho44 commented Aug 7, 2023

We should add a test for how an expired link behaves. I am getting a 500

I'll try it now 👀

@lilith
Copy link
Owner

lilith commented Aug 7, 2023 via email

@gitguardian
Copy link

gitguardian bot commented Aug 7, 2023

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id Secret Commit Filename
7593429 Generic High Entropy Secret b4eef1d prisma/seed.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@jho44
Copy link
Collaborator Author

jho44 commented Aug 7, 2023

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request

GitGuardian id Secret Commit Filename
7593429 Generic High Entropy Secret b4eef1d prisma/seed.ts View secret
🛠 Guidelines to remediate hardcoded secrets
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.Our GitHub checks need improvements? Share your feedbacks!

this is just the token for testing an expired magic link

@@ -263,13 +265,19 @@ export const getMsg = async (url: URL) => {
return response;
};

function shuffleArr(arr: any[]) {
for (let i = arr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
Copy link
Owner

Choose a reason for hiding this comment

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

If Math.random() ever returns exactly 1 (rare but possible), this will fail with out of bounds if it happens on the first iteration

Copy link
Owner

Choose a reason for hiding this comment

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

Nevermind, if this is the browser-compliant Math.random() it excludes one. Carry on

@lilith
Copy link
Owner

lilith commented Aug 7, 2023

This causes schedule slippage if the message isn't sent on the second every time. Rather than using 'now', use the reminderDateTime from the db and change the date. Make sure all time zone logic is consistent and stored times are in UTC (otherwise doing math across DST will cause a mess).

const newReminderDate = new Date(now);
newReminderDate.setDate(newReminderDate.getDate() + reminderIntervalDays);

@lilith lilith merged commit c82969d into main Aug 7, 2023
3 checks passed
@lilith
Copy link
Owner

lilith commented Aug 7, 2023

I'm merging so I can do more UX testing, feel free to push the reminder date fix tho

@jho44 jho44 deleted the reminder branch August 7, 2023 21:49
@jho44 jho44 mentioned this pull request Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants