debian-mirror-gitlab/app/assets/javascripts/surveys/merge_request_experience/index.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
740 B
JavaScript
Raw Normal View History

2022-08-13 15:12:31 +05:30
import { Tracker } from '~/tracking/tracker';
const MR_SURVEY_WAIT_DURATION = 10000;
const broadcastNotificationVisible = () => {
// We don't want to clutter up the UI by displaying the survey when broadcast message(s)
// are visible as well.
return Boolean(document.querySelector('.broadcast-notification-message'));
};
export const initMrExperienceSurvey = () => {
if (!gon.features?.mrExperienceSurvey) return;
if (!gon.current_user_id) return;
if (!Tracker.enabled()) return;
if (broadcastNotificationVisible()) return;
setTimeout(() => {
// eslint-disable-next-line promise/catch-or-return
import('./app').then(({ startMrSurveyApp }) => {
startMrSurveyApp();
});
}, MR_SURVEY_WAIT_DURATION);
};