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

Raise ICS warnings in Phabricator on ICS import

Summary: Ref T11816. Depends on D16800. Show warnings generated by ICS import in the UI.

Test Plan: {F1904122}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11816

Differential Revision: https://secure.phabricator.com/D16801
This commit is contained in:
epriestley 2016-11-04 15:13:36 -07:00
parent c2565d5e24
commit ac8b156e4b
3 changed files with 50 additions and 0 deletions

View file

@ -2130,6 +2130,7 @@ phutil_register_library_map(array(
'PhabricatorCalendarImportICSFileTransaction' => 'applications/calendar/xaction/PhabricatorCalendarImportICSFileTransaction.php',
'PhabricatorCalendarImportICSLogType' => 'applications/calendar/importlog/PhabricatorCalendarImportICSLogType.php',
'PhabricatorCalendarImportICSURITransaction' => 'applications/calendar/xaction/PhabricatorCalendarImportICSURITransaction.php',
'PhabricatorCalendarImportICSWarningLogType' => 'applications/calendar/importlog/PhabricatorCalendarImportICSWarningLogType.php',
'PhabricatorCalendarImportIgnoredNodeLogType' => 'applications/calendar/importlog/PhabricatorCalendarImportIgnoredNodeLogType.php',
'PhabricatorCalendarImportListController' => 'applications/calendar/controller/PhabricatorCalendarImportListController.php',
'PhabricatorCalendarImportLog' => 'applications/calendar/storage/PhabricatorCalendarImportLog.php',
@ -6991,6 +6992,7 @@ phutil_register_library_map(array(
'PhabricatorCalendarImportICSFileTransaction' => 'PhabricatorCalendarImportTransactionType',
'PhabricatorCalendarImportICSLogType' => 'PhabricatorCalendarImportLogType',
'PhabricatorCalendarImportICSURITransaction' => 'PhabricatorCalendarImportTransactionType',
'PhabricatorCalendarImportICSWarningLogType' => 'PhabricatorCalendarImportLogType',
'PhabricatorCalendarImportIgnoredNodeLogType' => 'PhabricatorCalendarImportLogType',
'PhabricatorCalendarImportListController' => 'PhabricatorCalendarController',
'PhabricatorCalendarImportLog' => array(

View file

@ -28,6 +28,17 @@ abstract class PhabricatorCalendarICSImportEngine
$document = null;
}
foreach ($parser->getWarnings() as $warning) {
$import->newLogMessage(
PhabricatorCalendarImportICSWarningLogType::LOGTYPE,
array(
'ics.warning.code' => $warning['code'],
'ics.warning.line' => $warning['line'],
'ics.warning.text' => $warning['text'],
'ics.warning.message' => $warning['message'],
));
}
return $this->importEventDocument($viewer, $import, $document);
}

View file

@ -0,0 +1,37 @@
<?php
final class PhabricatorCalendarImportICSWarningLogType
extends PhabricatorCalendarImportLogType {
const LOGTYPE = 'ics.warning';
public function getDisplayType(
PhabricatorUser $viewer,
PhabricatorCalendarImportLog $log) {
return pht('ICS Parser Warning');
}
public function getDisplayDescription(
PhabricatorUser $viewer,
PhabricatorCalendarImportLog $log) {
return pht(
'Warning ("%s") while parsing ICS data (near line %s): %s',
$log->getParameter('ics.warning.code'),
$log->getParameter('ics.warning.line'),
$log->getParameter('ics.warning.message'));
}
public function getDisplayIcon(
PhabricatorUser $viewer,
PhabricatorCalendarImportLog $log) {
return 'fa-exclamation-triangle';
}
public function getDisplayColor(
PhabricatorUser $viewer,
PhabricatorCalendarImportLog $log) {
return 'yellow';
}
}