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

feat: Ability to invite circles #5420

Merged
merged 1 commit into from
Dec 5, 2023
Merged

Conversation

onny
Copy link

@onny onny commented Aug 18, 2023

This commit adds support for adding circles as attendees to a calendar event.
The relationship between the imported group and members will be compliant with
the iCal specification.

A circle with the title "testcircle" will be added as an attendee with iCal
attributes "CUTYPE=GROUP` and uri "mailto:circle+CIRCLEID@CIRCLE_INSTANCE".

Members of the circle will be imported as standard attendees. Each member gets
assigned to the circle group entry by assigning them to the group uri using the
iCal member property: "MEMBER='mailto:circle+CIRCLEID@CIRCLE_INSTANCE'".

Searching for circles is only enabled if the circles app is activated.

Circles added to the list of attendees get imported only once and are not
synced yet. While adding a circle, a notice about this is shown to the user.
Only members of local circles which are local users get imported.

Rendering groups in the frontend is done in a separate PR
https://github.com/nextcloud/calendar/pull/5396

image

Closes #2954

Work inspired by @tcitworld PR #4742

@st3iny
Copy link
Member

st3iny commented Sep 5, 2023

Hey, I just saw this PR and wanted to thank you for tackling this. Could you please add more context to the PR so that we can proceed, e.g what needs to be done and a short description?

It certainly is a nice feature :)

@onny onny force-pushed the invite-circles branch 7 times, most recently from 7dda494 to 201aa4d Compare September 30, 2023 09:00
@codecov
Copy link

codecov bot commented Sep 30, 2023

Codecov Report

Attention: 71 lines in your changes are missing coverage. Please review.

Comparison is base (83bb7be) 24.67% compared to head (df2d51b) 24.53%.
Report is 1 commits behind head on main.

Files Patch % Lines
.../components/Editor/Invitees/InviteesListSearch.vue 0.00% 36 Missing ⚠️
src/services/circleService.js 0.00% 22 Missing ⚠️
src/components/Editor/Invitees/InviteesList.vue 0.00% 9 Missing ⚠️
src/store/calendarObjectInstance.js 0.00% 3 Missing ⚠️
src/services/isCirclesEnabled.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5420      +/-   ##
============================================
- Coverage     24.67%   24.53%   -0.15%     
- Complexity      406      418      +12     
============================================
  Files           241      243       +2     
  Lines         10693    10785      +92     
  Branches       1739     1755      +16     
============================================
+ Hits           2639     2646       +7     
- Misses         8054     8139      +85     
Flag Coverage Δ
javascript 15.57% <0.00%> (-0.10%) ⬇️
php 61.60% <ø> (-0.77%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@onny onny force-pushed the invite-circles branch 4 times, most recently from 6abd2d6 to 2801294 Compare October 2, 2023 14:43
@onny
Copy link
Author

onny commented Oct 2, 2023

Hey, I just saw this PR and wanted to thank you for tackling this. Could you please add more context to the PR so that we can proceed, e.g what needs to be done and a short description?

It certainly is a nice feature :)

Tank you for your interest. Currently thinking on how to query circle information and the circle members with their email addresses all at once with one request. Propably I'll have to add an additional backend controller / api?

@onny onny marked this pull request as ready for review October 8, 2023 11:51
@onny onny force-pushed the invite-circles branch 2 times, most recently from a14695b to 7da0c49 Compare October 8, 2023 14:31
@onny
Copy link
Author

onny commented Oct 9, 2023

This is the current state of both PRs combined (rendering groups & invite circles) 🥳

nextcloud-calendar-invite-circles

@onny
Copy link
Author

onny commented Oct 16, 2023

@miaulalala @jancborchardt @nimishavijay @tcitworld @st3iny I tested and simplified the PR a bit more, would be nice to know if there's anything missing :)

Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

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

Looks very nice! Only a small wording notice: In the search suggestions it says "Contains 3 contacts" in the subline, but when the Circle is added it says "3 members".
The latter is nicer and I would recommend to also shorten & simplify the subline of the search suggestion to " 3 members". Then it's consistent. :)

@onny
Copy link
Author

onny commented Oct 18, 2023

Thank you for reviewing :) Fixed it!

image

Copy link
Contributor

@miaulalala miaulalala left a comment

Choose a reason for hiding this comment

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

Testing this currently.

First thing - the circle membership is unclear with the list of attendees like this:

I don't know if it would be possible to have the members displayed as a sub- group. Quick'n'dirty mockup:

It also sends an invitation email to the one creating the event if they are also a member of the circle. In principle, the ORGANIZER can also be an ATTENDEE, so it's not technically wrong, but it creates awkward visuals as well because the calendar app will show me the accept/decline buttons on an event that I made:

image

Plus I'm a bit concerned about side effects for singificant changes and other stuff if I'm both ORGANIZER and ATTENDEE.

I think it's neccessary to filter out the circle member that is the organizer if that is the case and not set them as an attendee.

Other than that it works flawlessly and I'm super grateful @onny!

@miaulalala
Copy link
Contributor

Ah, does #5396 address the comments from above about the display?

@onny
Copy link
Author

onny commented Oct 27, 2023

@miaulalala I adjusted the code so that the organizer of the event doesn't get imported from the circle :)

@miaulalala
Copy link
Contributor

@miaulalala I adjusted the code so that the organizer of the event doesn't get imported from the circle :)

I will test it today, thanks a lot!

miaulalala

This comment was marked as outdated.

Copy link
Contributor

@miaulalala miaulalala left a comment

Choose a reason for hiding this comment

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

Hi onny, I fixed the tests locally, so if you implement the suggestions it should run through. You will also need an additional entry in psalm.xml.

Thanks for your hard work - @ChristophWurst and I have agreed since Circles has no public API, it's fine to leave the backend code as is. If you want you can add a comment above the call to the private API in that regard as well that this has been approved but us.

Looking forward to see this in action!!!! 😍

psalm.xml Show resolved Hide resolved
lib/Controller/ViewController.php Show resolved Hide resolved
@onny onny force-pushed the invite-circles branch 3 times, most recently from df5f44f to 04eeeaa Compare November 7, 2023 18:15
@onny onny requested a review from miaulalala November 7, 2023 18:15
@onny
Copy link
Author

onny commented Nov 7, 2023

Thank you @miaulalala and @ChristophWurst for the review. Added the requested changes to the PR :)

@onny
Copy link
Author

onny commented Nov 17, 2023

@miaulalala I refactored the code which computes groups and memberships a bit to be more robust and simple. Works quite good for me now :)
Still have a look at the PHP linting errors etc 👀

phpunit --configuration phpunit.unit.xml --fail-on-warning
PHPUnit 9.6.13 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.0-dev with Xdebug 3.3.0alpha4-dev
Configuration: phpunit.unit.xml

...............................................................  63 / 173 ( 36%)
..............................EEEEEEE.......................... 126 / 173 ( 72%)
...............................................                 173 / 173 (100%)

Time: 00:01.075, Memory: 46.00 MB

There were 7 errors:

1) OCA\Calendar\Controller\ViewControllerTest::testIndex
TypeError: Mock_CompareVersion_cf83b8dc::isCompatible(): Argument #2 ($required) must be of type string, int given, called in /home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php on line 131

/home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php:131
/home/runner/work/calendar/calendar/nextcloud/apps/calendar/tests/php/unit/Controller/ViewControllerTest.php:175

2) OCA\Calendar\Controller\ViewControllerTest::testIndexViewFix with data set #0 ('agendaDay', 'timeGridDay')
TypeError: Mock_CompareVersion_cf83b8dc::isCompatible(): Argument #2 ($required) must be of type string, int given, called in /home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php on line 131

/home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php:131
/home/runner/work/calendar/calendar/nextcloud/apps/calendar/tests/php/unit/Controller/ViewControllerTest.php:268

3) OCA\Calendar\Controller\ViewControllerTest::testIndexViewFix with data set #1 ('timeGridDay', 'timeGridDay')
TypeError: Mock_CompareVersion_cf83b8dc::isCompatible(): Argument #2 ($required) must be of type string, int given, called in /home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php on line 131

/home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php:131
/home/runner/work/calendar/calendar/nextcloud/apps/calendar/tests/php/unit/Controller/ViewControllerTest.php:268

4) OCA\Calendar\Controller\ViewControllerTest::testIndexViewFix with data set #2 ('agendaWeek', 'timeGridWeek')
TypeError: Mock_CompareVersion_cf83b8dc::isCompatible(): Argument #2 ($required) must be of type string, int given, called in /home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php on line 131

/home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php:131
/home/runner/work/calendar/calendar/nextcloud/apps/calendar/tests/php/unit/Controller/ViewControllerTest.php:268

5) OCA\Calendar\Controller\ViewControllerTest::testIndexViewFix with data set #3 ('timeGridWeek', 'timeGridWeek')
TypeError: Mock_CompareVersion_cf83b8dc::isCompatible(): Argument #2 ($required) must be of type string, int given, called in /home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php on line 131

/home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php:131
/home/runner/work/calendar/calendar/nextcloud/apps/calendar/tests/php/unit/Controller/ViewControllerTest.php:268

6) OCA\Calendar\Controller\ViewControllerTest::testIndexViewFix with data set #4 ('month', 'dayGridMonth')
TypeError: Mock_CompareVersion_cf83b8dc::isCompatible(): Argument #2 ($required) must be of type string, int given, called in /home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php on line 131

/home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php:131
/home/runner/work/calendar/calendar/nextcloud/apps/calendar/tests/php/unit/Controller/ViewControllerTest.php:268

7) OCA\Calendar\Controller\ViewControllerTest::testIndexViewFix with data set #5 ('dayGridMonth', 'dayGridMonth')
TypeError: Mock_CompareVersion_cf83b8dc::isCompatible(): Argument #2 ($required) must be of type string, int given, called in /home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php on line 131

/home/runner/work/calendar/calendar/nextcloud/apps/calendar/lib/Controller/ViewController.php:131
/home/runner/work/calendar/calendar/nextcloud/apps/calendar/tests/php/unit/Controller/ViewControllerTest.php:268

ERRORS!
Tests: 173, Assertions: 564, Errors: 7.

Generating code coverage report in Clover XML format ... done [00:00.082]
Script phpunit --configuration phpunit.unit.xml --fail-on-warning handling the test event returned with error code 2
Error: Process completed with exit code 2.

@jancborchardt
Copy link
Member

@onny did anything change design-wise? Cause otherwise I would say it is still fine. :)

@miaulalala miaulalala added this to the v4.7.0 milestone Dec 4, 2023
@miaulalala
Copy link
Contributor

@onny can you rebase on the current main? Tests will pass again, then I will take a look at the linter issues.

This commit adds support for adding circles as attendees to a calendar event.
The relationship between the imported group and members will be compliant with
the iCal specification.

A circle with the title "testcircle" will be added as an attendee with iCal
attributes "CUTYPE=GROUP` and uri "mailto:circle+CIRCLEID@CIRCLE_INSTANCE".

Members of the circle will be imported as standard attendees. Each member gets
assigned to the circle group entry by assigning them to the group uri using the
iCal member property: "MEMBER='mailto:circle+CIRCLEID@CIRCLE_INSTANCE'".

Searching for circles is only enabled if the circles app is activated.

Circles added to the list of attendees get imported only once and are not
synced yet. While adding a circle, a notice about this is shown to the user.
Only members of local circles which are local users get imported.

Rendering groups in the frontend is done in a separate PR
nextcloud#5396

Signed-off-by: Jonas Heinrich <[email protected]>
@onny
Copy link
Author

onny commented Dec 4, 2023

@onny did anything change design-wise? Cause otherwise I would say it is still fine. :)

I refactored the code in src/components/Editor/Invitees/InviteesList.vue which computes groups and memberships a bit to be more robust and simple

@miaulalala Rebased the PR

@miaulalala
Copy link
Contributor

@ChristophWurst codecov coverage is complaining, am I ok to ignore? I would like to get this merged today 😊

@ChristophWurst
Copy link
Member

The circles code is probably pain to create test for due to the lack of a stable API so I'll wave this through

@miaulalala
Copy link
Contributor

The circles code is probably pain to create test for due to the lack of a stable API so I'll wave this through

I'll test this one last time during lunch time and then I'll force merge.

Thanks so much for your work and patience @onny !

Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

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

Still looks good design-wise :)

Copy link
Contributor

@miaulalala miaulalala left a comment

Choose a reason for hiding this comment

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

Perfect!

@miaulalala miaulalala merged commit 4449e39 into nextcloud:main Dec 5, 2023
36 of 38 checks passed
Copy link

github-actions bot commented May 1, 2024

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

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

Successfully merging this pull request may close these issues.

Possibility to add a Nextcloud circle as attendees for an event [$250]
5 participants