Page MenuHomePhabricator

Move Calendar to EditEngine
Closed, ResolvedPublic

Description

Calendar should be updated to use EditEngine. Among other things, this would give us better and more flexible behavior for the "Create Private Event" / "Create Public Event" dropdown: installs could customize the forms and choose their own defaults.

T10673 is a similar task with some pointers.


Original Report

New Calendar events should have Public visibility by default ... or a setting should allow admins to define which is the default. Currently is All Users, which is inconsistent with the default for Tasks and other defaults.

Original report: https://phabricator.wikimedia.org/T110503

Event Timeline

qgil updated the task description. (Show Details)
qgil added projects: Calendar, Policy.
qgil added a subscriber: qgil.

I did some digging through the source code and found PhabricatorCalendarEvent::initializeNewCalendarEvent which does this:

if ($mode == 'public') {
  $view_policy = PhabricatorPolicies::getMostOpenPolicy();
}

basically it's
https://secure.phabricator.com/calendar/event/create/?mode=public
vs.
https://secure.phabricator.com/calendar/event/create/

I get the impression this was made before the form engines were a thing?

There's also mode=recurring... all these seem to do is change different default options on the form. Should I try to implement form edit engine support for this @epriestley? Would you be prepared to review it?

epriestley renamed this task from New Calendar events should have Public visibility by default to Move Calendar to EditEngine.Apr 6 2016, 3:16 PM
epriestley updated the task description. (Show Details)
epriestley added a project: ApplicationEditor.
epriestley triaged this task as Normal priority.

One problem with updating this is that recurring events currently work like this:

  • When you view an instance of an event that hasn't been modified yet, we generate a fake request-only object.
  • When you try to edit it, we turn it into a real event.

This means that when you view an event, it doesn't have a real ID or PHID yet, which makes several interactions sort of weird or buggy. For example, awarding a token to an instance of an event awards it to the parent event instead (and redirects you to the parent event).

All support infrastructure (tokens, subscribers, flags, EditEngine, etc) relies on objects having IDs/PHIDs. I poked at making EditEngine flexible enough to do the PHID/ID generation later, and sort of got it working, but I'm not happy with how it works and I don't think this is a reasonable pathway forward for tokens, subscribers, etc. I think I'm going to change it to work like this instead:

  • When you view an instance of an event that hasn't been modified yet, we generate and store a stub object.
  • This just has an ID/PHID and no other data.
  • When you try to edit it, we turn it into a real event.

This is a small change conceptually, but unfortunately may not be all that small code-wise.

This is on EditEngine + Modular Transactions now. There are probably still some remaining issues I didn't catch.