From a5c0d49808b7007487cf6e769b567fa46d51324d Mon Sep 17 00:00:00 2001 From: studio-prisma <282898618+studio-prisma@users.noreply.github.com> Date: Sun, 8 Nov 2026 16:44:16 +0100 Subject: [PATCH 1/2] fix(ui): show the tick and menu entry on views opened by ticket number --- src/FeedbackUi.php | 18 ++++++++++++++++-- tests/e2e/9-decide.spec.js | 10 ++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/FeedbackUi.php b/src/FeedbackUi.php index 19641c1..dd172be 100644 --- a/src/FeedbackUi.php +++ b/src/FeedbackUi.php @@ -25,12 +25,26 @@ public static function maybeStart(array $s): void return; } $script = str_replace('\\', '/', (string) ($_SERVER['SCRIPT_NAME'] ?? '')); - if (preg_match('#/scp/tickets\.php$#', $script) !== 1 || !isset($_GET['id'])) { + if (preg_match('#/scp/tickets\.php$#', $script) !== 1 || (!isset($_REQUEST['id']) && !isset($_REQUEST['number']))) { return; } ob_start(array(__CLASS__, 'inject')); } + /** The ticket the view shows, found the way scp/tickets.php finds it: by ID, else by number. */ + private static function viewedTicket(): ?Ticket + { + $id = $_REQUEST['id'] ?? null; + if (is_scalar($id) && ctype_digit((string) $id)) { + return Ticket::lookup((int) $id) ?: null; + } + $number = $_REQUEST['number'] ?? null; + if (is_scalar($number) && preg_match('/^[A-Za-z0-9_-]{1,32}$/', (string) $number) === 1) { + return Ticket::lookup(array('number' => (string) $number)) ?: null; + } + return null; + } + /** Output-buffer callback: adds the script to a ticket view (full page or PJAX fragment). */ public static function inject($buffer) { @@ -40,7 +54,7 @@ public static function inject($buffer) return $buffer; } $staff = $GLOBALS['thisstaff'] ?? null; - $ticket = Ticket::lookup((int) ($_GET['id'] ?? 0)); + $ticket = self::viewedTicket(); if (!$staff instanceof Staff || !$ticket || !$ticket->checkStaffPerm($staff)) { return $buffer; } diff --git a/tests/e2e/9-decide.spec.js b/tests/e2e/9-decide.spec.js index c7d13a5..78c2eac 100644 --- a/tests/e2e/9-decide.spec.js +++ b/tests/e2e/9-decide.spec.js @@ -150,6 +150,16 @@ test('UI: status dialog carries the tick; removing it closes without a question' expect(errors).toEqual([]); }); +test('UI: also on a view opened by ticket number (tickets.php?number=)', async ({ page }) => { + const id = newTicket('0.2.1 ui number'); + reply(id, 'admin', 'Antwort.'); + const num = sql(`SELECT number FROM ost_ticket WHERE ticket_id=${id}`); + await staffLogin(page, 'admin'); + await page.goto(`/scp/tickets.php?number=${num}`); + await expect(page.locator('form#reply .spf-ask')).toHaveCount(1); + await expect(page.locator('#action-dropdown-more li.spf-menu')).toHaveCount(1); +}); + test('UI: no tick and no menu entry where the rules never ask (Alerts)', async ({ page }) => { const id = newTicket('0.2 ui alert', { dept: seed.depts.alerts }); reply(id, 'admin', 'Gesehen.'); From 6a60327e2aebafdcb392be1a1b6a723233ca3eef Mon Sep 17 00:00:00 2001 From: studio-prisma <282898618+studio-prisma@users.noreply.github.com> Date: Sun, 8 Nov 2026 16:44:18 +0100 Subject: [PATCH 2/2] chore(release): v0.2.1 --- CHANGELOG.md | 9 ++++++++- class.FeedbackPlugin.php | 2 +- plugin.php | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b495a79..3745393 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.2.1] - 2026-11-08 + +### Fixed + +- The tick and the More-menu entry were missing when the ticket view was opened by number (`scp/tickets.php?number=…`); the plugin now finds the ticket the way osTicket does, by ID or by number. + ## [0.2.0] - 2026-11-08 ### Added @@ -45,7 +51,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Retention: rows are deleted after 24 months; the IP is stored only as a keyed hash. - Mail in the style of a brand line over an accent rule, buttons as table cells, a grey footer with an AI notice; texts editable, German (informal) and English built in. -[Unreleased]: https://github.com/studio-prisma/osticket-plugin-feedback/compare/v0.2.0...HEAD +[Unreleased]: https://github.com/studio-prisma/osticket-plugin-feedback/compare/v0.2.1...HEAD +[0.2.1]: https://github.com/studio-prisma/osticket-plugin-feedback/compare/v0.2.0...v0.2.1 [0.2.0]: https://github.com/studio-prisma/osticket-plugin-feedback/compare/v0.1.1...v0.2.0 [0.1.1]: https://github.com/studio-prisma/osticket-plugin-feedback/compare/v0.1.0...v0.1.1 [0.1.0]: https://github.com/studio-prisma/osticket-plugin-feedback/releases/tag/v0.1.0 diff --git a/class.FeedbackPlugin.php b/class.FeedbackPlugin.php index d31469f..980d122 100644 --- a/class.FeedbackPlugin.php +++ b/class.FeedbackPlugin.php @@ -42,7 +42,7 @@ class FeedbackPlugin extends Plugin { /** Mirrors plugin.php. */ - public const VERSION = '0.2.0'; + public const VERSION = '0.2.1'; /** Route bases, relative to the help desk root. */ public const CLIENT_BASE = 'ajax.php/feedback'; diff --git a/plugin.php b/plugin.php index 1028210..3667a02 100644 --- a/plugin.php +++ b/plugin.php @@ -9,7 +9,7 @@ return array( 'id' => 'studio-prisma:feedback', - 'version' => '0.2.0', + 'version' => '0.2.1', 'ost_version' => '1.18', 'name' => 'Feedback', 'author' => 'Studio Prisma',