I have an external company Calendar with events like "Valerio in vacancy" or "Valerio with customer xxx" so I imported it in my Phorge, trying some integration.
The problem is: imported events are never related to me from Phorge interface.
Examples:
- I never see my imported events under my Phorge user page.
- I never see my imported events when filtering on the Calendar by Invitees = myself
Just "Clear Sailing":
{F323303}
I also tried editing the remote calendar to manually put my email address as Invitee in every event created by me, to somehow convince Phorge. But, just "Clear Sailing". And, I'm just shown as "Private User 1":
{F323300}
How to fix the fact that myself is never invited from my personal Imported Calendar?
== Understanding the Problem ==
It seems there is an ICS parser, that works well:
https://we.phorge.it/source/phorge/browse/master/src/applications/calendar/parser/ics/PhutilICSParser.php
It creates an attendees array consisting in simple `PhutilCalendarUserNode` objects that just have an URI (mailto:), name, and participation status. This seems very OK to me since it's the minimal representation of the ICS file. This object is attached to `PhutilCalendarEventNode::addAttendee(PhutilCalendarUserNode)`.
Now. SOMETHING adapts these UserNode(s) as → `PhabricatorCalendarExternalInvitee` storing them with PHIDs `PHID-CXNV` in the table `calendar_externalinvitee`. These are then referenced from the table `calendar_eventinvitee`.
Example row:
```
name=SELECT * FROM calendar_eventinvitee;
id: 1
eventPHID: PHID-CEVT-r6dcgp7ywxfezn4ao4ju
inviteePHID: PHID-CXNV-7ku4zm3nz2npk4hgobyk * NOTE CXNV *
inviterPHID: PHID-CIMP-ahgrfr52h4g5thucrxcs
status: invited
dateCreated: 1690538988
dateModified: 1690538988
availability: default
```
For the Host, this should probably happen instead - since this is what happens when you manually create the Event - so, the column `inviterPHID` has a bind to a real user (`PHID-USER`) and not to an external user:
```
name=SELECT * FROM calendar_eventinvitee;
id: 1
eventPHID: PHID-CEVT-r6dcgp7ywxfezn4ao4ju
inviteePHID: PHID-USER-7ku4zm3nz2npk4hgobyk * NOTE USER *
inviterPHID: PHID-CIMP-ahgrfr52h4g5thucrxcs
status: invited
dateCreated: 1690538988
dateModified: 1690538988
availability: default
```
So, something should call `PhabricatorCalendarEventInvitee#setInviterPHID()` with the most appropriate phid during the import phase.
== Proposed solution n. 1: Invitee option ==
From this page:
https://we.phorge.it/calendar/import/edit/?importType=icsuri
We can add a {nav Default Invitee} field, with yourself picked as default.
This should be reasonable since it's the very same thing that happens during manual creation:
https://we.phorge.it/calendar/event/edit/form/7/
== Proposed solution n.2: trusting yourself ==
If the imported event has an email address that matches the Host, the Host should be set as Invitee in Phorge too.
Bonus point: do not show yourself as "Private User 1", but as a normal user link.
This solution is safe since //you// are supposed to know and trust your events and your email address and indeed you may want to match yourself if you are an invitee in the remote event.
Cons: this second solution has not a great margin of expansion because of security reasons. The assumption that is true for the Host cannot be applied to other remote invitees, since someone could craft a remote calendar to invite random emails to try to match existing local Phorge users. Expanding this involves spam and privacy concerns.
So, we can just approach this "trust yourself" solution, remembering to never expand this logic to other participants.