]> source.dussan.org Git - gitea.git/commitdiff
Fix UI language switching bug (#21597) (#21749)
authorXinyu Zhou <i@sourcehut.net>
Thu, 10 Nov 2022 02:14:32 +0000 (10:14 +0800)
committerGitHub <noreply@github.com>
Thu, 10 Nov 2022 02:14:32 +0000 (10:14 +0800)
Backport #21597

Related:
* https://github.com/go-gitea/gitea/pull/21596#issuecomment-1291450224

There was a bug when switching language by AJAX: the irrelevant POST
requests were processed by the target page's handler.

Now, use GET instead of POST. The GET requests should be harmless.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
web_src/js/features/common-global.js

index a3aebc024625cdf6df0b4bda086a2be26d51b2bc..b00b4aea9c075f3e9823389eb5410cb1f179891c 100644 (file)
@@ -37,7 +37,7 @@ export function initHeadNavbarContentToggle() {
 export function initFootLanguageMenu() {
   function linkLanguageAction() {
     const $this = $(this);
-    $.post($this.data('url')).always(() => {
+    $.get($this.data('url')).always(() => {
       window.location.reload();
     });
   }