diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/assets/javascripts/flash.js | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) | |
download | gitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/assets/javascripts/flash.js')
-rw-r--r-- | app/assets/javascripts/flash.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/assets/javascripts/flash.js b/app/assets/javascripts/flash.js index 2bec39ff4d8..7a79f8f5bfc 100644 --- a/app/assets/javascripts/flash.js +++ b/app/assets/javascripts/flash.js @@ -9,6 +9,10 @@ const FLASH_TYPES = { WARNING: 'warning', }; +const getCloseEl = (flashEl) => { + return flashEl.querySelector('.js-close-icon'); +}; + const hideFlash = (flashEl, fadeTransition = true) => { if (fadeTransition) { Object.assign(flashEl.style, { @@ -56,9 +60,7 @@ const createFlashEl = (message, type) => ` `; const removeFlashClickListener = (flashEl, fadeTransition) => { - flashEl - .querySelector('.js-close-icon') - .addEventListener('click', () => hideFlash(flashEl, fadeTransition)); + getCloseEl(flashEl).addEventListener('click', () => hideFlash(flashEl, fadeTransition)); }; /* @@ -114,6 +116,10 @@ const createFlash = function createFlash({ if (captureError && error) Sentry.captureException(error); + flashContainer.close = () => { + getCloseEl(flashEl).click(); + }; + return flashContainer; }; |