diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-06 15:10:04 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-06 15:10:04 +0000 |
commit | f3b1e07903a7f509b11ad7cf188fac46d98f77f6 (patch) | |
tree | a6fa5e65d83d94334387952f1f526ed438604408 /app | |
parent | ba174c982f40d71a87fd511b091753807174f7e7 (diff) | |
download | gitlab-ce-f3b1e07903a7f509b11ad7cf188fac46d98f77f6.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/api.js | 9 | ||||
-rw-r--r-- | app/assets/javascripts/static_site_editor/services/load_source_content.js | 15 | ||||
-rw-r--r-- | app/graphql/resolvers/projects/jira_imports_resolver.rb | 2 | ||||
-rw-r--r-- | app/helpers/ci_variables_helper.rb | 2 | ||||
-rw-r--r-- | app/models/concerns/has_repository.rb | 1 | ||||
-rw-r--r-- | app/models/project.rb | 1 | ||||
-rw-r--r-- | app/models/user.rb | 3 | ||||
-rw-r--r-- | app/views/layouts/nav/sidebar/_profile.html.haml | 5 | ||||
-rw-r--r-- | app/workers/all_queues.yml | 2 | ||||
-rw-r--r-- | app/workers/emails_on_push_worker.rb | 2 |
10 files changed, 36 insertions, 6 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 797eaf629bf..75f7fe62a7e 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -47,6 +47,7 @@ const Api = { adminStatisticsPath: '/api/:version/application/statistics', pipelineSinglePath: '/api/:version/projects/:id/pipelines/:pipeline_id', environmentsPath: '/api/:version/projects/:id/environments', + rawFilePath: '/api/:version/projects/:id/repository/files/:path/raw', group(groupId, callback) { const url = Api.buildUrl(Api.groupPath).replace(':id', groupId); @@ -497,6 +498,14 @@ const Api = { return axios.get(url); }, + getRawFile(id, path, params = { ref: 'master' }) { + const url = Api.buildUrl(this.rawFilePath) + .replace(':id', encodeURIComponent(id)) + .replace(':path', encodeURIComponent(path)); + + return axios.get(url, { params }); + }, + buildUrl(url) { return joinPaths(gon.relative_url_root || '', url.replace(':version', gon.api_version)); }, diff --git a/app/assets/javascripts/static_site_editor/services/load_source_content.js b/app/assets/javascripts/static_site_editor/services/load_source_content.js new file mode 100644 index 00000000000..1af93a8a2bc --- /dev/null +++ b/app/assets/javascripts/static_site_editor/services/load_source_content.js @@ -0,0 +1,15 @@ +import Api from '~/api'; + +const extractTitle = content => { + const matches = content.match(/title: (.+)\n/i); + + return matches ? Array.from(matches)[1] : ''; +}; + +const loadSourceContent = ({ projectId, sourcePath }) => + Api.getRawFile(projectId, sourcePath).then(({ data }) => ({ + title: extractTitle(data), + content: data, + })); + +export default loadSourceContent; diff --git a/app/graphql/resolvers/projects/jira_imports_resolver.rb b/app/graphql/resolvers/projects/jira_imports_resolver.rb index a9bfb7b612e..e7403745bea 100644 --- a/app/graphql/resolvers/projects/jira_imports_resolver.rb +++ b/app/graphql/resolvers/projects/jira_imports_resolver.rb @@ -16,6 +16,8 @@ module Resolvers end def authorized_resource?(project) + return false unless Feature.enabled?(:jira_issue_import, project) + Ability.allowed?(context[:current_user], :admin_project, project) end end diff --git a/app/helpers/ci_variables_helper.rb b/app/helpers/ci_variables_helper.rb index b271f069778..df220effd5d 100644 --- a/app/helpers/ci_variables_helper.rb +++ b/app/helpers/ci_variables_helper.rb @@ -9,6 +9,8 @@ module CiVariablesHelper if entity.is_a?(Group) create_deploy_token_group_settings_ci_cd_path(entity, opts) else + # TODO: change this path to 'create_deploy_token_project_settings_ci_cd_path' + # See MR comment for more detail: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27059#note_311585356 create_deploy_token_project_settings_repository_path(entity, opts) end end diff --git a/app/models/concerns/has_repository.rb b/app/models/concerns/has_repository.rb index 01f1aa1758f..35faa87e876 100644 --- a/app/models/concerns/has_repository.rb +++ b/app/models/concerns/has_repository.rb @@ -11,6 +11,7 @@ module HasRepository extend ActiveSupport::Concern include AfterCommitQueue include Referable + include Gitlab::ShellAdapter include Gitlab::Utils::StrongMemoize delegate :base_dir, :disk_path, to: :storage diff --git a/app/models/project.rb b/app/models/project.rb index cc7a732d94a..eb4412decba 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -4,7 +4,6 @@ require 'carrierwave/orm/activerecord' class Project < ApplicationRecord include Gitlab::ConfigHelper - include Gitlab::ShellAdapter include Gitlab::VisibilityLevel include AccessRequestable include Avatarable diff --git a/app/models/user.rb b/app/models/user.rb index 62624f8eec1..68c52751804 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -109,7 +109,6 @@ class User < ApplicationRecord # Groups has_many :members - has_one :max_access_level_membership, -> { select(:id, :user_id, :access_level).order(access_level: :desc).readonly }, class_name: 'Member' has_many :group_members, -> { where(requested_at: nil) }, source: 'GroupMember' has_many :groups, through: :group_members has_many :owned_groups, -> { where(members: { access_level: Gitlab::Access::OWNER }) }, through: :group_members, source: :group @@ -1080,7 +1079,7 @@ class User < ApplicationRecord end def highest_role - max_access_level_membership&.access_level || Gitlab::Access::NO_ACCESS + user_highest_role&.highest_access_level || Gitlab::Access::NO_ACCESS end def accessible_deploy_keys diff --git a/app/views/layouts/nav/sidebar/_profile.html.haml b/app/views/layouts/nav/sidebar/_profile.html.haml index 9be39d14169..15f1067f0d9 100644 --- a/app/views/layouts/nav/sidebar/_profile.html.haml +++ b/app/views/layouts/nav/sidebar/_profile.html.haml @@ -153,6 +153,9 @@ %strong.fly-out-top-item-name = _('Authentication Log') - = render_if_exists 'layouts/nav/sidebar/profile_pipeline_quota_link' + - if Feature.enabled?(:user_usage_quota) + = render_if_exists 'layouts/nav/sidebar/profile_usage_quotas_link' + - else + = render_if_exists 'layouts/nav/sidebar/profile_pipeline_quota_link' = render 'shared/sidebar_toggle_button' diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 4c8b703d60e..e37fa52f5ff 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -1021,7 +1021,7 @@ - :name: emails_on_push :feature_category: :source_code_management :has_external_dependencies: - :urgency: :high + :urgency: :low :resource_boundary: :cpu :weight: 2 :idempotent: diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb index cc114acf7e9..2f0d7fecf19 100644 --- a/app/workers/emails_on_push_worker.rb +++ b/app/workers/emails_on_push_worker.rb @@ -6,7 +6,7 @@ class EmailsOnPushWorker # rubocop:disable Scalability/IdempotentWorker attr_reader :email, :skip_premailer feature_category :source_code_management - urgency :high + urgency :low worker_resource_boundary :cpu weight 2 |