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 a CalDAV based implementation for EventAttendanceRepository #1498

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

HoussemNasri
Copy link
Member

Closes #1329

Comment on lines +102 to +113
if (partStat.equals(PartStat.ACCEPTED)) {
return Optional.of(Accepted);
} else if (partStat.equals(PartStat.DECLINED)) {
return Optional.of(Declined);
} else if (partStat.equals(PartStat.NEEDS_ACTION)) {
return Optional.of(NeedsAction);
} else if (partStat.equals(PartStat.TENTATIVE)) {
return Optional.of(Tentative);
} else {
LOGGER.trace("Unable to map PartStat '{}' to AttendanceStatus.", partStat);
return Optional.empty();
}
Copy link
Member

Choose a reason for hiding this comment

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

Switch?

Comment on lines +129 to +130
AttendanceStatus.fromCalendarAttendeeParticipationStatus(p).orElseThrow())
)).getOrElse(() -> CalendarEventAttendanceResults$.MODULE$.notFound(blobId));
Copy link
Member

Choose a reason for hiding this comment

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

                        AttendanceStatus.fromCalendarAttendeeParticipationStatus(p).orElseThrow())))
                            .getOrElse(() -> CalendarEventAttendanceResults$.MODULE$.notFound(blobId));

Comment on lines +106 to +117
if (events.isEmpty()) {
LOGGER.debug("""
No VEvents found in calendar object.
Returning empty attendance results.
""");
return CalendarEventAttendanceResults.empty();
} else {
LOGGER.debug("""
Expected exactly one VEvent, but found {} entries. Using the first VEvent.
This may indicate unhandled recurrent events or a malformed calendar object.
VEvents: {}
""", events.size(), events);
Copy link
Member

Choose a reason for hiding this comment

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

One line logs please

return Flux.fromIterable(JavaConverters.seqAsJavaList(calendarEventBlobIds.value()))
.flatMap(blobId -> getEventUid(blobId.value(), systemMailboxSession)
.flatMap(eventUid ->
toDavUser(username)
Copy link
Member

Choose a reason for hiding this comment

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

Please manage to resolve the dav user only once and not fot each event Uid

Comment on lines +147 to +152
public Publisher<CalendarEventReplyResults> setAttendanceStatus(Username username,
AttendanceStatus attendanceStatus,
BlobIds eventBlobIds,
Optional<LanguageLocation> maybePreferredLanguage) {
return null;
}
Copy link
Member

Choose a reason for hiding this comment

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

?

.reduce(CalendarEventAttendanceResults$.MODULE$.empty(), CalendarEventAttendanceResults$.MODULE$::merge);
}

private CalendarEventAttendanceResults getAttendanceStatusFromCalendarObject(BlobId blobId,
Copy link
Member

Choose a reason for hiding this comment

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

This method is long. Prease do use method extraction

return extractMessageId(blobId)
.flatMap(messageId ->
Mono.fromDirect(
messageIdManager.getMessagesReactive(List.of(messageId), FetchGroup.MINIMAL, mailboxSession)))
Copy link
Member

Choose a reason for hiding this comment

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

FetchGroup.HEADERS

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.

Provide a CalDAV based implementation for EventAttendanceRepository
2 participants