@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3abstract class PhabricatorCalendarController extends PhabricatorController {
4
5 protected function newICSResponse(
6 PhabricatorUser $viewer,
7 $file_name,
8 array $events) {
9
10 $ics_data = id(new PhabricatorCalendarICSWriter())
11 ->setViewer($viewer)
12 ->setEvents($events)
13 ->writeICSDocument();
14
15 return id(new AphrontFileResponse())
16 ->setDownload($file_name)
17 ->setMimeType('text/calendar')
18 ->setContent($ics_data);
19 }
20
21 protected function newImportedEventResponse(PhabricatorCalendarEvent $event) {
22 if (!$event->isImportedEvent()) {
23 return null;
24 }
25
26 // Give the user a specific, detailed message if they try to edit an
27 // imported event via common web paths. Other edits (including those via
28 // the API) are blocked by the normal policy system, but this makes it more
29 // clear exactly why the event can't be edited.
30
31 return $this->newDialog()
32 ->setTitle(pht('Can Not Edit Imported Event'))
33 ->appendParagraph(
34 pht(
35 'This event has been imported from an external source and '.
36 'can not be edited.'))
37 ->addCancelButton($event->getURI(), pht('Done'));
38 }
39
40}