Fix error with initializiation of protected environments feature
Protected environments is a Premium feature. We did not have the check that the element on which the access dropdown is mounted actually exists and the component tried to add the listener on the non-existent element. It resulted in the runtime error.
By adding the check that the element on which the dropdown is rendered is in the DOM, protected environments are initialized only when it is available. To check that issue is fixed, go to Project =>Settings=> CI/CD
with the license under Premium (e.g. Starter). You should not see any console errors. Alternatively, you can remove the protected_environments
from PREMIUM_FEATURES
(line 141 in ee/app/models/gitlab_subscriptions/features.rb
)
Related to #344897 (closed)
Edited by Olena Horal-Koretska