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

zulip-integrations: Update google oauth and reminders for google calendar integration. #850

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

theofficialvedantjoshi
Copy link

The oauth2client library used in the google-calendar integration scripts has become deprecated. This PR updates the script to replace oauth2client with other libraries that Google is now using, specifically google-auth-httplib2 and google-auth-oauthlib.

Fixes: #847

How did you test this PR?

  • Generated a client_secret.json file from a test Google Cloud application that uses the calendar API.
  • Verified the authentication process and the creation of google-credentials.json in the home directory.
  • Tested each flag in the argument parser by specifying the hostname and port.
  • Tested the no-local-sever-auth flow in the console after obtaining an authentication code from my application's redirect URL.
Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

@theofficialvedantjoshi theofficialvedantjoshi force-pushed the update-google-calendar-authentication branch from 2249012 to af1090e Compare January 8, 2025 18:23
@theofficialvedantjoshi
Copy link
Author

@timabbott could you please review this PR?

@alya
Copy link
Contributor

alya commented Jan 9, 2025

@Niloth-p It would be great to get your review on this one.

@theofficialvedantjoshi
Copy link
Author

@Niloth-p any updates?

@theofficialvedantjoshi
Copy link
Author

@timabbott @Niloth-p anything pending in this pr?

@Niloth-p
Copy link
Contributor

Hi, @theofficialvedantjoshi, apologies for the delay in getting back.

Thank you for the PR!
The new libraries definitely work.
Only on testing the integration, I discovered that the integration needs dozens more fixes and clean ups, apart from the library replacement, before it's ready for use. So, I have a local branch in progress, but it's unfortunately taking longer than expected, due to other priorities. I'll be absorbing this PR as part of that and give you co-author credits for this commit.

If you're interested in working more on this integration, it would be helpful if you could help improve the message being generated, by adding separate commit(s) on top of this PR. Here are some ways we can improve the message:

  1. Adding more details to the messages generated would be essential. It currently just sends <event_name> starts at <time>, that's it. We need to be adding more details to make the integration up to par with all the other notification modes, by using the below fields that Google Calendar provides:
    • the event description
    • the htmlLink - to the event in the Google Calendar Web UI
    • time the event ends
    • additional info fields when present - formatted into a sentence (Use other Google Calendar notifications for inspiration):
      • status
      • location
      • eventType
      • hangoutLink
      • organizer.displayName (if organizer.self is not set, i.e., the organizer is not the owner of the calendar)
  2. The script currently sends reminders only x minutes before, and x applies to all events. But, Google Calendar has a property reminders.overrides.minutes that tracks the duration before which the user has requested a notification for. This needs to be used whenever available.
  3. The script sends reminders on every single event. Google Calendar supports reminders.overrides to turn off notifications for particular events. We should too.
  4. Events without a title do not get a notification currently. It should instead create events with the title as "(No title)", like Google Calendar typically does.

@theofficialvedantjoshi
Copy link
Author

theofficialvedantjoshi commented Jan 30, 2025

Hi @Niloth-p, thanks for the review.

I am interested in working more on this integration. I'll set things up locally and add the features mentioned above.
Will keep updating this thread if I have any doubts.

I am also interested in participating in GSoC 2025 with zulip. Will you be mentoring this time? Will contributions to this repository add value to my proposal?

@Niloth-p
Copy link
Contributor

Glad to hear that.
Questions like these are better discussed and answered in https://chat.zulip.org/.

Contributions to this repo do count as much as any other Zulip repo.
But, have you taken a look at the proposed project ideas? In general, it would help to have some contributions in the same part of the codebase as the project you plan to propose for.

Though I anticipate being involved with any GSoC contributors working on Zulip integrations, and the set of integrations here in this repo could do with a lot of improvements, the priorities of GSoC contributions and project proposals is not my domain, the GSoC channel is a much better place to get info regarding that.

@zulipbot
Copy link
Member

zulipbot commented Feb 6, 2025

Hello @theofficialvedantjoshi, it seems like you have referenced #847 in your pull request description, but you have not referenced them in your commit message description(s). Referencing an issue in a commit message automatically closes the corresponding issue when the commit is merged, which makes the issue tracker easier to manage.

Please run git commit --amend in your command line client to amend your commit message description with Fixes #847..

An example of a correctly-formatted commit:

commit fabd5e450374c8dde65ec35f02140383940fe146
Author: zulipbot
Date:   Sat Mar 18 13:42:40 2017 -0700

    pull requests: Check PR commits reference when issue is referenced.

    Fixes #51.

To learn how to write a great commit message, please refer to our guide.

@theofficialvedantjoshi theofficialvedantjoshi force-pushed the update-google-calendar-authentication branch from 3626384 to 50a9579 Compare February 6, 2025 17:32
@theofficialvedantjoshi
Copy link
Author

theofficialvedantjoshi commented Feb 6, 2025

Added the following details to the reminder messages being sent:

  • time interval
  • status
  • location
  • hangoutLink
  • organizer.displayName (if organizer.self is not set, i.e., the organizer is not the owner of the calendar)
  • htmlLink

Also, events without a title are shown as "(No title)".

image
image

@theofficialvedantjoshi
Copy link
Author

Will be working on features related to reminder.overrides next.

@theofficialvedantjoshi
Copy link
Author

Fixed reminder logic to respect Google Calendar's reminders.overrides

  • Implemented event-specific reminder times by leveraging reminders.overrides.minutes when available.
  • Added support for reminders.useDefault, pulling default calendar reminders if event overrides are absent.
  • Introduced an --override option to force a uniform reminder time for all events.
  • Modified event handling to prevent reminders for past events.
  • Optimized event processing by sorting and iterating based on reminder time.

@theofficialvedantjoshi theofficialvedantjoshi changed the title zulip-integrations: Update google oauth for google calendar integration. zulip-integrations: Update google oauth and reminders for google calendar integration. Feb 7, 2025
@theofficialvedantjoshi
Copy link
Author

@Niloth-p @alya could you please review the updated code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the Google Calendar integration
4 participants