From e8b316fc93e4582fcd16f5277ae97bb720a0b5a2 Mon Sep 17 00:00:00 2001 From: Pradeep CE (cep) Date: Feb 24 2017 08:59:12 +0000 Subject: Fix inline comment not showing on first click in PR page TLDR: When you click on the link to an inline comment, the URL is updated, but the comment was not shown. What happened: - Go to a random PR page. - Click on the line xx of path/to/file.py link on one of the inline comment cards. - The URL hash changes to something like #c-84ea5c920b7f17a09f095d615156b735ca1fa12c-18, but the actual comment is not shown. - Clicking on the same link again, though, shows the comment. The error was basically that the javascript checking the hash in the URL did not know what to do with hash like #c-. This commit fixes that and thus bring back the expected behaviour: clicking on the link brings you to the comment in the diff. Fixes https://pagure.io/pagure/issue/1964 --- diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index fb66894..60f5f1c 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -1251,7 +1251,8 @@ function updateHighlight(onload) { $('#pr-wrapper .tab-pane').removeClass('active'); // When the hash points to 'Files Changed' tab, or a highlight. if (location.hash.indexOf("request_diff") > -1 || - location.hash.indexOf("_") === 1) { + location.hash.indexOf("_") === 1 || + location.hash.indexOf("c-") === 1) { $('[href="#request_diff"]').addClass('active'); $('#request_diff').addClass('active'); }