holmari / gerritstats

Tool for creating statistics from a Gerrit repository
MIT License
193 stars 54 forks source link

Link to comment does not quite work because URL format changed ("/#/c/" not expected anymore) #80

Open SylvainDe opened 1 year ago

SylvainDe commented 1 year ago

On the particular instance of Gerrit I am using, the link to comments do not work. In fact, it looks like the format of the link has changed at some point (removing the "/#/c" part) and the gerritstats code was not updated accordingly.

If anyone is facing the same issue, here is the fix to change things:

--- a/GerritStats/src/main/frontend/profile/ReviewCommentsPanel.jsx
+++ b/GerritStats/src/main/frontend/profile/ReviewCommentsPanel.jsx
@@ -17,7 +17,8 @@ import SelectedUsers from '../common/model/SelectedUsers';
 function getGerritUrlForComment(commit, patchSet, comment) {
     var url = commit.url;
     var baseUrl = url.substring(0, url.lastIndexOf('/'));
-    return baseUrl + '/#/c/' + commit.commitNumber + '/' + patchSet.number + '/' + comment.file;
+    return baseUrl + '/' + commit.commitNumber + '/' + patchSet.number + '/' + comment.file;
+    //return baseUrl + '/#/c/' + commit.commitNumber + '/' + patchSet.number + '/' + comment.file;
 }

 function escapeHtml(text) {

I do not know when the format got changed on the Gerrit side but it is it old enough, I'm happy to provide a PR for this.