Skip to content

Commit 267dbb4

Browse files
Remove jQuery from the issue reference context popup (#29367)
- Removed all jQuery calls - Tested the context popup functionality and it works as before # Demo without jQuery ![action](https://github.com/go-gitea/gitea/assets/20454870/90b53de5-a8e9-4ed7-9236-1c9dfc324f38) --------- Signed-off-by: Yarden Shoham <[email protected]> Co-authored-by: Giteabot <[email protected]>
1 parent 553d46e commit 267dbb4

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

web_src/js/components/ContextPopup.vue

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script>
2-
import $ from 'jquery';
32
import {SvgIcon} from '../svg.js';
43
import {useLightTextOnBackground} from '../utils/color.js';
54
import tinycolor from 'tinycolor2';
5+
import {GET} from '../modules/fetch.js';
66
77
const {appSubUrl, i18n} = window.config;
88
@@ -80,20 +80,23 @@ export default {
8080
});
8181
},
8282
methods: {
83-
load(data) {
83+
async load(data) {
8484
this.loading = true;
8585
this.i18nErrorMessage = null;
86-
$.get(`${appSubUrl}/${data.owner}/${data.repo}/issues/${data.index}/info`).done((issue) => {
87-
this.issue = issue;
88-
}).fail((jqXHR) => {
89-
if (jqXHR.responseJSON && jqXHR.responseJSON.message) {
90-
this.i18nErrorMessage = jqXHR.responseJSON.message;
91-
} else {
92-
this.i18nErrorMessage = i18n.network_error;
86+
87+
try {
88+
const response = await GET(`${appSubUrl}/${data.owner}/${data.repo}/issues/${data.index}/info`);
89+
const respJson = await response.json();
90+
if (!response.ok) {
91+
this.i18nErrorMessage = respJson.message ?? i18n.network_error;
92+
return;
9393
}
94-
}).always(() => {
94+
this.issue = respJson;
95+
} catch {
96+
this.i18nErrorMessage = i18n.network_error;
97+
} finally {
9598
this.loading = false;
96-
});
99+
}
97100
}
98101
}
99102
};

0 commit comments

Comments
 (0)