Page MenuHomePhabricator

Might be helpful for all ghost events (generated and concrete) to show what instance number they are.
Closed, ResolvedPublic


Not sure if this is helpful or confusing, but when testing the recurring events feature, sometimes I wish I knew which instance of a recurring event I was working with. Generated ghost events make this obvious in the URL, but converted ghost events are not so obvious. Maybe "Instance of Event" property with value "E1234" should actually be "Instance" property with value "3 of E1234"

Event Timeline

lpriestley claimed this task.
lpriestley raised the priority of this task from to Normal.
lpriestley updated the task description. (Show Details)
lpriestley added a project: Calendar.
lpriestley added a subscriber: lpriestley.

Currently, a recurring event can be one of three types:

  • A parent event. A parent event is what the user creates when they follow the Calendar โ†’ Create โ†’ Recurring Event workflow. This type doesn't include all the events generated by this event.
  • A "ghost" instance of an event. This type is an event that is generated when a user navigates to E111/2 without editing it. E111/2 does not exist in the database yet, and it has no id, but it lives temporarily with properties like sequenceNumber and instanceOfEventPHID.
  • An exception to a "ghost" instance event. When a user hits "Edit" on a "ghost" event, a new event is created. This new event contains most of the information that the ghost was holding temporarily, but now that information is saved to the database and is ready to save any changes that might be made to it.

Because "ghost" events do not have ID's, they don't have direct URL's, but are accessed by the parent and their sequence number. On ghost events, it is easy to figure out the sequence number simply by looking at the URL or at the crumbs at the top of the page. Because "ghost" exceptions have turned into real events, their new ID's (and, consequently, URL's) tell us nothing about the sequence index of the event in that sequence of recurring events. For example, when I edit E111/2, an event like E234 is generated to take its place, obscuring the sequence number. It would be more clear if the property list of an event somehow reflected the sequence number of that child event.

In the PhabricatorCalendarEventViewController class, in the buildPropertyView method, there is a block like:

  pht('Recurrence of Event'),

It is currently added on the condition that an event is an instance of an event. We should edit the value of that property to be something like "2 of E111". Currently $viewer->renderHandle() returns an object of class PHUIHandleView. In order to include it in a string, add a ->render() call to it. Now you can compose a string with it.

When we compose a string that contains words that can be translated, we use pht() as documented here. You can look at the PhabricatorCalendarEventTransaction class in the getTitleForFeed method for how we need to use it. The two properties of $event that we need are sequenceIndex and instanceOfEventPHID. (The full list of object properties can be found in the definition class PhabricatorCalendarEvent.) Object properties can be magically accessed via getSequenceIndex() and getInstanceOfEventPHID. You can basically call get + <somePropertyCamelCase> to get the property value of an object, most of the time.

So now you should have both of the parts needed to compose the string that will be used as a value for the property view. Let me know if you get stuck anywhere. Happy to clarify.

lpriestley added a parent task: Restricted Maniphest Task.Jun 16 2015, 7:28 PM