Event details UI improvements.

This commit is contained in:
Burak Kaan Köse
2026-01-01 10:07:56 +01:00
parent e71c050724
commit 3b485dc1fe
14 changed files with 311 additions and 113 deletions
@@ -283,9 +283,12 @@ public static class OutlookIntegratorExtensions
};
}
public static CalendarEventAttendee CreateAttendee(this Attendee attendee, Guid calendarItemId)
public static CalendarEventAttendee CreateAttendee(this Attendee attendee, Guid calendarItemId, string organizerEmail = null)
{
bool isOrganizer = attendee?.Status?.Response == ResponseType.Organizer;
// Check if this attendee is the organizer by comparing email addresses
bool isOrganizer = !string.IsNullOrEmpty(organizerEmail) &&
!string.IsNullOrEmpty(attendee?.EmailAddress?.Address) &&
string.Equals(attendee.EmailAddress.Address, organizerEmail, StringComparison.OrdinalIgnoreCase);
var eventAttendee = new CalendarEventAttendee()
{
@@ -170,7 +170,9 @@ public class OutlookChangeProcessor(IDatabaseService databaseService,
List<CalendarEventAttendee> attendees = null;
if (calendarEvent.Attendees != null)
{
attendees = calendarEvent.Attendees.Select(a => a.CreateAttendee(savingItemId)).ToList();
// Pass the organizer's email address to properly identify the organizer in the attendees list
string organizerEmail = calendarEvent.Organizer?.EmailAddress?.Address;
attendees = calendarEvent.Attendees.Select(a => a.CreateAttendee(savingItemId, organizerEmail)).ToList();
}
// Use CalendarService to create or update the event
@@ -0,0 +1,32 @@
using CommunityToolkit.Mvvm.Messaging;
using Wino.Core.Domain.Entities.Calendar;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Requests;
using Wino.Messaging.Client.Calendar;
namespace Wino.Core.Requests.Calendar;
/// <summary>
/// Request to delete a calendar event on the server.
/// </summary>
public record DeleteCalendarEventRequest(CalendarItem Item) : CalendarRequestBase(Item)
{
public override CalendarSynchronizerOperation Operation => CalendarSynchronizerOperation.DeleteEvent;
/// <summary>
/// After successful deletion, resync to confirm the event was removed.
/// </summary>
public override int ResynchronizationDelay => 2000;
public override void ApplyUIChanges()
{
// Notify UI that the event was deleted
WeakReferenceMessenger.Default.Send(new CalendarItemDeleted(Item));
}
public override void RevertUIChanges()
{
// If deletion fails, we should notify the UI to add it back
WeakReferenceMessenger.Default.Send(new CalendarItemAdded(Item));
}
}
+2 -2
View File
@@ -140,9 +140,9 @@ public class WinoRequestDelegator : IWinoRequestDelegator
IRequestBase request = calendarPreparationRequest.Operation switch
{
CalendarSynchronizerOperation.CreateEvent => new CreateCalendarEventRequest(calendarPreparationRequest.CalendarItem, calendarPreparationRequest.Attendees),
// Future support for update and delete operations
CalendarSynchronizerOperation.DeleteEvent => new DeleteCalendarEventRequest(calendarPreparationRequest.CalendarItem),
// Future support for update operations
// CalendarSynchronizerOperation.UpdateEvent => new UpdateCalendarEventRequest(calendarPreparationRequest.CalendarItem, calendarPreparationRequest.Attendees),
// CalendarSynchronizerOperation.DeleteEvent => new DeleteCalendarEventRequest(calendarPreparationRequest.CalendarItem),
_ => throw new NotImplementedException($"Calendar operation {calendarPreparationRequest.Operation} is not implemented yet.")
};