diff options
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/features/repo-commit.js | 43 | ||||
-rw-r--r-- | web_src/js/index.js | 7 |
2 files changed, 1 insertions, 49 deletions
diff --git a/web_src/js/features/repo-commit.js b/web_src/js/features/repo-commit.js index 7e2f6fa58e..f61ea08a42 100644 --- a/web_src/js/features/repo-commit.js +++ b/web_src/js/features/repo-commit.js @@ -1,7 +1,5 @@ import {createTippy} from '../modules/tippy.js'; import {toggleElem} from '../utils/dom.js'; -import {parseDom} from '../utils.js'; -import {POST} from '../modules/fetch.js'; export function initRepoEllipsisButton() { for (const button of document.querySelectorAll('.js-toggle-commit-body')) { @@ -14,47 +12,6 @@ export function initRepoEllipsisButton() { } } -export async function initRepoCommitLastCommitLoader() { - const entryMap = {}; - - const entries = Array.from(document.querySelectorAll('table#repo-files-table tr.notready'), (el) => { - const entryName = el.getAttribute('data-entryname'); - entryMap[entryName] = el; - return entryName; - }); - - if (entries.length === 0) { - return; - } - - const lastCommitLoaderURL = document.querySelector('table#repo-files-table').getAttribute('data-last-commit-loader-url'); - - if (entries.length > 200) { - // For more than 200 entries, replace the entire table - const response = await POST(lastCommitLoaderURL); - const data = await response.text(); - document.querySelector('table#repo-files-table').outerHTML = data; - return; - } - - // For fewer entries, update individual rows - const response = await POST(lastCommitLoaderURL, {data: {'f': entries}}); - const data = await response.text(); - const doc = parseDom(data, 'text/html'); - for (const row of doc.querySelectorAll('tr')) { - if (row.className === 'commit-list') { - document.querySelector('table#repo-files-table .commit-list')?.replaceWith(row); - continue; - } - // there are other <tr> rows in response (eg: <tr class="has-parent">) - // at the moment only the "data-entryname" rows should be processed - const entryName = row.getAttribute('data-entryname'); - if (entryName) { - entryMap[entryName]?.replaceWith(row); - } - } -} - export function initCommitStatuses() { for (const element of document.querySelectorAll('[data-tippy="commit-statuses"]')) { const top = document.querySelector('.repository.file.list') || document.querySelector('.repository.diff'); diff --git a/web_src/js/index.js b/web_src/js/index.js index b7f3ba99a0..c7eac9d242 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -33,11 +33,7 @@ import { initRepoPullRequestAllowMaintainerEdit, initRepoPullRequestReview, initRepoIssueSidebarList, initArchivedLabelHandler, } from './features/repo-issue.js'; -import { - initRepoEllipsisButton, - initRepoCommitLastCommitLoader, - initCommitStatuses, -} from './features/repo-commit.js'; +import {initRepoEllipsisButton, initCommitStatuses} from './features/repo-commit.js'; import { initFootLanguageMenu, initGlobalButtonClickOnEnter, @@ -148,7 +144,6 @@ onDomReady(() => { initRepoCommentForm(); initRepoEllipsisButton(); initRepoDiffCommitBranchesAndTags(); - initRepoCommitLastCommitLoader(); initRepoEditor(); initRepoGraphGit(); initRepoIssueContentHistory(); |