project Websites / Gitlab Issue Listing Script avatar

websites/Gitlab-Issue-Listing-Script#17: Relative issue references don't link correctly



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.3
Created: 14-Mar-22 13:05



Description

If an issue is referenced using only it's number (e.g. #17) the link won't generate correctly. For example

 btasker 2022-03-13T11:14:07.524Z mentioned in issue [#14](/issue/websites/Gitlab-Issue-Listing-Script/14.html)

The link is to /issue//14.html

We need to detect those links and insert the project prefix.



Toggle State Changes

Activity


assigned to @btasker

Testing #14

verified

mentioned in commit 7e7a3c228fdfa7205eb38ed7c5c48a5cc803bf73

Commit: 7e7a3c228fdfa7205eb38ed7c5c48a5cc803bf73 
Author: B Tasker                            
                            
Date: 2022-04-16T13:53:36.000+01:00 

Message

Implement partial handling of relative issue references for websites/Gitlab-Issue-Listing-Script#17

This'll only work where issues are x-referenced from other issues - commits won't work.

We need to decide on how best to fetch the current project reference - do we pull it from a global somewhere, or do we have qs2sef pull it out of the url?

+9 -2 (11 lines changed)

Commit 787a3c22 is only a partial fix - it'll handle cross-issue references, but doesn't do anything for references in commit messages.

We need qs2sef() to be able to pull the current project reference from somewhere - whether that's direct from a URL, or stored in a global somewhere

verified

mentioned in commit aa09f40d0e6a9e9894e4bad93b8e95f833437ab0

Commit: aa09f40d0e6a9e9894e4bad93b8e95f833437ab0 
Author: B Tasker                            
                            
Date: 2022-04-17T09:31:48.000+01:00 

Message

Improve handling of relative links for #17

If there isn't a project name in the provided reference, we'll check whether the page currently being viewed has one.

If not, then we revert to the behaviour that was present before this commit and return a relative link

+16 -3 (19 lines changed)

The behaviour has been updated to take a project name from the current URL if one isn't included in the issue reference itself.

Assuming there isn't one (there'll be some view, somewhere, where that's true) then we'll do a hail mary and return a relative link.

This has been tested in the fixing commit aa09f40d

mentioned in issue #41