Unify public tickets with client tickets (#3799)

* Merge public ticket logic into regular client tickets

* Unified email templates

* Unified events and listeners

* Remove passthrough service methods

* Corrected phpDocs

* Create a combined `author` array to replace `client`, `client_id`, `author_name`, `author_email`

* Switch to using "Author" instead of "Requester"

* Switch to using a single endpoint and single template for client and guest tickets

Also left a redirect behind to make sure previously sent emails still have a working link

* Add author_role parameter to onBeforeClientOpenTicket

* Adjusted rate limit ordering

* Update Twig templates and the update patcher

* "Public ticket" -> "Guest ticket"

* Addressed code review comments

* Address code review comments

* Also purge old pticket email templates

* Fix email sending

* Support: enforce auth, fix guest email links

* Migrate mod_support config key name

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
This commit is contained in:
Yağızhan Burak YakarandAdam Daley authored and GitHub committed 2026-06-19 19:01:52 +01:00
1 parent f39fd44f0f
commit 7ade5bbdf3
46 files changed
+880 -3081

No files matched your search

+15 -11
View File
@@ -31,7 +31,7 @@ class Client implements \FOSSBilling\InjectionAwareInterface
$app->get('/support', 'get_tickets', [], static::class);
$app->get('/support/ticket/:id', 'get_ticket', [], static::class);
$app->get('/support/contact-us', 'get_contact_us', [], static::class);
$app->get('/support/contact-us/conversation/:hash', 'get_contact_us_conversation', ['hash' => '[a-z0-9]+'], static::class);
$app->get('/support/contact-us/conversation/:hash', 'get_ticket_redirect', ['hash' => '[a-z0-9]+'], static::class);
if ($this->di['mod']('support')->getService()->kbEnabled()) {
$app->get('/support/kb', 'get_kb_index', [], static::class);
@@ -49,8 +49,13 @@ class Client implements \FOSSBilling\InjectionAwareInterface
public function get_ticket(\Box_App $app, $id): string
{
$api = $this->di['api_client'];
$ticket = $api->support_ticket_get(['id' => $id]);
$id = (string) $id;
if (ctype_digit($id) && strlen($id) < 30) {
$this->di['is_client_logged'];
$ticket = $this->di['api_client']->support_ticket_get(['id' => $id]);
} else {
$ticket = $this->di['api_guest']->support_ticket_get(['hash' => $id]);
}
return $app->render('mod_support_ticket', ['ticket' => $ticket]);
}
@@ -60,15 +65,14 @@ class Client implements \FOSSBilling\InjectionAwareInterface
return $app->render('mod_support_contact_us');
}
public function get_contact_us_conversation(\Box_App $app, $hash): string
/**
* A redirect to keep old guest ticket links working.
*
* /support/contact-us/conversation/:hash -> /support/ticket/:hash
*/
public function get_ticket_redirect(\Box_App $app, $hash): never
{
$api = $this->di['api_guest'];
$data = [
'hash' => $hash,
];
$array = $api->support_ticket_get($data);
return $app->render('mod_support_contact_us_conversation', ['ticket' => $array]);
$app->redirect('support/ticket/' . $hash);
}
/*