Skip to content
Snippets Groups Projects
Commit bbaf2bb0 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent e9c2bf26
No related branches found
No related tags found
No related merge requests found
Showing
with 131 additions and 61 deletions
Loading
Loading
@@ -331,26 +331,13 @@ RSpec/MissingExampleGroupArgument:
RSpec/UnspecifiedException:
Enabled: false
 
# Work in progress. See https://gitlab.com/gitlab-org/gitlab/issues/196163
RSpec/HaveGitlabHttpStatus:
Enabled: true
Exclude:
- 'spec/support/matchers/have_gitlab_http_status.rb'
Include:
- 'spec/support/**/*'
- 'ee/spec/support/**/*'
- 'spec/features/**/*'
- 'ee/spec/features/**/*'
- 'spec/controllers/**/*'
- 'ee/spec/controllers/**/*'
- 'spec/requests/*.rb'
- 'ee/spec/requests/*.rb'
- 'spec/requests/{groups,projects,repositories}/**/*'
- 'ee/spec/requests/{groups,projects,repositories}/**/*'
- 'spec/requests/api/*/**/*.rb'
- 'ee/spec/requests/api/*/**/*.rb'
- 'spec/requests/api/[a-s]*.rb'
- 'ee/spec/requests/api/[a-s]*.rb'
- 'spec/**/*'
- 'ee/spec/**/*'
 
Style/MultilineWhenThen:
Enabled: false
Loading
Loading
Loading
Loading
@@ -61,9 +61,11 @@ class SnippetsFinder < UnionFinder
def execute
# The snippet query can be expensive, therefore if the
# author or project params have been passed and they don't
# exist, it's better to return
# exist, or if a Project has been passed and has snippets
# disabled, it's better to return
return Snippet.none if author.nil? && params[:author].present?
return Snippet.none if project.nil? && params[:project].present?
return Snippet.none if project && !project.feature_available?(:snippets, current_user)
 
items = init_collection
items = by_ids(items)
Loading
Loading
Loading
Loading
@@ -6,4 +6,5 @@
= icon('rss')
 
.content_list.project-activity{ :"data-href" => activity_project_path(@project) }
= spinner
.loading
.spinner.spinner-md
Loading
Loading
@@ -124,7 +124,7 @@
.save-project-loader.hide
.center
%h2
%i.fa.fa-spinner.fa-spin
.spinner.spinner-md.align-text-bottom
= _('Saving project.')
%p= _('Please wait a moment, this page will automatically refresh when ready.')
 
Loading
Loading
Loading
Loading
@@ -75,7 +75,7 @@
.save-project-loader.d-none
.center
%h2
%i.fa.fa-spinner.fa-spin
.spinner.spinner-md.align-text-bottom
= s_('ProjectsNew|Creating project & repository.')
%p
= s_('ProjectsNew|Please wait a moment, this page will automatically refresh when ready.')
Loading
Loading
@@ -3,7 +3,7 @@
.tabs-holder
%ul.pipelines-tabs.nav-links.no-top.no-bottom.mobile-separator.nav.nav-tabs
%li.js-pipeline-tab-link
= link_to @pipeline_path, data: { target: '#js-tab-pipeline', action: 'pipelines', toggle: 'tab' }, class: 'pipeline-tab' do
= link_to project_pipeline_path(@project, @pipeline), data: { target: '#js-tab-pipeline', action: 'pipelines', toggle: 'tab' }, class: 'pipeline-tab' do
= _('Pipeline')
%li.js-builds-tab-link
= link_to builds_project_pipeline_path(@project, @pipeline), data: { target: '#js-tab-builds', action: 'builds', toggle: 'tab' }, class: 'builds-tab' do
Loading
Loading
---
title: Update loader for various project views
merge_request: 25755
author: Phellipe K Ribeiro
type: other
---
title: Generate proper link for Pipeline tab
merge_request: 26193
author:
type: fixed
---
title: Improve SnippetsFinder performance with disabled project snippets
merge_request: 26295
author:
type: performance
# frozen_string_literal: true
# rubocop:disable Style/SignalException
def get_karma_files(files)
files.select do |file|
file.start_with?('ee/spec/javascripts', 'spec/javascripts') &&
!file.end_with?('browser_spec.js')
end
end
new_karma_files = get_karma_files(git.added_files.to_a)
unless new_karma_files.empty?
if GitlabDanger.new(helper.gitlab_helper).ci?
markdown(<<~MARKDOWN)
## New karma spec file
New frontend specs ([except `browser_specs`](https://gitlab.com/gitlab-org/gitlab/blob/3b6fe2f1077eedb0b8aff02a7350234f0b7dc4f9/spec/javascripts/lib/utils/browser_spec.js#L2)) should be
[written in jest](https://docs.gitlab.com/ee/development/testing_guide/frontend_testing.html#jest).
You have created the following tests, please migrate them over to jest:
* #{new_karma_files.map { |path| "`#{path}`" }.join("\n* ")}
MARKDOWN
end
fail "You have created a new karma spec file"
end
changed_karma_files = get_karma_files(helper.all_changed_files) - new_karma_files
return if changed_karma_files.empty?
warn 'You have edited karma spec files. Please consider migrating them to jest.'
if GitlabDanger.new(helper.gitlab_helper).ci?
markdown(<<~MARKDOWN)
## Edited karma files
You have edited the following karma spec files. Please consider migrating them to jest:
* #{changed_karma_files.map { |path| "`#{path}`" }.join("\n* ")}
In order to align with our Iteration value, migration can also be done as a follow-up.
For more information: [Jestodus epic](https://gitlab.com/groups/gitlab-org/-/epics/895)
MARKDOWN
end
Loading
Loading
@@ -4831,16 +4831,16 @@ enum MilestoneStateEnum {
}
 
"""
The position the adjacent object should be moved.
The position to which the adjacent object should be moved
"""
enum MoveType {
"""
The adjacent object will be moved after the object that is being moved.
The adjacent object will be moved after the object that is being moved
"""
after
 
"""
The adjacent object will be moved before the object that is being moved.
The adjacent object will be moved before the object that is being moved
"""
before
}
Loading
Loading
Loading
Loading
@@ -24550,20 +24550,20 @@
{
"kind": "ENUM",
"name": "MoveType",
"description": "The position the adjacent object should be moved.",
"description": "The position to which the adjacent object should be moved",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "before",
"description": "The adjacent object will be moved before the object that is being moved.",
"description": "The adjacent object will be moved before the object that is being moved",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "after",
"description": "The adjacent object will be moved after the object that is being moved.",
"description": "The adjacent object will be moved after the object that is being moved",
"isDeprecated": false,
"deprecationReason": null
}
Loading
Loading
Loading
Loading
@@ -15,10 +15,6 @@ limits](https://about.gitlab.com/handbook/product/#introducing-application-limit
 
## Development
 
The merge request to [configure maximum number of webhooks per
project](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/20730/diffs) is a
good example about configuring application limits.
### Insert database plan limits
 
In the `plan_limits` table, you have to create a new column and insert the
Loading
Loading
@@ -78,12 +74,22 @@ can be used to validate that a model does not exceed the limits. It ensures
that the count of the records for the current model does not exceed the defined
limit.
 
NOTE: **Note:** The name (pluralized) of the plan limit introduced in the
database (`project_hooks`) must correspond to the name of the model we are
validating (`ProjectHook`).
NOTE: **Note:** You must specify the limit scope of the object being validated
and the limit name if it's different from the pluralized model name.
 
```ruby
class ProjectHook
include Limitable
self.limit_name = 'project_hooks' # Optional as ProjectHook corresponds with project_hooks
self.limit_scope = :project
end
```
To test the model, you can include the shared examples.
```ruby
it_behaves_like 'includes Limitable concern' do
subject { build(:project_hook, project: create(:project)) }
end
```
Loading
Loading
@@ -8,6 +8,7 @@ class GitlabDanger
duplicate_yarn_dependencies
prettier
eslint
karma
database
commit_messages
].freeze
Loading
Loading
Loading
Loading
@@ -12051,9 +12051,6 @@ msgstr ""
msgid "Maximum number of comments exceeded"
msgstr ""
 
msgid "Maximum number of group hooks (%{count}) exceeded"
msgstr ""
msgid "Maximum number of mirrors that can be synchronizing at the same time."
msgstr ""
 
Loading
Loading
Loading
Loading
@@ -284,6 +284,17 @@ describe SnippetsFinder do
expect(described_class.new(user).execute).to contain_exactly(private_personal_snippet, internal_personal_snippet, public_personal_snippet)
end
end
context 'when project snippets are disabled' do
it 'returns quickly' do
disabled_snippets_project = create(:project, :snippets_disabled)
finder = described_class.new(user, project: disabled_snippets_project.id)
expect(finder).not_to receive(:init_collection)
expect(Snippet).to receive(:none).and_call_original
expect(finder.execute).to be_empty
end
end
end
 
it_behaves_like 'snippet visibility'
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@ describe GitlabDanger do
 
describe '.local_warning_message' do
it 'returns an informational message with rules that can run' do
expect(described_class.local_warning_message).to eq('==> Only the following Danger rules can be run locally: changes_size, documentation, frozen_string, duplicate_yarn_dependencies, prettier, eslint, database, commit_messages')
expect(described_class.local_warning_message).to eq('==> Only the following Danger rules can be run locally: changes_size, documentation, frozen_string, duplicate_yarn_dependencies, prettier, eslint, karma, database, commit_messages')
end
end
 
Loading
Loading
Loading
Loading
@@ -61,7 +61,7 @@ describe API::Tags do
it 'only returns searched tags' do
get api("#{route}", user), params: { search: 'v1.1.0' }
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response.size).to eq(1)
Loading
Loading
@@ -73,7 +73,7 @@ describe API::Tags do
it 'returns the repository tags' do
get api(route, current_user)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/tags')
expect(response).to include_pagination_headers
expect(json_response.map { |r| r['name'] }).to include(tag_name)
Loading
Loading
@@ -133,7 +133,7 @@ describe API::Tags do
it 'returns an array of project tags with release info' do
get api(route, user)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/tags')
expect(response).to include_pagination_headers
 
Loading
Loading
@@ -151,7 +151,7 @@ describe API::Tags do
it 'returns the repository branch' do
get api(route, current_user)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/tag')
expect(json_response['name']).to eq(tag_name)
end
Loading
Loading
@@ -214,7 +214,7 @@ describe API::Tags do
it 'creates a new tag' do
post api(route, current_user), params: { tag_name: tag_name, ref: 'master' }
 
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(response).to match_response_schema('public_api/v4/tag')
expect(json_response['name']).to eq(tag_name)
end
Loading
Loading
@@ -269,26 +269,26 @@ describe API::Tags do
it 'returns 400 if tag name is invalid' do
post api(route, current_user), params: { tag_name: 'new design', ref: 'master' }
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']).to eq('Tag name invalid')
end
 
it 'returns 400 if tag already exists' do
post api(route, current_user), params: { tag_name: 'new_design1', ref: 'master' }
 
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(response).to match_response_schema('public_api/v4/tag')
 
post api(route, current_user), params: { tag_name: 'new_design1', ref: 'master' }
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']).to eq('Tag new_design1 already exists')
end
 
it 'returns 400 if ref name is invalid' do
post api(route, current_user), params: { tag_name: 'new_design3', ref: 'foo' }
 
expect(response).to have_gitlab_http_status(400)
expect(response).to have_gitlab_http_status(:bad_request)
expect(json_response['message']).to eq('Target foo is invalid')
end
 
Loading
Loading
@@ -296,7 +296,7 @@ describe API::Tags do
it 'creates a new tag' do
post api(route, current_user), params: { tag_name: tag_name, ref: 'master', release_description: 'Wow' }
 
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(response).to match_response_schema('public_api/v4/tag')
expect(json_response['name']).to eq(tag_name)
expect(json_response['release']['description']).to eq('Wow')
Loading
Loading
@@ -315,7 +315,7 @@ describe API::Tags do
 
post api(route, current_user), params: { tag_name: 'v7.1.0', ref: 'master', message: 'Release 7.1.0' }
 
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(response).to match_response_schema('public_api/v4/tag')
expect(json_response['name']).to eq('v7.1.0')
expect(json_response['message']).to eq('Release 7.1.0')
Loading
Loading
@@ -337,7 +337,7 @@ describe API::Tags do
it 'deletes a tag' do
delete api(route, current_user)
 
expect(response).to have_gitlab_http_status(204)
expect(response).to have_gitlab_http_status(:no_content)
end
 
it_behaves_like '412 response' do
Loading
Loading
@@ -383,7 +383,7 @@ describe API::Tags do
it 'creates description for existing git tag' do
post api(route, user), params: { description: description }
 
expect(response).to have_gitlab_http_status(201)
expect(response).to have_gitlab_http_status(:created)
expect(response).to match_response_schema('public_api/v4/release/tag_release')
expect(json_response['tag_name']).to eq(tag_name)
expect(json_response['description']).to eq(description)
Loading
Loading
@@ -424,7 +424,7 @@ describe API::Tags do
it 'returns 409 if there is already a release' do
post api(route, user), params: { description: description }
 
expect(response).to have_gitlab_http_status(409)
expect(response).to have_gitlab_http_status(:conflict)
expect(json_response['message']).to eq('Release already exists')
end
end
Loading
Loading
@@ -449,7 +449,7 @@ describe API::Tags do
it 'updates the release description' do
put api(route, current_user), params: { description: new_description }
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['tag_name']).to eq(tag_name)
expect(json_response['description']).to eq(new_description)
end
Loading
Loading
Loading
Loading
@@ -57,7 +57,7 @@ describe 'task completion status response' do
get api("#{path}?iids[]=#{taskable.iid}", user)
end
 
it { expect(response).to have_gitlab_http_status(200) }
it { expect(response).to have_gitlab_http_status(:ok) }
 
it 'returns the expected results' do
expect(json_response).to be_an Array
Loading
Loading
Loading
Loading
@@ -25,7 +25,7 @@ describe API::Templates do
it 'returns a list of available gitignore templates' do
get api('/templates/gitignores')
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response.size).to be > 15
Loading
Loading
@@ -36,7 +36,7 @@ describe API::Templates do
it 'returns a list of available gitlab_ci_ymls' do
get api('/templates/gitlab_ci_ymls')
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response.first['name']).not_to be_nil
Loading
Loading
@@ -47,7 +47,7 @@ describe API::Templates do
it 'adds a disclaimer on the top' do
get api('/templates/gitlab_ci_ymls/Ruby')
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['content']).to start_with("# This file is a template,")
end
end
Loading
Loading
@@ -58,7 +58,7 @@ describe API::Templates do
end
 
it 'returns a license template' do
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
 
expect(json_response['key']).to eq('mit')
expect(json_response['name']).to eq('MIT License')
Loading
Loading
@@ -78,7 +78,7 @@ describe API::Templates do
it 'returns a list of available license templates' do
get api('/templates/licenses')
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response.size).to eq(12)
Loading
Loading
@@ -90,7 +90,7 @@ describe API::Templates do
it 'returns a list of available popular license templates' do
get api('/templates/licenses?popular=1')
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response.size).to eq(3)
Loading
Loading
@@ -173,7 +173,7 @@ describe API::Templates do
let(:license_type) { 'muth-over9000' }
 
it 'returns a 404' do
expect(response).to have_gitlab_http_status(404)
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
Loading
Loading
@@ -185,7 +185,7 @@ describe API::Templates do
it 'replaces the copyright owner placeholder with the name of the current user' do
get api('/templates/licenses/mit', user)
 
expect(response).to have_gitlab_http_status(200)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['content']).to include("Copyright (c) #{Time.now.year} #{user.name}")
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment