diff options
author | Luke Bennett <lbennett@gitlab.com> | 2019-02-20 00:26:07 +0300 |
---|---|---|
committer | Luke Bennett <lbennett@gitlab.com> | 2019-03-06 13:40:19 +0300 |
commit | 1263c79095c30fbdeecb26935aded531163c1b3e (patch) | |
tree | 572cfa6b06911395d0f6c772ffb82cdf52d17ec3 /app/assets/javascripts/persistent_user_callout.js | |
parent | c9e5ce8dbd25203484b43c48f0a55a5d7bf396e8 (diff) |
Add PersistentUserCallout factory method
Use factory method to DRY safe instantiation.
Add tests for PersistentUserCallout.
Diffstat (limited to 'app/assets/javascripts/persistent_user_callout.js')
-rw-r--r-- | app/assets/javascripts/persistent_user_callout.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/assets/javascripts/persistent_user_callout.js b/app/assets/javascripts/persistent_user_callout.js index 1e34e74a152..4a08e158f6b 100644 --- a/app/assets/javascripts/persistent_user_callout.js +++ b/app/assets/javascripts/persistent_user_callout.js @@ -31,4 +31,12 @@ export default class PersistentUserCallout { Flash(__('An error occurred while dismissing the alert. Refresh the page and try again.')); }); } + + static factory(container) { + if (!container) { + return undefined; + } + + return new PersistentUserCallout(container); + } } |