1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Calendar: fix creation of ICS Files

Summary:
It seems that, in an attempt to make ICS URI(s) editable, we broke the ability
to manually import ICS files. Whops.

The cause is, the URI needs to be put inside its dedicated import engine,
and not the general one.

Since the intention of T15137 was to be able to edit this field, we have done
that in the right way this time. So, you see the field, not just in creation mode.

Thanks to the kind aklapper for reporting.

Ref      T15137
Closes   T15619
Rollback 02a4f8b0c8

Test Plan:
- visit /calendar/import/ and:
- create/edit an ICS File Import (now works again)
- create/edit an ICS URI Import (still work)
- try looking at an "ICS Import page" as author (URI still visible)
- try looking at an "ICS Import page" without Edit permissions (URI still omitted correctly)

Reviewers: aklapper, O1 Blessed Committers, 20after4

Reviewed By: aklapper, O1 Blessed Committers, 20after4

Subscribers: 20after4, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15619, T15137

Differential Revision: https://we.phorge.it/D25448
This commit is contained in:
Valerio Bozzolan 2023-10-25 19:07:44 +02:00
parent 318d7a61fe
commit 629fa368cb
2 changed files with 13 additions and 25 deletions

View file

@ -83,12 +83,6 @@ final class PhabricatorCalendarImportEditEngine
$engine = $object->getEngine();
$can_trigger = $engine->supportsTriggers($object);
// calendar URI import
// note that it can contains a secret token
// if we are here you have enough privileges to edit and see the value
$uri_key = PhabricatorCalendarImportICSURITransaction::PARAMKEY_URI;
$uri = $object->getParameter($uri_key);
$fields = array(
id(new PhabricatorTextEditField())
->setKey('name')
@ -100,15 +94,6 @@ final class PhabricatorCalendarImportEditEngine
->setConduitTypeDescription(pht('New import name.'))
->setPlaceholder($object->getDisplayName())
->setValue($object->getName()),
id(new PhabricatorTextEditField())
->setKey('uri')
->setLabel(pht('URI'))
->setDescription(pht('URI to import.'))
->setTransactionType(
PhabricatorCalendarImportICSURITransaction::TRANSACTIONTYPE)
->setConduitDescription(pht('URI to import.'))
->setConduitTypeDescription(pht('New URI.'))
->setValue($uri),
id(new PhabricatorBoolEditField())
->setKey('disabled')
->setOptions(pht('Active'), pht('Disabled'))

View file

@ -58,16 +58,19 @@ final class PhabricatorCalendarICSURIImportEngine
PhabricatorCalendarImport $import) {
$fields = array();
if ($engine->getIsCreate()) {
$fields[] = id(new PhabricatorTextEditField())
->setKey('uri')
->setLabel(pht('URI'))
->setDescription(pht('URI to import.'))
->setTransactionType(
PhabricatorCalendarImportICSURITransaction::TRANSACTIONTYPE)
->setConduitDescription(pht('URI to import.'))
->setConduitTypeDescription(pht('New URI.'));
}
// If you are here, you already have the "can edit" capability.
// So you are supposed to be able to edit again your Calendar import URI.
$uri_key = PhabricatorCalendarImportICSURITransaction::PARAMKEY_URI;
$uri = $import->getParameter($uri_key);
$fields[] = id(new PhabricatorTextEditField())
->setKey('uri')
->setLabel(pht('URI'))
->setDescription(pht('URI to import.'))
->setTransactionType(
PhabricatorCalendarImportICSURITransaction::TRANSACTIONTYPE)
->setConduitDescription(pht('URI to import.'))
->setConduitTypeDescription(pht('New URI.'))
->setValue($uri);
return $fields;
}