-
Notifications
You must be signed in to change notification settings - Fork 9
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
Short URLs #465
Short URLs #465
Conversation
* Move generate slug to repo function * Add migration to generate missing slugs * Add function to retrieve signed url from slug * Accidentally lint some more files * Adjust naming of bookingView params * If a user goes to bookingView with just scheduleOrSlug, it will look up the signed url and then request schedule from that
return time_of_save.astimezone(zoneinfo.ZoneInfo(self.calendar.owner.timezone)).time() | ||
|
||
@cached_property | ||
def owner(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convenience property
@@ -101,6 +101,16 @@ def refresh_signature(db: Session = Depends(get_db), subscriber: Subscriber = De | |||
subscriber.id, | |||
) | |||
|
|||
# Update schedule slugs as well! | |||
# This is temp until we figure this flow out | |||
schedules = repo.schedule.get_by_subscriber(db, subscriber.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we have multiple schedules we'll have to figure out a better flow for showing personal links and such. I assume we'll have one "General availability" schedule, but that's for future us!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far!
return schedule.slug | ||
|
||
|
||
def delete(db: Session, schedule_id: int): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep naming actual delete functions hard_delete
?
* Always require namespacing by username for availability * New function to lookup subscriber by schedule slug or signed url
* Add tooltips to text-buttons, they trigger on hover and focus.
* Add slug to schedule's test factory. * Add tests for most auth dependencies.
I still need to rebase the linting changes, but it's ready for review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: I first had issues with the migration, but running run-command main update-db
solved it. Sorry for the hazzle 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works! Thanks!
@@ -1,13 +1,14 @@ | |||
"""Module: repo.subscriber | |||
|
|||
Repository providing CRUD functions for subscriber database models. | |||
Repository providing CRUD functions for subscriber database models. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a linter issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly my cat's doing 🤔
if len(match) > 1: | ||
signature = match[1] | ||
clean_url = clean_url.replace(signature, '') | ||
username, signature, clean_url = utils.retrieve_user_url_data(url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you for moving that to utils
send_confirmation_email, url=url, attendee_name=attendee.name, date=date, to=subscriber.preferred_email | ||
send_confirmation_email, url=url, attendee_name=attendee.name, attendee_email=attendee.email, date=date, | ||
to=subscriber.preferred_email |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not really related to this PR, but I found this during testing and decided to just fix it. Somehow we missed providing the attendee email which resulted in an error which was thrown on booking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes #369
This PR introduces schedule slugs and the ability to view availability using a schedule slug.
We'll phase out signed urls for the booking page eventually, and the user currently cannot customize a schedule slug, but this is a first step into making the "my link" small. I've also increased the space the "my link" textbox has by moving the copy button to a tooltip.
(Note: I have short links disabled on local dev, so on stage/prod it won't show the /user/ part.)
When you refresh your link, all schedule slugs will also be refreshed. Basically we shouldn't even see the booking signed urls anymore.