mirror of https://github.com/go-gitea/gitea.git
fix
parent
780c7e1d95
commit
b3a0ec49c2
|
@ -228,5 +228,5 @@ func ForkPost(ctx *context.Context) {
|
|||
}
|
||||
|
||||
log.Trace("Repository forked[%d]: %s/%s", forkRepo.ID, ctxUser.Name, repo.Name)
|
||||
ctx.Redirect(ctxUser.HomeLink() + "/" + url.PathEscape(repo.Name))
|
||||
ctx.JSONRedirect(ctxUser.HomeLink() + "/" + url.PathEscape(repo.Name))
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</h3>
|
||||
<div class="ui attached segment">
|
||||
{{template "base/alert" .}}
|
||||
<form class="ui form left-right-form" action="{{.Link}}" method="post" data-prevent-duplicate>
|
||||
<form class="ui form form-fetch-action left-right-form" action="{{.Link}}" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<div class="inline required field {{if .Err_Owner}}error{{end}}">
|
||||
<label>{{ctx.Locale.Tr "repo.owner"}}</label>
|
||||
|
@ -75,7 +75,7 @@
|
|||
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<button class="ui primary button{{if not .CanForkRepoInNewOwner}} disabled{{end}}" type="submit">
|
||||
<button class="ui primary button{{if not .CanForkRepoInNewOwner}} disabled{{end}}">
|
||||
{{ctx.Locale.Tr "repo.fork_repo"}}
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -51,7 +51,7 @@ func testRepoFork(t *testing.T, session *TestSession, ownerName, repoName, forkO
|
|||
"repo_name": forkRepoName,
|
||||
"fork_single_branch": forkBranch,
|
||||
})
|
||||
session.MakeRequest(t, req, http.StatusSeeOther)
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
// Step4: check the existence of the forked repo
|
||||
req = NewRequestf(t, "GET", "/%s/%s", forkOwnerName, forkRepoName)
|
||||
|
|
|
@ -65,7 +65,6 @@ import {initGlobalButtonClickOnEnter, initGlobalButtons, initGlobalDeleteButton}
|
|||
import {initGlobalComboMarkdownEditor, initGlobalEnterQuickSubmit, initGlobalFormDirtyLeaveConfirm} from './features/common-form.ts';
|
||||
import {callInitFunctions} from './modules/init.ts';
|
||||
import {initRepoViewFileTree} from './features/repo-view-file-tree.ts';
|
||||
import {initFormSubmitHandlers} from './modules/form.ts';
|
||||
|
||||
initGiteaFomantic();
|
||||
initSubmitEventPolyfill();
|
||||
|
@ -86,7 +85,6 @@ onDomReady(() => {
|
|||
initGlobalComboMarkdownEditor,
|
||||
initGlobalDeleteButton,
|
||||
initGlobalInput,
|
||||
initFormSubmitHandlers,
|
||||
|
||||
initCommonOrganization,
|
||||
initCommonIssueListQuickGoto,
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
/**
|
||||
* Form handling utilities
|
||||
*/
|
||||
|
||||
import {addDelegatedEventListener} from '../utils/dom.ts';
|
||||
|
||||
/**
|
||||
* Prevent duplicate form submission
|
||||
* @param form The form element
|
||||
* @param submitter The submit button element
|
||||
*/
|
||||
function preventDuplicateSubmit(form: HTMLFormElement, submitter: HTMLElement) {
|
||||
form.addEventListener('submit', () => {
|
||||
submitter.classList.add('disabled');
|
||||
submitter.setAttribute('disabled', 'disabled');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize form submit handlers
|
||||
*/
|
||||
export function initFormSubmitHandlers() {
|
||||
// Add delegated event listener for forms with data-prevent-duplicate attribute
|
||||
addDelegatedEventListener(document, 'submit', 'form[data-prevent-duplicate]', (form: HTMLFormElement) => {
|
||||
const submitter = form.querySelector<HTMLElement>('button[type="submit"]');
|
||||
if (submitter) {
|
||||
preventDuplicateSubmit(form, submitter);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue