Skip to content

Commit

Permalink
[BUGFIX] Fix Link to system extension docs in report button (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
linawolf committed Sep 21, 2024
1 parent 3955954 commit 14f3efc
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
23 changes: 19 additions & 4 deletions packages/typo3-docs-theme/src/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,20 @@ public function enrichForgeLink(string $reportButton, RenderContext $renderConte
}
if (str_ends_with($reportButton, '/new')) {
$reportButton .= '?issue[category_id]=1004&issue[subject]=';
$description = $this->getIssueTitle($renderContext);
$reportButton .= urlencode($description);
$version = $this->typo3VersionService->getPreferredVersion();
$extension = $this->themeSettings->getSettings('interlink_shortcode');
if ($extension === 'changelog') {
$extension = 'typo3/cms-core';
}
$description = $this->getIssueTitle(
$renderContext,
sprintf(
'https://docs.typo3.org/c/%s/%s/en-us',
$extension,
$version,
)
);
$reportButton .= urlencode($description);
switch ($version) {
case 'main':
$reportButton .= '&issue[custom_field_values][4]=' . Typo3VersionMapping::getMajorVersionOfMain()->value;
Expand All @@ -423,9 +434,13 @@ public function enrichForgeLink(string $reportButton, RenderContext $renderConte
* @param RenderContext $renderContext
* @return string
*/
public function getIssueTitle(RenderContext $renderContext): string
public function getIssueTitle(RenderContext $renderContext, ?string $docsPath = null): string
{
return 'Problem on ' . $this->themeSettings->getSettings('project_home') . '/' . $renderContext->getCurrentFileName() . '.html';
return sprintf(
'Problem on %s/%s.html',
$docsPath ?? $this->themeSettings->getSettings('project_home'),
$renderContext->getCurrentFileName()
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<li class="breadcrumb-item"><a href="Index.html">12.0 Changes</a></li>
<li aria-current="page" class="breadcrumb-item active">Breaking: #87616 - Removed hook for altering page links</li>
</ol>
<div class="breadcrumb-additions"> <a class="btn btn-sm btn-light" href="https://forge.typo3.org/projects/typo3cms-core/issues/new?issue[category_id]=1004&amp;issue[subject]=Problem+on+https%3A%2F%2Fextensions.typo3.org%2Fextension%2Fcore%2F%2FChangelog%2F12.0%2FBreaking-87616-RemovedHookForAlteringPageLinks.html&amp;issue[custom_field_values][4]=13" id="btnReportIssue" rel="nofollow noopener" target="_blank">
<div class="breadcrumb-additions"> <a class="btn btn-sm btn-light" href="https://forge.typo3.org/projects/typo3cms-core/issues/new?issue[category_id]=1004&amp;issue[subject]=Problem+on+https%3A%2F%2Fdocs.typo3.org%2Fc%2Ftypo3%2Fcms-core%2Fmain%2Fen-us%2FChangelog%2F12.0%2FBreaking-87616-RemovedHookForAlteringPageLinks.html&amp;issue[custom_field_values][4]=13" id="btnReportIssue" rel="nofollow noopener" target="_blank">
<span class="btn-icon"><i class="fas fa-bug"></i></span>
<span class="btn-text">Report issue</span>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<li class="breadcrumb-item"><a href="../../Changelog-12.html">ChangeLog v12</a></li>
<li aria-current="page" class="breadcrumb-item active">12.0 Changes</li>
</ol>
<div class="breadcrumb-additions"> <a class="btn btn-sm btn-light" href="https://forge.typo3.org/projects/typo3cms-core/issues/new?issue[category_id]=1004&amp;issue[subject]=Problem+on+https%3A%2F%2Fextensions.typo3.org%2Fextension%2Fcore%2F%2FChangelog%2F12.0%2FIndex.html&amp;issue[custom_field_values][4]=13" id="btnReportIssue" rel="nofollow noopener" target="_blank">
<div class="breadcrumb-additions"> <a class="btn btn-sm btn-light" href="https://forge.typo3.org/projects/typo3cms-core/issues/new?issue[category_id]=1004&amp;issue[subject]=Problem+on+https%3A%2F%2Fdocs.typo3.org%2Fc%2Ftypo3%2Fcms-core%2Fmain%2Fen-us%2FChangelog%2F12.0%2FIndex.html&amp;issue[custom_field_values][4]=13" id="btnReportIssue" rel="nofollow noopener" target="_blank">
<span class="btn-icon"><i class="fas fa-bug"></i></span>
<span class="btn-text">Report issue</span>
</a>
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/tests-full/changelog/expected/Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<ol class="breadcrumb">
<li aria-current="page" class="breadcrumb-item active">TYPO3 Core</li>
</ol>
<div class="breadcrumb-additions"> <a class="btn btn-sm btn-light" href="https://forge.typo3.org/projects/typo3cms-core/issues/new?issue[category_id]=1004&amp;issue[subject]=Problem+on+https%3A%2F%2Fextensions.typo3.org%2Fextension%2Fcore%2F%2FIndex.html&amp;issue[custom_field_values][4]=13" id="btnReportIssue" rel="nofollow noopener" target="_blank">
<div class="breadcrumb-additions"> <a class="btn btn-sm btn-light" href="https://forge.typo3.org/projects/typo3cms-core/issues/new?issue[category_id]=1004&amp;issue[subject]=Problem+on+https%3A%2F%2Fdocs.typo3.org%2Fc%2Ftypo3%2Fcms-core%2Fmain%2Fen-us%2FIndex.html&amp;issue[custom_field_values][4]=13" id="btnReportIssue" rel="nofollow noopener" target="_blank">
<span class="btn-icon"><i class="fas fa-bug"></i></span>
<span class="btn-text">Report issue</span>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<li class="breadcrumb-item"><a href="Index.html">TYPO3 Core</a></li>
<li aria-current="page" class="breadcrumb-item active">Sitemap</li>
</ol>
<div class="breadcrumb-additions"> <a class="btn btn-sm btn-light" href="https://forge.typo3.org/projects/typo3cms-core/issues/new?issue[category_id]=1004&amp;issue[subject]=Problem+on+https%3A%2F%2Fextensions.typo3.org%2Fextension%2Fcore%2F%2FSitemap.html&amp;issue[custom_field_values][4]=13" id="btnReportIssue" rel="nofollow noopener" target="_blank">
<div class="breadcrumb-additions"> <a class="btn btn-sm btn-light" href="https://forge.typo3.org/projects/typo3cms-core/issues/new?issue[category_id]=1004&amp;issue[subject]=Problem+on+https%3A%2F%2Fdocs.typo3.org%2Fc%2Ftypo3%2Fcms-core%2Fmain%2Fen-us%2FSitemap.html&amp;issue[custom_field_values][4]=13" id="btnReportIssue" rel="nofollow noopener" target="_blank">
<span class="btn-icon"><i class="fas fa-bug"></i></span>
<span class="btn-text">Report issue</span>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<ol class="breadcrumb">
<li aria-current="page" class="breadcrumb-item active">Document Title</li>
</ol>
<div class="breadcrumb-additions"> <a class="btn btn-sm btn-light" href="https://forge.typo3.org/projects/typo3cms-core/issues/new?issue[category_id]=1004&amp;issue[subject]=Problem+on+https%3A%2F%2Fdocs.typo3.org%2Fm%2Ftypo3%2Freference-coreapi%2F12.4%2Fen-us%2F%2Findex.html&amp;issue[custom_field_values][4]=12" id="btnReportIssue" rel="nofollow noopener" target="_blank">
<div class="breadcrumb-additions"> <a class="btn btn-sm btn-light" href="https://forge.typo3.org/projects/typo3cms-core/issues/new?issue[category_id]=1004&amp;issue[subject]=Problem+on+https%3A%2F%2Fdocs.typo3.org%2Fc%2F%2F12.4%2Fen-us%2Findex.html&amp;issue[custom_field_values][4]=12" id="btnReportIssue" rel="nofollow noopener" target="_blank">
<span class="btn-icon"><i class="fas fa-bug"></i></span>
<span class="btn-text">Report issue</span>
</a>
Expand Down

0 comments on commit 14f3efc

Please sign in to comment.