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

Enable/disable CalDAV calendar synchronization #1091

Merged

Conversation

bertrandda
Copy link
Contributor

@bertrandda bertrandda commented Mar 7, 2021

Pull Request check-list

To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:

  • If your changes affects code, did your write the tests?
  • Are tests passing? (npm test on both front/server)
  • Is the linter passing? (npm run eslint on both front/server)
  • Did you run prettier? (npm run prettier on both front/server)
  • If you are adding a new features/services, did you run integration comparator? (npm run compare-translations on front)
  • If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
  • If you are adding a new features/services which needs explanation, did you modify the user documentation? See the GitHub repo and the website.
  • Did you add fake requests data for the demo mode (front/src/config/demo.json) so that the demo website is working without a backend? (if needed) See https://demo.gladysassistant.com.

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

Add the ability to choose which calendars to synchronize in CalDAV integration.

image
image

@codecov
Copy link

codecov bot commented Mar 7, 2021

Codecov Report

Merging #1091 (c421ef3) into master (8de2652) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1091      +/-   ##
==========================================
+ Coverage   96.41%   96.42%   +0.01%     
==========================================
  Files         640      643       +3     
  Lines        8163     8193      +30     
==========================================
+ Hits         7870     7900      +30     
  Misses        293      293              
Impacted Files Coverage Δ
server/api/controllers/calendar.controller.js 100.00% <100.00%> (ø)
server/lib/calendar/calendar.destroyEvents.js 100.00% <100.00%> (ø)
server/lib/calendar/calendar.get.js 100.00% <100.00%> (ø)
server/lib/calendar/index.js 100.00% <100.00%> (ø)
server/lib/index.js 94.44% <100.00%> (ø)
server/services/caldav/api/caldav.controller.js 100.00% <100.00%> (ø)
...es/caldav/lib/calendar/calendar.disableCalendar.js 100.00% <100.00%> (ø)
...ces/caldav/lib/calendar/calendar.enableCalendar.js 100.00% <100.00%> (ø)
.../caldav/lib/calendar/calendar.syncUserCalendars.js 100.00% <100.00%> (ø)
server/services/caldav/lib/index.js 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8de2652...c421ef3. Read the comment docs.

atrovato
atrovato previously approved these changes Mar 10, 2021
Copy link
Contributor

@atrovato atrovato left a comment

Choose a reason for hiding this comment

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

Looks good to my eyes, but didn't try with real calendars. Please find any testers to confirm it works well.

server/test/lib/calendar/calendar.event.test.js Outdated Show resolved Hide resolved
atrovato
atrovato previously approved these changes Mar 11, 2021
Copy link
Contributor

@atrovato atrovato left a comment

Choose a reason for hiding this comment

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

Good for me, but didn't test in real life.

@VonOx
Copy link
Contributor

VonOx commented Mar 13, 2021

Hi @bertrandda

I've tested this PR with Google calendar

No error in logs, but no event in Gladys Calendar ( Waited from 2H to be sure )

2021-03-13T11:07:15+0100 <info> calendar.cleanUp.js:12 (CalDAVHandler.cleanUp) Start cleaning CalDAV data for user: 8da2b78a-bbbb-4804-b39c-a0a39ed0ca66
2021-03-13T11:07:15+0100 <info> calendar.cleanUp.js:14 (CalDAVHandler.cleanUp) 0 calendars to clean
2021-03-13T11:07:30+0100 <info> calendar.requests.js:52 () CalDAV : Found calendar XXXXXXX@gmail.com
2021-03-13T11:07:30+0100 <info> calendar.requests.js:52 () CalDAV : Found calendar 4CAD
2021-03-13T11:07:30+0100 <info> calendar.requests.js:52 () CalDAV : Found calendar Anniversaires
2021-03-13T11:07:30+0100 <info> calendar.requests.js:52 () CalDAV : Found calendar Jours fériés en France
2021-03-13T11:07:30+0100 <info> calendar.syncUserCalendars.js:38 (CalDAVHandler.syncUserCalendars) CalDAV : Found 4 calendars.
2021-03-13T11:07:34+0100 <info> calendar.syncUserCalendars.js:132 (Promise.map.concurrency) CalDAV : 167 events updated for calendar XXXXXXX@gmail.com.
2021-03-13T11:07:35+0100 <info> calendar.syncUserCalendars.js:132 (Promise.map.concurrency) CalDAV : 57 events updated for calendar Jours fériés en France.
2021-03-13T11:07:37+0100 <info> calendar.syncUserCalendars.js:132 (Promise.map.concurrency) CalDAV : 45 events updated for calendar Anniversaires.
2021-03-13T11:07:42+0100 <info> calendar.syncUserCalendars.js:132 (Promise.map.concurrency) CalDAV : 250 events updated for calendar 4CAD.
2021-03-13T11:07:48+0100 <debug> bluetooth.scanPresence.js:24 (BluetoothManager.scanPresence) Bluetooth: 0 presence sensor features
2021-03-13T11:08:03+0100 <info> calendar.enableCalendar.js:19 (CalDAVHandler.enableCalendar) Calendar jours-feries-en-france disabled & emptied
2021-03-13T11:08:03+0100 <info> calendar.enableCalendar.js:19 (CalDAVHandler.enableCalendar) Calendar anniversaires disabled & emptied
2021-03-13T11:08:26+0100 <info> calendar.requests.js:52 () CalDAV : Found calendar XXXXXXX@gmail.com
2021-03-13T11:08:26+0100 <info> calendar.requests.js:52 () CalDAV : Found calendar 4CAD
2021-03-13T11:08:26+0100 <info> calendar.requests.js:52 () CalDAV : Found calendar Anniversaires
2021-03-13T11:08:26+0100 <info> calendar.requests.js:52 () CalDAV : Found calendar Jours fériés en France
2021-03-13T11:08:26+0100 <info> calendar.syncUserCalendars.js:38 (CalDAVHandler.syncUserCalendars) CalDAV : Found 4 calendars.

@bertrandda
Copy link
Contributor Author

@VonOx There is no error in your logs & I just tried with Google calendar, it seems to work on my side. Can you check your t_calendar_event table in the database ?
To avoid waiting you can force synchronisation in Integrations -> Account -> Sync

@VonOx
Copy link
Contributor

VonOx commented Mar 13, 2021

Seem's to be a problem with my instance/google calendar.

PR is ok !

VonOx
VonOx previously approved these changes Mar 13, 2021
* @apiName Enable
* @apiGroup CalDAV
*/
async function enable(req, res) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's weird to have an "enable" function that either enable or disable

Either you have a PATCH calendar API call (simple), or either you have a "enable" + "disable" route.

Pick one :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I chose to split in 2 routes because we need actions after disabling

Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

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

See my comments :)

@bertrandda bertrandda dismissed stale reviews from VonOx and atrovato via eaaf5cb April 16, 2021 09:48
Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Just one change, I just merged this PR: #1133

And we can no longer use this.context.intl.dictionary in the front, but instead we use a HoC component to inject the dictionnary as props :)

Could you make the change in this PR? (see the PR to see how to do it, it's pretty easy)

Thanks for your PR!

Copy link
Contributor

@atrovato atrovato left a comment

Choose a reason for hiding this comment

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

Code is great enough for me.

Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

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

Tested locally, works fine!

@Pierre-Gilles Pierre-Gilles merged commit 0141aeb into GladysAssistant:master May 3, 2021
@bertrandda bertrandda deleted the feature/caldav-disable-sync branch May 3, 2021 10:21
Jean-PhilippeD pushed a commit to Jean-PhilippeD/Gladys that referenced this pull request Oct 13, 2021
)


Co-authored-by: Pierre-Gilles Leymarie <pierregilles.leymarie@gmail.com>
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.

None yet

4 participants