-
Notifications
You must be signed in to change notification settings - Fork 6
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
Gcal Integration #378
base: master
Are you sure you want to change the base?
Gcal Integration #378
Conversation
|
bot/tasks/pennychat.py
Outdated
@@ -197,11 +197,13 @@ def _penny_chat_details_blocks(penny_chat_invitation, mode=None): | |||
if include_calendar_link: | |||
start_date = penny_chat_invitation.date.astimezone(utc).strftime('%Y%m%dT%H%M%SZ') | |||
end_date = (penny_chat_invitation.date.astimezone(utc) + timedelta(hours=1)).strftime('%Y%m%dT%H%M%SZ') | |||
|
|||
description = f'{penny_chat_invitation.description} [Video Link]({penny_chat_invitation.video_conference_link})' |
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.
maybe add a new line? ...description}\n[Video...
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.
Lol, I totally forgot to revisit this. Adding to todos...
Agreed with John on everything here. If we're moving to a .env here, it might also be good to do that for SLACK_API_KEY as well. From a user experience perspective, we might want to include a short blurb on the connection modal detailing what data we access (from what I remember Google's OAuth page for this is very vague) and what benefit they get from connecting Google. ex. Really like the way you structured this in the code, makes it simple to expand on for other integrations. I think the more an app integrates with other existing tools, the more a company or organization is willing to adopt it into that workflow, and starting with this we'll have a lot of room to grow on that idea. |
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.
I think it looks good so far. The main thing I'm wondering about is the user experience in the various paths through this. Would you mind demoing that again this week? (Especially if anything has changed.)
@@ -240,6 +242,45 @@ def _penny_chat_details_blocks(penny_chat_invitation, mode=None): | |||
date_time_block | |||
] | |||
|
|||
if penny_chat_invitation.video_conference_link: |
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.
probably a nit pick, but rather than have 3 sections here, I'd just have a {PREVIEW, INVITE, UPDATE}
section with a parenthetical (A video link will be provided shortly before the chat starts)
and a REMIND
section with the full details.
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.
So just remove the Video Link header from the invite and add parentheses?
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.
yup, just like you did - looks good
integrations/google.py
Outdated
self.calendar_id = calendar_id | ||
|
||
@property | ||
def events(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.
I'm curious, why not just create self.events = self.service.events()
in the init? 🤔 I wonder what calling events()
each time you want self.events
does.
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.
Good point, I should do that instead.
integrations/views.py
Outdated
error = request.GET.get('error') | ||
# TODO: Redirect to frontend page | ||
if error: | ||
return HttpResponse(f"<h1/>There was an error authorizing with Google.</h1><p>{request.GET.get('error')}</p>") |
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.
We should probably log details to sentry here. Probably sentry_sdk.capture_message
since this isn't a raised exception.
Yes, this is correct! I didn't mean to originally commit the wording change on the button. I was messing around with having several modals at one point and forgot to change it back before committing.
I actually moved to this in my latest commit before seeing your message! Great minds, yada yada... @deadbender
My intention isn't for everyone to move to a
The message from Google says that it will allow us to "view and edit events" on their calendar. I think that is clear enough. I will definitely add that language you suggested for the benefits though! |
bot/processors/pennychat.py
Outdated
@@ -9,7 +9,7 @@ | |||
post_organizer_edit_after_share_blocks, | |||
share_penny_chat_invitation, | |||
add_google_meet, | |||
add_google_integration_blocks, | |||
add_google_integration_blocks, update_google_meet, |
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.
nit, new line
def update_google_meet(penny_chat_id): | ||
penny_chat_invitation = PennyChatSlackInvitation.objects.get(id=penny_chat_id) | ||
|
||
calendar = get_user_google_calendar_from_slack_id(penny_chat_invitation.organizer_slack_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.
if the user retracts google permissions then calendar will be None here, add an if calendar is None
here or we'll error on line 112. In this case I guess we just keep the calendar invite as is? (I presume it will still work)
@@ -240,6 +242,45 @@ def _penny_chat_details_blocks(penny_chat_invitation, mode=None): | |||
date_time_block | |||
] | |||
|
|||
if penny_chat_invitation.video_conference_link: |
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.
yup, just like you did - looks good
if credentials: | ||
user = credentials.user | ||
slack_ids = [profile.slack_id for profile in user.social_profiles.all()] | ||
invites = PennyChatSlackInvitation.objects.filter(organizer_slack_id__in=slack_ids, date__gt=timezone.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.
would there ever be any invites with date__gt=timezone.now()
? is this a bug
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.
disregard ... hey this box wine is great!
bot/tasks/pennychat.py
Outdated
f'{urllib.parse.quote(penny_chat_invitation.description)}' | ||
f'{urllib.parse.quote(penny_chat_invitation.title)}&dates=' \ | ||
f'{start_date}/{end_date}&details=' \ | ||
f'{urllib.parse.quote(description)}' |
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 function has grown in complexity, can you pull out the contents of this if statement into it's own helpful func that lives in this file?
Before merging todos:
|
I have submitted to google for verification... And now we wait. |
Opening a draft PR for now. Includes the work that I demoed on Tuesday. Please comment with any concerns!
Some todos:
related
closes #122 because of addition of lru_cache decorator