summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/jira_connect/subscriptions/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/jira_connect/subscriptions/index.js')
-rw-r--r--app/assets/javascripts/jira_connect/subscriptions/index.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/assets/javascripts/jira_connect/subscriptions/index.js b/app/assets/javascripts/jira_connect/subscriptions/index.js
index f1262be0174..8a7a80d885d 100644
--- a/app/assets/javascripts/jira_connect/subscriptions/index.js
+++ b/app/assets/javascripts/jira_connect/subscriptions/index.js
@@ -7,16 +7,20 @@ import Translate from '~/vue_shared/translate';
import JiraConnectApp from './components/app.vue';
import createStore from './store';
-import { getLocation, sizeToParent } from './utils';
+import { getGitlabSignInURL, sizeToParent } from './utils';
const store = createStore();
+/**
+ * Add `return_to` query param to all HAML-defined GitLab sign in links.
+ */
const updateSignInLinks = async () => {
- const location = await getLocation();
- Array.from(document.querySelectorAll('.js-jira-connect-sign-in')).forEach((el) => {
- const updatedLink = `${el.getAttribute('href')}?return_to=${location}`;
- el.setAttribute('href', updatedLink);
- });
+ await Promise.all(
+ Array.from(document.querySelectorAll('.js-jira-connect-sign-in')).map(async (el) => {
+ const updatedLink = await getGitlabSignInURL(el.getAttribute('href'));
+ el.setAttribute('href', updatedLink);
+ }),
+ );
};
export async function initJiraConnect() {