Skip to content

Commit 3f6bb54

Browse files
committed
fix initCompReactionSelector
1 parent 7ca0877 commit 3f6bb54

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

web_src/js/features/comp/ReactionSelector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {POST} from '../../modules/fetch.ts';
22
import {fomanticQuery} from '../../modules/fomantic/base.ts';
33

4-
export function initCompReactionSelector() {
5-
for (const container of document.querySelectorAll('.issue-content, .diff-file-body')) {
4+
export function initCompReactionSelector(parent: ParentNode = document) {
5+
for (const container of parent.querySelectorAll('.issue-content, .diff-file-body')) {
66
container.addEventListener('click', async (e) => {
77
// there are 2 places for the "reaction" buttons, one is the top-right reaction menu, one is the bottom of the comment
88
const target = e.target.closest('.comment-reaction-button');

web_src/js/features/repo-diff.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function initRepoDiffFileViewToggle() {
3838
}
3939

4040
function initRepoDiffConversationForm() {
41-
addDelegatedEventListener<HTMLFormElement>(document, 'submit', '.conversation-holder form', async (form, e) => {
41+
addDelegatedEventListener<HTMLFormElement, SubmitEvent>(document, 'submit', '.conversation-holder form', async (form, e) => {
4242
e.preventDefault();
4343
const textArea = form.querySelector<HTMLTextAreaElement>('textarea');
4444
if (!validateTextareaNonEmpty(textArea)) return;
@@ -115,7 +115,7 @@ function initRepoDiffConversationForm() {
115115
const $conversation = $(data);
116116
$(this).closest('.conversation-holder').replaceWith($conversation);
117117
$conversation.find('.dropdown').dropdown();
118-
initCompReactionSelector($conversation);
118+
initCompReactionSelector($conversation[0]);
119119
} else {
120120
window.location.reload();
121121
}

0 commit comments

Comments
 (0)