Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2684928
D25061.1734698746.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
D25061.1734698746.diff
View Options
diff --git a/src/applications/calendar/controller/PhabricatorCalendarImportEditController.php b/src/applications/calendar/controller/PhabricatorCalendarImportEditController.php
--- a/src/applications/calendar/controller/PhabricatorCalendarImportEditController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarImportEditController.php
@@ -8,7 +8,22 @@
->setController($this);
$id = $request->getURIData('id');
- if (!$id) {
+ if ($id) {
+
+ // edit a specific entry
+
+ $calendar_import = self::queryImportByID($request, $id);
+ if (!$calendar_import) {
+ return new Aphront404Response();
+ }
+
+ // pass the correct import engine to build the response
+ $engine->setImportEngine($calendar_import->getEngine());
+
+ } else {
+
+ // create an entry
+
$list_uri = $this->getApplicationURI('import/');
$import_type = $request->getStr('importType');
@@ -27,6 +42,18 @@
return $engine->buildResponse();
}
+ private static function queryImportByID(AphrontRequest $request, int $id) {
+ return id(new PhabricatorCalendarImportQuery())
+ ->setViewer($request->getViewer())
+ ->withIDs(array($id))
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->executeOne();
+ }
+
private function buildEngineTypeResponse($cancel_uri) {
$import_engines = PhabricatorCalendarImportEngine::getAllImportEngines();
diff --git a/src/applications/calendar/editor/PhabricatorCalendarImportEditEngine.php b/src/applications/calendar/editor/PhabricatorCalendarImportEditEngine.php
--- a/src/applications/calendar/editor/PhabricatorCalendarImportEditEngine.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarImportEditEngine.php
@@ -83,6 +83,12 @@
$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')
@@ -94,6 +100,15 @@
->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'))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 12:45 (19 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1017331
Default Alt Text
D25061.1734698746.diff (2 KB)
Attached To
Mode
D25061: Fix editing a Calendar import ICS URI
Attached
Detach File
Event Timeline
Log In to Comment