Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/serv.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func runServ(ctx context.Context, c *cli.Command) error {
if git.DefaultFeatures().SupportProcReceive {
// for AGit Flow
if cmd == "ssh_info" {
fmt.Print(`{"type":"gitea","version":1}`)
fmt.Print(`{"type":"agit","version":1}`)
return nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion routers/web/misc/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func SSHInfo(rw http.ResponseWriter, req *http.Request) {
return
}
rw.Header().Set("content-type", "text/json;charset=UTF-8")
_, err := rw.Write([]byte(`{"type":"gitea","version":1}`))
_, err := rw.Write([]byte(`{"type":"agit","version":1}`))
if err != nil {
log.Error("fail to write result: err: %v", err)
rw.WriteHeader(http.StatusInternalServerError)
Expand Down
1 change: 1 addition & 0 deletions web_src/fomantic/build/components/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ $.fn.dropdown = function(parameters) {
return true;
}
if(settings.onShow.call(element) !== false) {
settings.onAfterFiltered.call(element); // GITEA-PATCH: callback to correctly handle the filtered items
module.animate.show(function() {
if( module.can.click() ) {
module.bind.intent();
Expand Down
13 changes: 8 additions & 5 deletions web_src/js/features/common-fetch-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ async function fetchActionDoRequest(actionElem: HTMLElement, url: string, opt: R
actionElem.classList.remove('is-loading', 'loading-icon-2px');
}

async function formFetchAction(formEl: HTMLFormElement, e: SubmitEvent) {
async function onFormFetchActionSubmit(formEl: HTMLFormElement, e: SubmitEvent) {
e.preventDefault();
await submitFormFetchAction(formEl, submitEventSubmitter(e));
}

export async function submitFormFetchAction(formEl: HTMLFormElement, formSubmitter?: HTMLElement) {
if (formEl.classList.contains('is-loading')) return;

formEl.classList.add('is-loading');
Expand All @@ -68,7 +72,6 @@ async function formFetchAction(formEl: HTMLFormElement, e: SubmitEvent) {
const formMethod = formEl.getAttribute('method') || 'get';
const formActionUrl = formEl.getAttribute('action');
const formData = new FormData(formEl);
const formSubmitter = submitEventSubmitter(e);
const [submitterName, submitterValue] = [formSubmitter?.getAttribute('name'), formSubmitter?.getAttribute('value')];
if (submitterName) {
formData.append(submitterName, submitterValue || '');
Expand Down Expand Up @@ -96,7 +99,7 @@ async function formFetchAction(formEl: HTMLFormElement, e: SubmitEvent) {
await fetchActionDoRequest(formEl, reqUrl, reqOpt);
}

async function linkAction(el: HTMLElement, e: Event) {
async function onLinkActionClick(el: HTMLElement, e: Event) {
// A "link-action" can post AJAX request to its "data-url"
// Then the browser is redirected to: the "redirect" in response, or "data-redirect" attribute, or current URL by reloading.
// If the "link-action" has "data-modal-confirm" attribute, a confirm modal dialog will be shown before taking action.
Expand Down Expand Up @@ -126,6 +129,6 @@ async function linkAction(el: HTMLElement, e: Event) {
}

export function initGlobalFetchAction() {
addDelegatedEventListener(document, 'submit', '.form-fetch-action', formFetchAction);
addDelegatedEventListener(document, 'click', '.link-action', linkAction);
addDelegatedEventListener(document, 'submit', '.form-fetch-action', onFormFetchActionSubmit);
addDelegatedEventListener(document, 'click', '.link-action', onLinkActionClick);
}
3 changes: 2 additions & 1 deletion web_src/js/features/comp/LabelEdit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {toggleElem} from '../../utils/dom.ts';
import {fomanticQuery} from '../../modules/fomantic/base.ts';
import {submitFormFetchAction} from '../common-fetch-action.ts';

function nameHasScope(name: string): boolean {
return /.*[^/]\/[^/].*/.test(name);
Expand Down Expand Up @@ -70,7 +71,7 @@ export function initCompLabelEdit(pageSelector: string) {
form.reportValidity();
return false;
}
form.dispatchEvent(new Event('submit', {bubbles: true}));
submitFormFetchAction(form);
},
}).modal('show');
};
Expand Down