chore: fix the comment context menu drop down

This commit is contained in:
Rajesh Jonnalagadda 2024-11-28 18:12:06 +05:30
parent d36fece725
commit 5d9651b8ed
2 changed files with 15 additions and 0 deletions

View File

@ -126,6 +126,13 @@
{{template "repo/diff/conversation" dict "." $ "comments" $line.Comments}} {{template "repo/diff/conversation" dict "." $ "comments" $line.Comments}}
</td> </td>
</tr> </tr>
<button class="pull-request-diff-comments hidden"></button>
<script class="pull-request-diff-comments">
var $buttons = document.querySelector('button.pull-request-diff-comments');
if ($buttons) {
$buttons.click();
}
</script>
{{end}} {{end}}
{{end}} {{end}}
{{end}} {{end}}

View File

@ -19,6 +19,7 @@ import {
import {POST, GET} from '../modules/fetch.ts'; import {POST, GET} from '../modules/fetch.ts';
import {fomanticQuery} from '../modules/fomantic/base.ts'; import {fomanticQuery} from '../modules/fomantic/base.ts';
import {createTippy} from '../modules/tippy.ts'; import {createTippy} from '../modules/tippy.ts';
import {initGlobalDropdown} from './common-page.ts';
const {pageData, i18n} = window.config; const {pageData, i18n} = window.config;
@ -94,6 +95,13 @@ function initRepoDiffConversationForm() {
} }
}); });
$(document).on('click', '.pull-request-diff-comments', async (e) => {
e.preventDefault();
initGlobalDropdown();
// post initiation cleaning up the buttons and scripts
$('.pull-request-diff-comments').remove();
});
$(document).on('click', '.resolve-conversation', async function (e) { $(document).on('click', '.resolve-conversation', async function (e) {
e.preventDefault(); e.preventDefault();
const comment_id = $(this).data('comment-id'); const comment_id = $(this).data('comment-id');