diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-22 22:11:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-22 22:11:50 +0300 |
commit | 92e314ffe8a2a292d6da149f8ee403e008dd1bce (patch) | |
tree | 2a1874d3fe7f1f291b6ddd03e6e88b414bf60ef4 /app | |
parent | 793034a90509193ebf2ad14ed8e5eea10f7c6b4a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/settings/packages_and_registries_controller.rb | 7 | ||||
-rw-r--r-- | app/helpers/groups_helper.rb | 6 | ||||
-rw-r--r-- | app/helpers/nav_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 15 | ||||
-rw-r--r-- | app/presenters/search_service_presenter.rb | 2 | ||||
-rw-r--r-- | app/services/projects/group_links/update_service.rb | 20 | ||||
-rw-r--r-- | app/services/projects/transfer_service.rb | 14 | ||||
-rw-r--r-- | app/views/clusters/clusters/_provider_details_form.html.haml | 4 | ||||
-rw-r--r-- | app/views/clusters/clusters/aws/_new.html.haml | 4 | ||||
-rw-r--r-- | app/views/clusters/clusters/gcp/_form.html.haml | 4 | ||||
-rw-r--r-- | app/views/clusters/clusters/user/_form.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/registry/settings/_index.haml | 9 | ||||
-rw-r--r-- | app/views/projects/settings/ci_cd/_autodevops_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/settings/ci_cd/show.html.haml | 3 |
14 files changed, 48 insertions, 50 deletions
diff --git a/app/controllers/projects/settings/packages_and_registries_controller.rb b/app/controllers/projects/settings/packages_and_registries_controller.rb index fee51dc1311..8f0a19cfac5 100644 --- a/app/controllers/projects/settings/packages_and_registries_controller.rb +++ b/app/controllers/projects/settings/packages_and_registries_controller.rb @@ -16,7 +16,12 @@ module Projects private def packages_and_registries_settings_enabled! - render_404 unless settings_packages_and_registries_enabled?(project) + render_404 unless can_destroy_container_registry_image?(project) + end + + def can_destroy_container_registry_image?(project) + Gitlab.config.registry.enabled && + can?(current_user, :destroy_container_image, project) end end end diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 26a5df321cd..0d8cbaae97e 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -45,11 +45,7 @@ module GroupsHelper end def group_information_title(group) - if Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml) - group.subgroup? ? _('Subgroup information') : _('Group information') - else - group.subgroup? ? _('Subgroup overview') : _('Group overview') - end + group.subgroup? ? _('Subgroup information') : _('Group information') end def group_container_registry_nav? diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb index b5171dfbebd..29887fb238b 100644 --- a/app/helpers/nav_helper.rb +++ b/app/helpers/nav_helper.rb @@ -73,9 +73,7 @@ module NavHelper milestones#index boards#index boards#show - ].tap do |paths| - paths << 'labels#index' if Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml) - end + ] end private diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 8800bd0643c..8df03c39690 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -611,21 +611,6 @@ module ProjectsHelper project.unlink_forks_upon_visibility_decrease_enabled? && project.visibility_level > Gitlab::VisibilityLevel::PRIVATE && project.forks_count > 0 end - def settings_container_registry_expiration_policy_available?(project) - Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml) && - can_destroy_container_registry_image?(current_user, project) - end - - def settings_packages_and_registries_enabled?(project) - Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml) && - can_destroy_container_registry_image?(current_user, project) - end - - def can_destroy_container_registry_image?(current_user, project) - Gitlab.config.registry.enabled && - can?(current_user, :destroy_container_image, project) - end - def build_project_breadcrumb_link(project) project_name = simple_sanitize(project.name) diff --git a/app/presenters/search_service_presenter.rb b/app/presenters/search_service_presenter.rb index e14446bb2f7..ab43800b9f2 100644 --- a/app/presenters/search_service_presenter.rb +++ b/app/presenters/search_service_presenter.rb @@ -16,7 +16,7 @@ class SearchServicePresenter < Gitlab::View::Presenter::Delegated blobs: :with_web_entity_associations }.freeze - SORT_ENABLED_SCOPES = %w(issues merge_requests).freeze + SORT_ENABLED_SCOPES = %w(issues merge_requests epics).freeze def search_objects @search_objects ||= begin diff --git a/app/services/projects/group_links/update_service.rb b/app/services/projects/group_links/update_service.rb index 7de4b7a211d..475ab17f1a1 100644 --- a/app/services/projects/group_links/update_service.rb +++ b/app/services/projects/group_links/update_service.rb @@ -12,15 +12,29 @@ module Projects def execute(group_link_params) group_link.update!(group_link_params) - if requires_authorization_refresh?(group_link_params) - group_link.group.refresh_members_authorized_projects - end + refresh_authorizations if requires_authorization_refresh?(group_link_params) end private attr_reader :group_link + def refresh_authorizations + if Feature.enabled?(:specialized_worker_for_project_share_update_auth_recalculation) + AuthorizedProjectUpdate::ProjectRecalculateWorker.perform_async(project.id) + + # Until we compare the inconsistency rates of the new specialized worker and + # the old approach, we still run AuthorizedProjectsWorker + # but with some delay and lower urgency as a safety net. + group_link.group.refresh_members_authorized_projects( + blocking: false, + priority: UserProjectAccessChangedService::LOW_PRIORITY + ) + else + group_link.group.refresh_members_authorized_projects + end + end + def requires_authorization_refresh?(params) params.include?(:group_access) end diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index d9e49dfae61..fb0fea756bc 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -139,7 +139,19 @@ module Projects user_ids = @old_namespace.user_ids_for_project_authorizations | @new_namespace.user_ids_for_project_authorizations - UserProjectAccessChangedService.new(user_ids).execute + if Feature.enabled?(:specialized_worker_for_project_transfer_auth_recalculation) + AuthorizedProjectUpdate::ProjectRecalculateWorker.perform_async(project.id) + + # Until we compare the inconsistency rates of the new specialized worker and + # the old approach, we still run AuthorizedProjectsWorker + # but with some delay and lower urgency as a safety net. + UserProjectAccessChangedService.new(user_ids).execute( + blocking: false, + priority: UserProjectAccessChangedService::LOW_PRIORITY + ) + else + UserProjectAccessChangedService.new(user_ids).execute + end end def rollback_side_effects diff --git a/app/views/clusters/clusters/_provider_details_form.html.haml b/app/views/clusters/clusters/_provider_details_form.html.haml index a936cdc04dd..fe3d1998234 100644 --- a/app/views/clusters/clusters/_provider_details_form.html.haml +++ b/app/views/clusters/clusters/_provider_details_form.html.haml @@ -43,13 +43,13 @@ label_class: 'label-bold' } .form-text.text-muted = s_('ClusterIntegration|Allow GitLab to manage namespaces and service accounts for this cluster.') - = link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'gitlab-managed-clusters'), target: '_blank' + = link_to _('More information'), help_page_path('user/project/clusters/gitlab_managed_clusters.md'), target: '_blank' .form-group = field.check_box :namespace_per_environment, { label: s_('ClusterIntegration|Namespace per environment'), label_class: 'label-bold' } .form-text.text-muted = s_('ClusterIntegration|Deploy each environment to its own namespace. Otherwise, environments within a project share a project-wide namespace. Note that anyone who can trigger a deployment of a namespace can read its secrets. If modified, existing environments will use their current namespaces until the cluster cache is cleared.') - = link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'custom-namespace'), target: '_blank' + = link_to _('More information'), help_page_path('user/project/clusters/deploy_to_cluster.md', anchor: 'custom-namespace'), target: '_blank' - if cluster.allow_user_defined_namespace? = render('clusters/clusters/namespace', platform_field: platform_field, field: field) diff --git a/app/views/clusters/clusters/aws/_new.html.haml b/app/views/clusters/clusters/aws/_new.html.haml index bdd4b76bba0..93db7db06b3 100644 --- a/app/views/clusters/clusters/aws/_new.html.haml +++ b/app/views/clusters/clusters/aws/_new.html.haml @@ -3,8 +3,8 @@ anchor: 'additional-requirements-for-self-managed-instances') } = s_('Amazon authentication is not %{link_start}correctly configured%{link_end}. Ask your GitLab administrator if you want to use this service.').html_safe % { link_start: documentation_link_start, link_end: '<a/>'.html_safe } - else - .js-create-eks-cluster-form-container{ data: { 'gitlab-managed-cluster-help-path' => help_page_path('user/project/clusters/index.md', anchor: 'gitlab-managed-clusters'), - 'namespace-per-environment-help-path' => help_page_path('user/project/clusters/index.md', anchor: 'custom-namespace'), + .js-create-eks-cluster-form-container{ data: { 'gitlab-managed-cluster-help-path' => help_page_path('user/project/clusters/gitlab_managed_clusters.md'), + 'namespace-per-environment-help-path' => help_page_path('user/project/clusters/deploy_to_cluster.md', anchor: 'custom-namespace'), 'create-role-path' => clusterable.authorize_aws_role_path, 'create-cluster-path' => clusterable.create_aws_clusters_path, 'account-id' => Gitlab::CurrentSettings.eks_account_id, diff --git a/app/views/clusters/clusters/gcp/_form.html.haml b/app/views/clusters/clusters/gcp/_form.html.haml index 73a09f00fd6..5266fad9278 100644 --- a/app/views/clusters/clusters/gcp/_form.html.haml +++ b/app/views/clusters/clusters/gcp/_form.html.haml @@ -74,13 +74,13 @@ label_class: 'label-bold' } .form-text.text-muted = s_('ClusterIntegration|Allow GitLab to manage namespaces and service accounts for this cluster.') - = link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'gitlab-managed-clusters'), target: '_blank' + = link_to _('More information'), help_page_path('user/project/clusters/gitlab_managed_clusters.md', anchor: 'gitlab-managed-clusters'), target: '_blank' .form-group = field.check_box :namespace_per_environment, { label: s_('ClusterIntegration|Namespace per environment'), label_class: 'label-bold' } .form-text.text-muted = s_('ClusterIntegration|Deploy each environment to its own namespace. Otherwise, environments within a project share a project-wide namespace. Note that anyone who can trigger a deployment of a namespace can read its secrets. If modified, existing environments will use their current namespaces until the cluster cache is cleared.') - = link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'custom-namespace'), target: '_blank' + = link_to _('More information'), help_page_path('user/project/clusters/deploy_to_cluster.md', anchor: 'custom-namespace'), target: '_blank' .form-group.js-gke-cluster-creation-submit-container = field.submit s_('ClusterIntegration|Create Kubernetes cluster'), diff --git a/app/views/clusters/clusters/user/_form.html.haml b/app/views/clusters/clusters/user/_form.html.haml index 7d82fe06799..e9b84952c15 100644 --- a/app/views/clusters/clusters/user/_form.html.haml +++ b/app/views/clusters/clusters/user/_form.html.haml @@ -47,13 +47,13 @@ label_class: 'label-bold' } .form-text.text-muted = s_('ClusterIntegration|Allow GitLab to manage namespaces and service accounts for this cluster.') - = link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'gitlab-managed-clusters'), target: '_blank' + = link_to _('More information'), help_page_path('user/project/clusters/gitlab_managed_clusters.md'), target: '_blank' .form-group = field.check_box :namespace_per_environment, { label: s_('ClusterIntegration|Namespace per environment'), label_class: 'label-bold' } .form-text.text-muted = s_('ClusterIntegration|Deploy each environment to its own namespace. Otherwise, environments within a project share a project-wide namespace. Note that anyone who can trigger a deployment of a namespace can read its secrets. If modified, existing environments will use their current namespaces until the cluster cache is cleared.') - = link_to _('More information'), help_page_path('user/project/clusters/index.md', anchor: 'custom-namespace'), target: '_blank' + = link_to _('More information'), help_page_path('user/project/clusters/deploy_to_cluster.md', anchor: 'custom-namespace'), target: '_blank' = field.fields_for :platform_kubernetes, @user_cluster.platform_kubernetes do |platform_kubernetes_field| - if @user_cluster.allow_user_defined_namespace? diff --git a/app/views/projects/registry/settings/_index.haml b/app/views/projects/registry/settings/_index.haml deleted file mode 100644 index a4d4a1bb2dd..00000000000 --- a/app/views/projects/registry/settings/_index.haml +++ /dev/null @@ -1,9 +0,0 @@ -#js-registry-settings{ data: { project_id: @project.id, - project_path: @project.full_path, - cadence_options: cadence_options.to_json, - keep_n_options: keep_n_options.to_json, - older_than_options: older_than_options.to_json, - is_admin: current_user&.admin.to_s, - admin_settings_path: ci_cd_admin_application_settings_path(anchor: 'js-registry-settings'), - enable_historic_entries: container_expiration_policies_historic_entry_enabled?(@project).to_s, - tags_regex_help_page_path: help_page_path('user/packages/container_registry/index', anchor: 'regex-pattern-examples') } } diff --git a/app/views/projects/settings/ci_cd/_autodevops_form.html.haml b/app/views/projects/settings/ci_cd/_autodevops_form.html.haml index 68e4bed8b9a..8563f28eb33 100644 --- a/app/views/projects/settings/ci_cd/_autodevops_form.html.haml +++ b/app/views/projects/settings/ci_cd/_autodevops_form.html.haml @@ -6,7 +6,7 @@ - kubernetes_cluster_path = help_page_path('user/project/clusters/index') - kubernetes_cluster_link_start = link_start % { url: kubernetes_cluster_path } -- base_domain_path = help_page_path('user/project/clusters/index', anchor: 'base-domain') +- base_domain_path = help_page_path('user/project/clusters/gitlab_managed_clusters', anchor: 'base-domain') - base_domain_link_start = link_start % { url: base_domain_path } .row diff --git a/app/views/projects/settings/ci_cd/show.html.haml b/app/views/projects/settings/ci_cd/show.html.haml index ade3d40a8df..044e02874c3 100644 --- a/app/views/projects/settings/ci_cd/show.html.haml +++ b/app/views/projects/settings/ci_cd/show.html.haml @@ -75,9 +75,6 @@ .settings-content = render 'projects/triggers/index' -- if settings_container_registry_expiration_policy_available?(@project) - = render 'projects/registry/settings/index' - = render_if_exists 'projects/settings/ci_cd/auto_rollback', expanded: expanded - if can?(current_user, :create_freeze_period, @project) |