[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [FIX] Tracker item - missing titles when SEFURLs is enabled

"Domeshow Emmanuel \(@Domeshow\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69fba535ad52_381902e496b6@gitlab-sidekiq-low-urgency-cpu-bound-v2-69779547b7-dn8bv.mail>

Domeshow Emmanuel pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
57508040 by Domeshow Emmanuel at 2026-05-06T23:24:29+03:00
[FIX] Tracker item - missing titles when SEFURLs is enabled
---
* [FIX] Tracker item - missing titles when SEFURLs is enabled
---
* [ENH] Add test for tracker item SEFURL titles

* [FIX] Tracker item - missing titles when SEFURLs is enabled

See merge request tikiwiki/tiki!10126


(cherry picked from commit 735c0d33ca2b6cc7a7f3e1b22b67baea37765504)

23f807f2 [FIX] Tracker item - missing titles when SEFURLs is enabled
fad8d32a [ENH] Add test for tracker item SEFURL titles

Co-authored-by: Domeshow Emmanuel <[email protected]>

See merge request tikiwiki/tiki!10154

- - - - -


2 changed files:

- + lib/test/smarty_tiki/FilterOutSefurlTest.php
- tiki-sefurl.php


Changes:

=====================================
lib/test/smarty_tiki/FilterOutSefurlTest.php
=====================================
@@ -0,0 +1,75 @@
+<?php
+
+// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
+//
+// All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+
+namespace Tiki\Lib\Test\SmartyTiki;
+
+use TestableTikiLib;
+use TikiLib;
+use TikiTestCase;
+
+require_once(__DIR__ . '/../../../tiki-sefurl.php');
+
+class FilterOutSefurlTest extends TikiTestCase
+{
+    /**
+     * @var TestableTikiLib|null
+     */
+    private $overrideLibs;
+
+    protected function setUp(): void
+    {
+        parent::setUp();
+
+        $this->overrideLibs = new TestableTikiLib();
+
+        $trklib = $this->createMock(get_class(TikiLib::lib('trk')));
+        $trklib->method('get_title_sefurl')
+            ->with('123')
+            ->willReturn('Example Tracker Item');
+
+        $tikilib = $this->createMock(get_class(TikiLib::lib('tiki')));
+
+        $this->overrideLibs->overrideLibs([
+            'trk' => $trklib,
+            'tiki' => $tikilib,
+        ]);
+
+        $GLOBALS['prefs'] = array_merge($GLOBALS['prefs'] ?? [], [
+            'feature_sefurl' => 'y',
+            'feature_sefurl_title_trackeritem' => 'y',
+            'feature_sefurl_tracker_prefixalias' => 'n',
+            'tracker_prefixalias_on_links' => 'n',
+            'feature_sefurl_paths' => [],
+        ]);
+        $GLOBALS['base_url'] = 'https://example.org';
+        $GLOBALS['in_installer'] = null;
+        $GLOBALS['sefurl_regex_out'] = [];
+    }
+
+    protected function tearDown(): void
+    {
+        $this->overrideLibs = null;
+        unset($GLOBALS['sefurl_regex_out'], $GLOBALS['in_installer'], $GLOBALS['base_url']);
+        parent::tearDown();
+    }
+
+    /**
+     * @dataProvider trackerItemUrlsProvider
+     */
+    public function testTrackerItemUrlsAppendTitles(string $input): void
+    {
+        $this->assertSame($input . '-Example Tracker Item', filter_out_sefurl($input, 'trackeritem'));
+    }
+
+    public static function trackerItemUrlsProvider(): array
+    {
+        return [
+            'query string url' => ['tiki-view_tracker_item.php?itemId=123'],
+            'short sefurl' => ['item123'],
+        ];
+    }
+}


=====================================
tiki-sefurl.php
=====================================
@@ -103,7 +103,7 @@ function filter_out_sefurl($tpl_output, $type = null, $title = '', $with_next =
         }
     }
     if ($type == 'tracker item' || $type == 'trackeritem') {
-        if (preg_match('/itemId=([0-9]+)/', $tpl_output, $matches)) {
+        if (preg_match('/item(?:Id=)?([0-9]+)/', $tpl_output, $matches)) {
             $trklib = TikiLib::lib('trk');
 
             if ($prefs['feature_sefurl_title_trackeritem'] == 'y') {



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5750804053c724809997c16eff1886f3afb9c52b

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5750804053c724809997c16eff1886f3afb9c52b
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.