perf: sent data-path once for each file (#17657)

- Don't sent it with each line, instead send it at the top-element for each file.
- Related:
https://github.com/go-gitea/gitea/pull/17618#issuecomment-968192761

2.5K Additions:
No-Patch:
Unified: 2.14 MB (2.14 MB size)
Split: 2.59 MB (2.59 MB size)

Patch:
Unified: 2.10 MB (2.10 MB size) (-1.8%)
Split: 2.55 MB (2.55 MB size) (-1.5%)
This commit is contained in:
Gusted 2021-11-19 02:28:27 +00:00 committed by GitHub
parent a85e75b2b1
commit 96ec656cf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 11 deletions

View file

@ -29,9 +29,9 @@ export function initRepoDiffConversationForm() {
form.closest('.conversation-holder').replaceWith(newConversationHolder);
if (form.closest('tr').data('line-type') === 'same') {
$(`a.add-code-comment[data-path="${path}"][data-idx="${idx}"]`).addClass('invisible');
$(`[data-path="${path}"] a.add-code-comment[data-idx="${idx}"]`).addClass('invisible');
} else {
$(`a.add-code-comment[data-path="${path}"][data-side="${side}"][data-idx="${idx}"]`).addClass('invisible');
$(`[data-path="${path}"] a.add-code-comment[data-side="${side}"][data-idx="${idx}"]`).addClass('invisible');
}
newConversationHolder.find('.dropdown').dropdown();
initCompReactionSelector(newConversationHolder);