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

Provide links to calendar in event creation/update activities #19039

Merged
merged 1 commit into from
Apr 30, 2020

Conversation

tcitworld
Copy link
Member

Since Calendar 2.0 we have dedicated routes so we can link to events directly from the Activity app.

See also nextcloud/activity#420 for proper formatting in the Activity app.

Screenshot_2020-01-21 Activity - Nextcloud- 2
(The last item has also a link to the event)

@tcitworld tcitworld added the 3. to review Waiting for reviews label Jan 21, 2020
@tcitworld tcitworld added this to the Nextcloud 19 milestone Jan 21, 2020
@tcitworld tcitworld force-pushed the dav-activity-provide-links-to-calendar branch from 71abc1c to 4b908a4 Compare January 21, 2020 09:52
Copy link
Member

@georgehrke georgehrke left a comment

Choose a reason for hiding this comment

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

I'm blocking, to put this on hold for now. I'm worried I have to change the url format in order to fix nextcloud/calendar#1894. Will look into that issue today.

Never mind, it's yet again related to unencoded group names

@georgehrke georgehrke self-requested a review March 11, 2020 11:50
This was referenced Apr 4, 2020
This was referenced Apr 15, 2020
@rullzer
Copy link
Member

rullzer commented Apr 16, 2020

@georgehrke yay or nay?

@georgehrke
Copy link
Member

@tcitworld can you remove the version check as suggested by @nickvergessen.

Then this is good to go

@tcitworld tcitworld force-pushed the dav-activity-provide-links-to-calendar branch from 4b908a4 to 9ee897d Compare April 17, 2020 08:11
@tcitworld
Copy link
Member Author

tcitworld commented Apr 17, 2020

Removed the version check, properly injected dependencies, moved generateObjectParameter to OCA\DAV\CalDAV\Activity\Provider\Event because not needed in OCA\DAV\CalDAV\Activity\Provider\Base and improved tests, so please give a quick look again.

Copy link
Member

@georgehrke georgehrke left a comment

Choose a reason for hiding this comment

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

Code looks good

@nickvergessen
Copy link
Member

Activity PR is merged

apps/dav/lib/CalDAV/Activity/Backend.php Outdated Show resolved Hide resolved
apps/dav/lib/CalDAV/Activity/Backend.php Outdated Show resolved Hide resolved
@tcitworld tcitworld force-pushed the dav-activity-provide-links-to-calendar branch from 9ee897d to ef1b510 Compare April 21, 2020 18:43
@@ -435,29 +435,41 @@ public function onTouchCalendarObject($action, array $calendarData, array $share
$users = $this->getUsersForShares($shares);
$users[] = $owner;

foreach ($users as $user) {
// Users for share can return the owner itself if the calendar is published
foreach (array_unique($users) as $user) {
Copy link
Member Author

Choose a reason for hiding this comment

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

getUsersForShares potentially returning the owner itself because of public links for calendar should be fixed somewhere else, this is a temporary fix. We need a proper nc: property to indicate that. cc @georgehrke

$link = [
'view' => 'dayGridMonth',
'timeRange' => $timeRange->format('Y-m-d'),
'mode' => 'sidebar',
Copy link
Member Author

Choose a reason for hiding this comment

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

This could get user's skipPopover setting to know if we use the popover or the sidebar, do you want that?

Copy link
Member

@georgehrke georgehrke Apr 24, 2020

Choose a reason for hiding this comment

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

We actually have a special route for this, but it's also hardcoded to sidebar at the moment.
https://github.com/nextcloud/calendar/blob/master/src/router.js#L102

I would just keep it as is and improve later on :)

Copy link
Member

Choose a reason for hiding this comment

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

If you use that route, we could actually get rid of firstoccurrence

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using /dayGridMonth/now/edit/sidebar/$objectId/next then.

@tcitworld
Copy link
Member Author

Slighty off-topic, it's kinda sad we can't properly detect event being renamed, it makes you think you updated two different events when you just renamed one twice.
image

@rullzer rullzer mentioned this pull request Apr 23, 2020
11 tasks
* @param array $eventData
* @return array
*/
protected function generateObjectParameter(array $eventData) {
Copy link
Member

Choose a reason for hiding this comment

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

This was in the base because it's also used in Todo.php and it makes it more obvious that it is shared.
But I guess it's fine eitherway.

Copy link
Member Author

@tcitworld tcitworld Apr 26, 2020

Choose a reason for hiding this comment

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

Yeah, my reasoning was that Calendar.php doesn't need it.

'objectId' => $objectId,
'recurrenceId' => $linkData['firstoccurence']
];
$params['link'] = $this->url->linkToRouteAbsolute('calendar.view.indexview.timerange.edit', $link);
Copy link
Member

Choose a reason for hiding this comment

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

this will 💥 when calendar is disabled,
so maybe we return the params without the link (since it's optional anyway) in the exception catching?

Copy link
Member

@georgehrke georgehrke Apr 24, 2020

Choose a reason for hiding this comment

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

So just wrap in AppManager::isEnabledForUser?

Copy link
Member

Choose a reason for hiding this comment

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

Yes

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure I follow here, we set the link inside the AppManager::isEnabledForUser check already, and params without the link will be return at the end properly.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, didnt see it as it was all at the end of this long if

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
@tcitworld tcitworld force-pushed the dav-activity-provide-links-to-calendar branch from ef1b510 to deb2ea9 Compare April 26, 2020 09:14
Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

Lets do this

@rullzer rullzer merged commit a1f3293 into master Apr 30, 2020
@rullzer rullzer deleted the dav-activity-provide-links-to-calendar branch April 30, 2020 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants