From 8c3ba8d6c9021f250fb1597f6b597d817af46b38 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 6 Jun 2016 13:16:30 +0200 Subject: [PATCH 01/87] Add workhorse controller and API helpers --- app/controllers/application_controller.rb | 1 + app/controllers/projects/avatars_controller.rb | 5 +---- app/controllers/projects/raw_controller.rb | 5 +---- .../projects/repositories_controller.rb | 3 +-- app/helpers/workhorse_helper.rb | 17 +++++++++++++++++ db/schema.rb | 1 + lib/api/helpers.rb | 10 ++++++++++ lib/api/repositories.rb | 10 +++------- lib/gitlab/workhorse.rb | 8 ++++---- .../controllers/projects/raw_controller_spec.rb | 2 ++ .../projects/repositories_controller_spec.rb | 5 +++-- spec/lib/gitlab/workhorse_spec.rb | 2 +- 12 files changed, 45 insertions(+), 24 deletions(-) create mode 100644 app/helpers/workhorse_helper.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 62f63701799..cd6ae507cf1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,6 +6,7 @@ class ApplicationController < ActionController::Base include Gitlab::GonHelper include GitlabRoutingHelper include PageLayoutHelper + include WorkhorseHelper before_action :authenticate_user_from_token! before_action :authenticate_user! diff --git a/app/controllers/projects/avatars_controller.rb b/app/controllers/projects/avatars_controller.rb index 72921b3aa14..5962f74c39b 100644 --- a/app/controllers/projects/avatars_controller.rb +++ b/app/controllers/projects/avatars_controller.rb @@ -10,10 +10,7 @@ class Projects::AvatarsController < Projects::ApplicationController return if cached_blob? - headers.store(*Gitlab::Workhorse.send_git_blob(@repository, @blob)) - headers['Content-Disposition'] = 'inline' - headers['Content-Type'] = safe_content_type(@blob) - head :ok # 'render nothing: true' messes up the Content-Type + send_git_blob @repository, @blob else render_404 end diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb index 10de0e60530..10d24da16d7 100644 --- a/app/controllers/projects/raw_controller.rb +++ b/app/controllers/projects/raw_controller.rb @@ -18,10 +18,7 @@ class Projects::RawController < Projects::ApplicationController if @blob.lfs_pointer? send_lfs_object else - headers.store(*Gitlab::Workhorse.send_git_blob(@repository, @blob)) - headers['Content-Disposition'] = 'inline' - headers['Content-Type'] = safe_content_type(@blob) - head :ok # 'render nothing: true' messes up the Content-Type + send_git_blob @repository, @blob end else render_404 diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb index bb7a6b6a5ab..d5af0341d18 100644 --- a/app/controllers/projects/repositories_controller.rb +++ b/app/controllers/projects/repositories_controller.rb @@ -11,8 +11,7 @@ class Projects::RepositoriesController < Projects::ApplicationController end def archive - headers.store(*Gitlab::Workhorse.send_git_archive(@project, params[:ref], params[:format])) - head :ok + send_git_archive @repository, ref: params[:ref], format: params[:format] rescue => ex logger.error("#{self.class.name}: #{ex}") return git_not_found! diff --git a/app/helpers/workhorse_helper.rb b/app/helpers/workhorse_helper.rb new file mode 100644 index 00000000000..9d306c9096e --- /dev/null +++ b/app/helpers/workhorse_helper.rb @@ -0,0 +1,17 @@ +# Helpers to send Git blobs or archives through Workhorse. +# Workhorse will also serve files when using `send_file`. +module WorkhorseHelper + # Send a Git blob through Workhorse + def send_git_blob(repository, blob) + headers.store(*Gitlab::Workhorse.send_git_blob(repository, blob)) + headers['Content-Disposition'] = 'inline' + headers['Content-Type'] = safe_content_type(blob) + head :ok # 'render nothing: true' messes up the Content-Type + end + + # Archive a Git repository and send it through Workhorse + def send_git_archive(repository, ref:, format:) + headers.store(*Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format)) + head :ok + end +end diff --git a/db/schema.rb b/db/schema.rb index 9b991f347a9..659ddc6df04 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,6 +12,7 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20160530150109) do + # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" enable_extension "pg_trgm" diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 2aaa0557ea3..0e47bb0b8ad 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -408,5 +408,15 @@ module API error!(errors[:access_level], 422) if errors[:access_level].any? not_found!(errors) end + + def send_git_blob(repository, blob) + env['api.format'] = :txt + content_type 'text/plain' + header *Gitlab::Workhorse.send_git_blob(repository, blob) + end + + def send_git_archive(repository, ref:, format:) + header *Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format) + end end end diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 9cb14e95ebc..f55aceed92c 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -56,8 +56,7 @@ module API blob = Gitlab::Git::Blob.find(repo, commit.id, params[:filepath]) not_found! "File" unless blob - content_type 'text/plain' - header(*Gitlab::Workhorse.send_git_blob(repo, blob)) + send_git_blob repo, blob end # Get a raw blob contents by blob sha @@ -80,10 +79,7 @@ module API not_found! 'Blob' unless blob - env['api.format'] = :txt - - content_type blob.mime_type - header(*Gitlab::Workhorse.send_git_blob(repo, blob)) + send_git_blob repo, blob end # Get a an archive of the repository @@ -98,7 +94,7 @@ module API authorize! :download_code, user_project begin - header(*Gitlab::Workhorse.send_git_archive(user_project, params[:sha], params[:format])) + send_git_archive user_project.repository, ref: params[:sha], format: params[:format] rescue not_found!('File') end diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index c3ddd4c2680..96e99dc0088 100644 --- a/lib/gitlab/workhorse.rb +++ b/lib/gitlab/workhorse.rb @@ -18,10 +18,10 @@ module Gitlab ] end - def send_git_archive(project, ref, format) + def send_git_archive(repository, ref:, format:) format ||= 'tar.gz' format.downcase! - params = project.repository.archive_metadata(ref, Gitlab.config.gitlab.repository_downloads_path, format) + params = repository.archive_metadata(ref, Gitlab.config.gitlab.repository_downloads_path, format) raise "Repository or ref not found" if params.empty? [ @@ -29,9 +29,9 @@ module Gitlab "git-archive:#{encode(params)}", ] end - + protected - + def encode(hash) Base64.urlsafe_encode64(JSON.dump(hash)) end diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb index fb29274c687..33c35161da3 100644 --- a/spec/controllers/projects/raw_controller_spec.rb +++ b/spec/controllers/projects/raw_controller_spec.rb @@ -17,6 +17,7 @@ describe Projects::RawController do expect(response.header['Content-Type']).to eq('text/plain; charset=utf-8') expect(response.header['Content-Disposition']). to eq("inline") + expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-blob:") end end @@ -31,6 +32,7 @@ describe Projects::RawController do expect(response.status).to eq(200) expect(response.header['Content-Type']).to eq('image/jpeg') + expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-blob:") end end diff --git a/spec/controllers/projects/repositories_controller_spec.rb b/spec/controllers/projects/repositories_controller_spec.rb index 0ddbec9eac2..aad62cf20e3 100644 --- a/spec/controllers/projects/repositories_controller_spec.rb +++ b/spec/controllers/projects/repositories_controller_spec.rb @@ -20,10 +20,11 @@ describe Projects::RepositoriesController do project.team << [user, :developer] sign_in(user) end - it "uses Gitlab::Workhorse" do - expect(Gitlab::Workhorse).to receive(:send_git_archive).with(project, "master", "zip") + it "uses Gitlab::Workhorse" do get :archive, namespace_id: project.namespace.path, project_id: project.path, ref: "master", format: "zip" + + expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:") end context "when the service raises an error" do diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb index d940bf05061..c5c1402e8fc 100644 --- a/spec/lib/gitlab/workhorse_spec.rb +++ b/spec/lib/gitlab/workhorse_spec.rb @@ -11,7 +11,7 @@ describe Gitlab::Workhorse, lib: true do end it "raises an error" do - expect { subject.send_git_archive(project, "master", "zip") }.to raise_error(RuntimeError) + expect { subject.send_git_archive(project.repository, ref: "master", format: "zip") }.to raise_error(RuntimeError) end end end From ae011aff63bd6b20043d8ee533f07a65db0b75ff Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 6 Jun 2016 13:35:26 +0200 Subject: [PATCH 02/87] Add changelog item --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 72fe32a01a3..4594d9d554f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -63,6 +63,7 @@ v 8.8.3 - Fix serious performance bug with rendering Markdown with InlineDiffFilter. !4392 - Fix missing number on generated ordered list element. !4437 - Prevent disclosure of notes on confidential issues in search results. + - Add workhorse controller and API helpers v 8.8.2 - Added remove due date button. !4209 From 3855e33cf8fe95d6de83b18698a958095fa49df5 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 6 Jun 2016 15:34:50 +0200 Subject: [PATCH 03/87] Move changelog item --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 4594d9d554f..03e7e5b1e56 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -38,6 +38,7 @@ v 8.9.0 (unreleased) - Improve error handling importing projects - Put project Files and Commits tabs under Code tab - Replace Colorize with Rainbow for coloring console output in Rake tasks. + - Add workhorse controller and API helpers v 8.8.4 (unreleased) - Ensure branch cleanup regardless of whether the GitHub import process succeeds @@ -63,7 +64,6 @@ v 8.8.3 - Fix serious performance bug with rendering Markdown with InlineDiffFilter. !4392 - Fix missing number on generated ordered list element. !4437 - Prevent disclosure of notes on confidential issues in search results. - - Add workhorse controller and API helpers v 8.8.2 - Added remove due date button. !4209 From 81dfabad393fbd22417e649a87820623d0284bbe Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 18 May 2016 15:28:46 -0500 Subject: [PATCH 04/87] Added when to artifacts --- CHANGELOG | 1 + lib/ci/gitlab_ci_yaml_processor.rb | 24 ++++++++++++++++++++ spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 23 +++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 0506854599f..da9f561208e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -27,6 +27,7 @@ v 8.9.0 (unreleased) - Add rake task 'gitlab:db:configure' for conditionally seeding or migrating the database - Changed the Slack build message to use the singular duration if necessary (Aran Koning) - Fix issues filter when ordering by milestone + - Added artifacts:when to .gitlab-ci.yml - this requires GitLab Runner 1.3 - Todos will display target state if issuable target is 'Closed' or 'Merged' - Fix bug when sorting issues by milestone due date and filtering by two or more labels - Add support for using Yubikeys (U2F) for two-factor authentication diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index 130f5b0892e..15d57a46eb0 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -8,6 +8,8 @@ module Ci ALLOWED_JOB_KEYS = [:tags, :script, :only, :except, :type, :image, :services, :allow_failure, :type, :stage, :when, :artifacts, :cache, :dependencies, :before_script, :after_script, :variables] + ALLOWED_CACHE_KEYS = [:key, :untracked, :paths] + ALLOWED_ARTIFACTS_KEYS = [:name, :untracked, :paths, :when] attr_reader :before_script, :after_script, :image, :services, :path, :cache @@ -135,6 +137,12 @@ module Ci end def validate_global_cache! + @cache.keys.each do |key| + unless ALLOWED_CACHE_KEYS.include? key + raise ValidationError, "#{name} cache unknown parameter #{key}" + end + end + if @cache[:key] && !validate_string(@cache[:key]) raise ValidationError, "cache:key parameter should be a string" end @@ -233,6 +241,12 @@ module Ci end def validate_job_cache!(name, job) + job[:cache].keys.each do |key| + unless ALLOWED_CACHE_KEYS.include? key + raise ValidationError, "#{name} job: cache unknown parameter #{key}" + end + end + if job[:cache][:key] && !validate_string(job[:cache][:key]) raise ValidationError, "#{name} job: cache:key parameter should be a string" end @@ -247,6 +261,12 @@ module Ci end def validate_job_artifacts!(name, job) + job[:artifacts].keys.each do |key| + unless ALLOWED_ARTIFACTS_KEYS.include? key + raise ValidationError, "#{name} job: artifacts unknown parameter #{key}" + end + end + if job[:artifacts][:name] && !validate_string(job[:artifacts][:name]) raise ValidationError, "#{name} job: artifacts:name parameter should be a string" end @@ -258,6 +278,10 @@ module Ci if job[:artifacts][:paths] && !validate_array_of_strings(job[:artifacts][:paths]) raise ValidationError, "#{name} job: artifacts:paths parameter should be an array of strings" end + + if job[:artifacts][:when] && !job[:artifacts][:when].in?(%w(on_success on_failure always)) + raise ValidationError, "#{name} job: artifacts:when parameter should be on_success, on_failure or always" + end end def validate_job_dependencies!(name, job) diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index 7375539cf17..3d3715f0ef0 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -601,6 +601,22 @@ module Ci allow_failure: false }) end + + %w(on_success on_failure always).each do |when_state| + it "returns artifacts for when #{when_state} defined" do + config = YAML.dump({ + rspec: { + script: "rspec", + artifacts: { paths: ["logs/", "binaries/"], when: when_state } + } + }) + + config_processor = GitlabCiYamlProcessor.new(config, path) + builds = config_processor.builds_for_stage_and_ref("test", "master") + expect(builds.size).to eq(1) + expect(builds.first[:options][:artifacts][:when]).to eq(when_state) + end + end end describe "Dependencies" do @@ -967,6 +983,13 @@ EOT end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: artifacts:name parameter should be a string") end + it "returns errors if job artifacts:when is not an a predefined value" do + config = YAML.dump({ types: ["build", "test"], rspec: { script: "test", artifacts: { when: 1 } } }) + expect do + GitlabCiYamlProcessor.new(config) + end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: artifacts:when parameter should be on_success, on_failure or always") + end + it "returns errors if job artifacts:untracked is not an array of strings" do config = YAML.dump({ types: ["build", "test"], rspec: { script: "test", artifacts: { untracked: "string" } } }) expect do From 98bb435f4266719b1e0fca57472a0f4e50d30371 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Thu, 9 Jun 2016 13:39:16 +0100 Subject: [PATCH 05/87] Enable RuboCop for migrations Migrations shouldn't fail RuboCop checks - especially lint checks, such as the nested method check. To avoid changing code in existing migrations, add the magic comment to the top of each of them to skip that file. --- .rubocop.yml | 3 ++- db/migrate/20121220064453_init_schema.rb | 1 + .../20130102143055_rename_owner_to_creator_for_project.rb | 1 + db/migrate/20130110172407_add_public_to_project.rb | 1 + db/migrate/20130123114545_add_issues_tracker_to_project.rb | 1 + db/migrate/20130125090214_add_user_permissions.rb | 1 + db/migrate/20130131070232_remove_private_flag_from_project.rb | 1 + db/migrate/20130206084024_add_description_to_namsespace.rb | 1 + db/migrate/20130207104426_add_description_to_teams.rb | 1 + db/migrate/20130211085435_add_issues_tracker_id_to_project.rb | 1 + ...20130214154045_rename_state_to_merge_status_in_milestone.rb | 1 + db/migrate/20130218140952_add_state_to_issue.rb | 1 + db/migrate/20130218141038_add_state_to_merge_request.rb | 1 + db/migrate/20130218141117_add_state_to_milestone.rb | 1 + db/migrate/20130218141258_convert_closed_to_state_in_issue.rb | 1 + .../20130218141327_convert_closed_to_state_in_merge_request.rb | 1 + .../20130218141344_convert_closed_to_state_in_milestone.rb | 1 + db/migrate/20130218141444_remove_merged_from_merge_request.rb | 1 + db/migrate/20130218141507_remove_closed_from_issue.rb | 1 + db/migrate/20130218141536_remove_closed_from_merge_request.rb | 1 + db/migrate/20130218141554_remove_closed_from_milestone.rb | 1 + .../20130220124204_add_new_merge_status_to_merge_request.rb | 1 + .../20130220125544_convert_merge_status_in_merge_request.rb | 1 + .../20130220125545_remove_merge_status_from_merge_request.rb | 1 + ...245_rename_new_merge_status_to_merge_status_in_milestone.rb | 1 + db/migrate/20130304104623_add_state_to_user.rb | 1 + db/migrate/20130304104740_convert_blocked_to_state.rb | 1 + db/migrate/20130304105317_remove_blocked_from_user.rb | 1 + db/migrate/20130315124931_user_color_scheme.rb | 1 + db/migrate/20130318212250_add_snippets_to_features.rb | 1 + db/migrate/20130319214458_create_forked_project_links.rb | 1 + db/migrate/20130323174317_add_private_to_snippets.rb | 1 + db/migrate/20130324151736_add_type_to_snippets.rb | 1 + .../20130324172327_change_project_id_to_null_in_snipepts.rb | 1 + db/migrate/20130324203535_add_type_value_for_snippets.rb | 1 + db/migrate/20130325173941_add_notification_level_to_user.rb | 1 + .../20130326142630_add_index_to_users_authentication_token.rb | 1 + .../20130403003950_add_last_activity_column_into_project.rb | 1 + .../20130404164628_add_notification_level_to_user_project.rb | 1 + db/migrate/20130410175022_remove_wiki_table.rb | 1 + db/migrate/20130419190306_allow_merges_for_forks.rb | 1 + db/migrate/20130506085413_add_type_to_key.rb | 1 + db/migrate/20130506090604_create_deploy_keys_projects.rb | 1 + db/migrate/20130506095501_remove_project_id_from_key.rb | 1 + db/migrate/20130522141856_add_more_fields_to_service.rb | 1 + db/migrate/20130528184641_add_system_to_notes.rb | 1 + db/migrate/20130611210815_increase_snippet_text_column_size.rb | 1 + db/migrate/20130613165816_add_password_expires_at_to_users.rb | 1 + db/migrate/20130613173246_add_created_by_id_to_user.rb | 1 + db/migrate/20130614132337_add_improted_to_project.rb | 1 + db/migrate/20130617095603_create_users_groups.rb | 1 + .../20130621195223_add_notification_level_to_user_group.rb | 1 + db/migrate/20130622115340_add_more_db_index.rb | 1 + db/migrate/20130624162710_add_fingerprint_to_key.rb | 1 + db/migrate/20130711063759_create_project_group_links.rb | 1 + db/migrate/20130804151314_add_st_diff_to_note.rb | 1 + db/migrate/20130809124851_add_permission_check_to_user.rb | 1 + db/migrate/20130812143708_add_import_url_to_project.rb | 1 + db/migrate/20130819182730_add_internal_ids_to_issues_and_mr.rb | 1 + db/migrate/20130820102832_add_access_to_project_group_link.rb | 1 + db/migrate/20130821090530_remove_deprecated_tables.rb | 1 + db/migrate/20130821090531_add_internal_ids_to_milestones.rb | 1 + db/migrate/20130909132950_add_description_to_merge_request.rb | 1 + db/migrate/20130926081215_change_owner_id_for_group.rb | 1 + db/migrate/20131005191208_add_avatar_to_users.rb | 1 + db/migrate/20131009115346_add_confirmable_to_users.rb | 1 + db/migrate/20131106151520_remove_default_branch.rb | 1 + db/migrate/20131112114325_create_broadcast_messages.rb | 1 + db/migrate/20131112220935_add_visibility_level_to_projects.rb | 1 + db/migrate/20131129154016_add_archived_to_projects.rb | 1 + .../20131130165425_add_color_and_font_to_broadcast_messages.rb | 1 + db/migrate/20131202192556_add_event_fields_for_web_hook.rb | 1 + db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb | 1 + db/migrate/20131217102743_add_recipients_to_service.rb | 1 + db/migrate/20140116231608_add_website_url_to_users.rb | 1 + db/migrate/20140122112253_create_merge_request_diffs.rb | 1 + db/migrate/20140122114406_migrate_mr_diffs.rb | 1 + db/migrate/20140122122549_remove_m_rdiff_fields.rb | 1 + db/migrate/20140125162722_add_avatar_to_projects.rb | 1 + db/migrate/20140127170938_add_group_avatars.rb | 1 + db/migrate/20140209025651_create_emails.rb | 1 + db/migrate/20140214102325_add_api_key_to_services.rb | 1 + ...005354_add_index_merge_request_diffs_on_merge_request_id.rb | 1 + .../20140305193308_add_tag_push_hooks_to_project_hook.rb | 1 + db/migrate/20140312145357_add_import_status_to_project.rb | 1 + db/migrate/20140313092127_migrate_already_imported_projects.rb | 1 + db/migrate/20140407135544_fix_namespaces.rb | 1 + ...14131055_change_state_to_allow_empty_merge_request_diffs.rb | 1 + db/migrate/20140415124820_limits_to_mysql.rb | 1 + db/migrate/20140416074002_add_index_on_iid.rb | 1 + db/migrate/20140416185734_index_on_current_sign_in_at.rb | 1 + db/migrate/20140428105831_add_notes_index_updated_at.rb | 1 + db/migrate/20140502115131_add_repo_size_to_db.rb | 1 + db/migrate/20140502125220_migrate_repo_size.rb | 1 + db/migrate/20140611135229_add_position_to_merge_request.rb | 1 + db/migrate/20140625115202_create_users_star_projects.rb | 1 + db/migrate/20140729134820_create_labels.rb | 1 + db/migrate/20140729140420_create_label_links.rb | 1 + db/migrate/20140729145339_migrate_project_tags.rb | 1 + db/migrate/20140729152420_migrate_taggable_labels.rb | 1 + db/migrate/20140730111702_add_index_to_labels.rb | 1 + db/migrate/20140903115954_migrate_to_new_shell.rb | 1 + db/migrate/20140907220153_serialize_service_properties.rb | 1 + db/migrate/20140914113604_add_members_table.rb | 1 + db/migrate/20140914145549_migrate_to_new_members_model.rb | 1 + db/migrate/20140914173417_remove_old_member_tables.rb | 1 + db/migrate/20141006143943_move_slack_service_to_webhook.rb | 1 + db/migrate/20141007100818_add_visibility_level_to_snippet.rb | 1 + db/migrate/20141118150935_add_audit_event.rb | 1 + db/migrate/20141121133009_add_timestamps_to_members.rb | 1 + db/migrate/20141121161704_add_identity_table.rb | 1 + db/migrate/20141205134006_add_locked_at_to_merge_request.rb | 1 + db/migrate/20141216155758_create_doorkeeper_tables.rb | 1 + db/migrate/20141217125223_add_owner_to_application.rb | 1 + db/migrate/20141223135007_add_import_data_to_project_table.rb | 1 + ...1226080412_add_developers_can_push_to_protected_branches.rb | 1 + db/migrate/20150108073740_create_application_settings.rb | 1 + ...0150116234544_add_home_page_url_for_application_settings.rb | 1 + db/migrate/20150116234545_add_gitlab_access_token_to_user.rb | 1 + .../20150125163100_add_default_branch_protection_setting.rb | 1 + db/migrate/20150205211843_add_timestamps_to_identities.rb | 1 + db/migrate/20150206181414_add_index_to_created_at.rb | 1 + db/migrate/20150206222854_add_notification_email_to_user.rb | 1 + db/migrate/20150209222013_add_missing_index.rb | 1 + db/migrate/20150211172122_add_template_to_service.rb | 1 + db/migrate/20150211174341_allow_null_in_services_project_id.rb | 1 + ...4043_add_twitter_sharing_enabled_to_application_settings.rb | 1 + db/migrate/20150213114800_add_hide_no_password_to_user.rb | 1 + .../20150213121042_add_password_automatically_set_to_user.rb | 1 + ...0217123345_add_bitbucket_access_token_and_secret_to_user.rb | 1 + db/migrate/20150219004514_add_events_to_services.rb | 1 + db/migrate/20150223022001_set_missing_last_activity_at.rb | 1 + db/migrate/20150225065047_add_note_events_to_services.rb | 1 + ...add_restricted_visibility_levels_to_application_settings.rb | 1 + db/migrate/20150306023106_fix_namespace_duplication.rb | 1 + db/migrate/20150306023112_add_unique_index_to_namespace.rb | 1 + ...20150310194358_add_version_check_to_application_settings.rb | 1 + db/migrate/20150313012111_create_subscriptions_table.rb | 1 + db/migrate/20150320234437_add_location_to_user.rb | 1 + db/migrate/20150324155957_set_incorrect_assignee_id_to_null.rb | 1 + db/migrate/20150327122227_add_public_to_key.rb | 1 + db/migrate/20150327150017_add_import_data_to_project.rb | 1 + db/migrate/20150327223628_add_devise_two_factor_to_users.rb | 1 + ...28132231_add_max_attachment_size_to_application_settings.rb | 1 + ...20150331183602_add_devise_two_factor_backupable_to_users.rb | 1 + db/migrate/20150406133311_add_invite_data_to_member.rb | 1 + db/migrate/20150411000035_fix_identities.rb | 1 + db/migrate/20150411180045_rename_buildbox_service.rb | 1 + db/migrate/20150413192223_add_public_email_to_users.rb | 1 + db/migrate/20150417121913_create_project_import_data.rb | 1 + db/migrate/20150417122318_remove_import_data_from_project.rb | 1 + .../20150421120000_remove_periods_at_ends_of_usernames.rb | 1 + ..._add_default_project_visibililty_to_application_settings.rb | 1 + ...hange_collation_for_tag_names.acts_as_taggable_on_engine.rb | 1 + db/migrate/20150425164647_remove_duplicate_tags.rb | 1 + ...48_add_missing_unique_indices.acts_as_taggable_on_engine.rb | 1 + ...aggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | 1 + ...50_add_missing_taggable_index.acts_as_taggable_on_engine.rb | 1 + ...hange_collation_for_tag_names.acts_as_taggable_on_engine.rb | 1 + ...425173433_add_default_snippet_visibility_to_app_settings.rb | 1 + .../20150429002313_remove_abandoned_group_members_records.rb | 1 + ...22_add_restricted_signup_domains_to_application_settings.rb | 1 + db/migrate/20150509180749_convert_legacy_reference_notes.rb | 1 + db/migrate/20150516060434_add_note_events_to_web_hooks.rb | 1 + ...1607_add_user_oauth_applications_to_application_settings.rb | 1 + ...9150354_add_after_sign_out_path_for_application_settings.rb | 1 + ...141121_add_session_expire_delay_for_application_settings.rb | 1 + db/migrate/20150610065936_add_dashboard_to_users.rb | 1 + .../20150620233230_add_default_otp_required_for_login_value.rb | 1 + db/migrate/20150713160110_add_project_view_to_users.rb | 1 + db/migrate/20150717130904_add_commits_count_to_project.rb | 1 + .../20150730122406_add_updated_by_to_issuables_and_notes.rb | 1 + db/migrate/20150806104937_create_abuse_reports.rb | 1 + db/migrate/20150812080800_add_settings_import_sources.rb | 1 + db/migrate/20150814065925_remove_oauth_tokens_from_users.rb | 1 + db/migrate/20150817163600_deduplicate_user_identities.rb | 1 + db/migrate/20150818213832_add_sent_notifications.rb | 1 + db/migrate/20150824002011_add_enable_ssl_verification.rb | 1 + db/migrate/20150826001931_add_ci_tables.rb | 1 + db/migrate/20150902001023_add_template_to_label.rb | 1 + db/migrate/20150914215247_add_ci_tags.rb | 1 + .../20150915001905_enable_ssl_verification_by_default.rb | 1 + .../20150916000405_enable_ssl_verification_for_web_hooks.rb | 1 + ...0150916114643_add_help_page_text_to_application_settings.rb | 1 + db/migrate/20150916145038_add_index_for_committed_at_and_id.rb | 1 + .../20150918084513_add_ci_enabled_to_application_settings.rb | 1 + ...0918161719_remove_invalid_milestones_from_merge_requests.rb | 1 + db/migrate/20150920010715_add_consumed_timestep_to_users.rb | 1 + .../20150920161119_add_line_code_to_sent_notification.rb | 1 + db/migrate/20150924125150_add_project_id_to_ci_commit.rb | 1 + db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb | 1 + db/migrate/20150930001110_merge_request_error_field.rb | 1 + db/migrate/20150930095736_add_null_to_name_for_ci_projects.rb | 1 + db/migrate/20150930110012_add_group_share_lock.rb | 1 + db/migrate/20151002112914_add_stage_idx_to_builds.rb | 1 + db/migrate/20151002121400_add_index_for_builds.rb | 1 + db/migrate/20151002122929_add_ref_and_tag_to_builds.rb | 1 + db/migrate/20151002122943_migrate_ref_and_tag_to_build.rb | 1 + db/migrate/20151005075649_add_user_id_to_build.rb | 1 + db/migrate/20151005150751_add_layout_option_for_users.rb | 1 + ...151005162154_remove_ci_enabled_from_application_settings.rb | 1 + .../20151007120511_namespaces_projects_path_lower_indexes.rb | 1 + .../20151008110232_add_users_lower_username_email_indexes.rb | 1 + .../20151008123042_add_type_and_description_to_builds.rb | 1 + .../20151008130321_migrate_name_to_description_for_builds.rb | 1 + .../20151008143519_add_admin_notification_email_setting.rb | 1 + db/migrate/20151012173029_set_jira_service_api_url.rb | 1 + db/migrate/20151013092124_add_artifacts_file_to_builds.rb | 1 + .../20151016131433_add_ci_projects_gl_project_id_index.rb | 1 + .../20151016195451_add_ci_builds_and_projects_indexes.rb | 1 + db/migrate/20151016195706_add_notes_line_code_index.rb | 1 + db/migrate/20151019111551_fix_build_tags.rb | 1 + db/migrate/20151019111703_fail_build_without_names.rb | 1 + db/migrate/20151020145526_add_services_template_index.rb | 1 + db/migrate/20151020173516_ci_limits_to_mysql.rb | 1 + db/migrate/20151020173906_add_ci_builds_index_for_status.rb | 1 + db/migrate/20151023112551_fail_build_with_empty_name.rb | 1 + db/migrate/20151023144219_remove_satellites.rb | 1 + db/migrate/20151026182941_add_project_path_index.rb | 1 + ...028152939_add_merge_when_build_succeeds_to_merge_request.rb | 1 + db/migrate/20151103001141_add_public_to_group.rb | 1 + db/migrate/20151103133339_add_shared_runners_setting.rb | 1 + db/migrate/20151103134857_create_lfs_objects.rb | 1 + db/migrate/20151103134958_create_lfs_objects_projects.rb | 1 + db/migrate/20151104105513_add_file_to_lfs_objects.rb | 1 + db/migrate/20151105094515_create_releases.rb | 1 + db/migrate/20151106000015_add_is_award_to_notes.rb | 1 + ...109100728_add_max_artifacts_size_to_application_settings.rb | 1 + db/migrate/20151109134526_add_issues_state_index.rb | 1 + .../20151109134916_add_projects_visibility_level_index.rb | 1 + db/migrate/20151110125604_add_import_error_to_project.rb | 1 + db/migrate/20151114113410_add_index_for_lfs_oid_and_size.rb | 1 + db/migrate/20151116144118_add_unique_for_lfs_oid_index.rb | 1 + db/migrate/20151118162244_add_projects_public_index.rb | 1 + db/migrate/20151201203948_raise_hook_url_limit.rb | 1 + db/migrate/20151203162133_add_hide_project_limit_to_users.rb | 1 + db/migrate/20151203162134_add_build_events_to_services.rb | 1 + db/migrate/20151209144329_migrate_ci_web_hooks.rb | 1 + db/migrate/20151209145909_migrate_ci_emails.rb | 1 + db/migrate/20151210030143_add_unlock_token_to_user.rb | 1 + ...3_add_runners_registration_token_to_application_settings.rb | 1 + db/migrate/20151210125232_migrate_ci_slack_service.rb | 1 + db/migrate/20151210125927_migrate_ci_hip_chat_service.rb | 1 + db/migrate/20151210125928_add_ci_to_project.rb | 1 + db/migrate/20151210125929_add_project_id_to_ci.rb | 1 + db/migrate/20151210125930_migrate_ci_to_project.rb | 1 + db/migrate/20151210125931_add_index_to_ci_tables.rb | 1 + db/migrate/20151210125932_drop_null_for_ci_tables.rb | 1 + db/migrate/20151218154042_add_tfa_to_application_settings.rb | 1 + db/migrate/20151221234414_add_tfa_additional_fields.rb | 1 + db/migrate/20151224123230_rename_emojis.rb | 1 + db/migrate/20151228111122_remove_public_from_namespace.rb | 1 + db/migrate/20151228150906_influxdb_settings.rb | 1 + .../20151228175719_add_recaptcha_to_application_settings.rb | 1 + db/migrate/20151229102248_influxdb_udp_port_setting.rb | 1 + db/migrate/20151229112614_influxdb_remote_database_setting.rb | 1 + .../20151230132518_add_artifacts_metadata_to_ci_build.rb | 1 + .../20151231152326_add_akismet_to_application_settings.rb | 1 + ...20151231202530_remove_alert_type_from_broadcast_messages.rb | 1 + db/migrate/20160106162223_add_index_milestones_title.rb | 1 + db/migrate/20160106164438_remove_influxdb_credentials.rb | 1 + db/migrate/20160109054846_create_spam_logs.rb | 1 + db/migrate/20160113111034_add_metrics_sample_interval.rb | 1 + .../20160118155830_add_sentry_to_application_settings.rb | 1 + ...8232755_add_ip_blocking_settings_to_application_settings.rb | 1 + db/migrate/20160119111158_add_services_category.rb | 1 + db/migrate/20160119112418_add_services_default.rb | 1 + db/migrate/20160119145451_add_ldap_email_to_users.rb | 1 + ...0160120172143_add_base_commit_sha_to_merge_request_diffs.rb | 1 + ...1030729_add_email_author_in_body_to_application_settings.rb | 1 + db/migrate/20160122185421_add_pending_delete_to_project.rb | 1 + ...47_remove_ip_blocking_settings_from_application_settings.rb | 1 + db/migrate/20160128233227_change_lfs_objects_size_column.rb | 1 + .../20160129135155_remove_dot_atom_path_ending_of_projects.rb | 1 + .../20160129155512_add_merge_commit_sha_to_merge_requests.rb | 1 + db/migrate/20160202091601_add_erasable_to_ci_build.rb | 1 + .../20160202164642_add_allow_guest_to_access_builds_project.rb | 1 + .../20160204144558_add_real_size_to_merge_request_diffs.rb | 1 + db/migrate/20160209130428_add_index_to_snippet.rb | 1 + db/migrate/20160212123307_create_tasks.rb | 1 + db/migrate/20160217100506_add_description_to_label.rb | 1 + db/migrate/20160217174422_add_note_to_tasks.rb | 1 + db/migrate/20160220123949_rename_tasks_to_todos.rb | 1 + db/migrate/20160222153918_create_appearances_ce.rb | 1 + db/migrate/20160223192159_add_confidential_to_issues.rb | 1 + db/migrate/20160225090018_add_delete_at_to_issues.rb | 1 + db/migrate/20160225101956_add_delete_at_to_merge_requests.rb | 1 + db/migrate/20160226114608_add_trigram_indexes_for_searching.rb | 1 + db/migrate/20160227120001_add_event_field_for_web_hook.rb | 1 + db/migrate/20160227120047_add_event_to_services.rb | 1 + db/migrate/20160229193553_add_main_language_to_repository.rb | 1 + db/migrate/20160301124843_add_visibility_level_to_groups.rb | 1 + ...0302151724_add_import_credentials_to_project_import_data.rb | 1 + .../20160302152808_remove_wrong_import_url_from_projects.rb | 1 + db/migrate/20160305220806_remove_expires_at_from_snippets.rb | 1 + db/migrate/20160307221555_disallow_blank_line_code_on_note.rb | 1 + ...903_add_default_group_visibility_to_application_settings.rb | 1 + db/migrate/20160309140734_fix_todos.rb | 1 + db/migrate/20160310124959_add_due_date_to_issues.rb | 1 + db/migrate/20160310185910_add_external_flag_to_users.rb | 1 + db/migrate/20160314094147_add_priority_to_label.rb | 1 + db/migrate/20160314143402_projects_add_pushes_since_gc.rb | 1 + db/migrate/20160315135439_project_add_repository_check.rb | 1 + db/migrate/20160316123110_ci_runners_token_index.rb | 1 + db/migrate/20160316192622_change_target_id_to_null_on_todos.rb | 1 + db/migrate/20160316204731_add_commit_id_to_todos.rb | 1 + db/migrate/20160317092222_add_moved_to_to_issue.rb | 1 + .../20160320204112_index_namespaces_on_visibility_level.rb | 1 + db/migrate/20160324020319_remove_todos_for_deleted_issues.rb | 1 + db/migrate/20160328112808_create_notification_settings.rb | 1 + db/migrate/20160328115649_migrate_new_notification_setting.rb | 1 + db/migrate/20160328121138_add_notification_setting_index.rb | 1 + .../20160329144452_add_index_on_pending_delete_projects.rb | 1 + .../20160331133914_remove_todos_for_deleted_merge_requests.rb | 1 + ...remove_twitter_sharing_enabled_from_application_settings.rb | 1 + db/migrate/20160407120251_add_images_enabled_for_project.rb | 1 + .../20160412140240_add_repository_checks_enabled_setting.rb | 1 + db/migrate/20160412173416_add_fields_to_ci_commit.rb | 1 + db/migrate/20160412173417_update_ci_commit.rb | 1 + db/migrate/20160412173418_add_ci_commit_indexes.rb | 1 + db/migrate/20160413115152_add_token_to_web_hooks.rb | 1 + ...15133440_add_shared_runners_text_to_application_settings.rb | 1 + db/migrate/20160416180807_add_award_emoji.rb | 1 + db/migrate/20160416182152_convert_award_note_to_emoji_award.rb | 1 + db/migrate/20160416190505_remove_note_is_award.rb | 1 + db/migrate/20160419120017_add_metrics_packet_size.rb | 1 + db/migrate/20160421130527_disable_repository_checks.rb | 1 + db/migrate/20160425045124_create_u2f_registrations.rb | 1 + ...d_disabled_oauth_sign_in_sources_to_application_settings.rb | 1 + db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb | 1 + db/migrate/20160508194200_remove_wall_enabled_from_projects.rb | 1 + db/migrate/20160508215820_add_type_to_notes.rb | 1 + db/migrate/20160508221410_set_type_on_legacy_diff_notes.rb | 1 + ...28_add_health_check_access_token_to_application_settings.rb | 1 + ...add_send_user_confirmation_email_to_application_settings.rb | 1 + .../20160525205328_remove_main_language_from_projects.rb | 1 + ...020117_remove_notification_settings_for_deleted_projects.rb | 1 + db/migrate/20160528043124_add_users_state_index.rb | 1 + ...iner_registry_token_expire_delay_to_application_settings.rb | 1 + .../20160603180330_remove_duplicated_notification_settings.rb | 1 + .../20160603182247_add_index_to_notification_settings.rb | 1 + ...608155312_add_after_sign_up_text_to_application_settings.rb | 1 + db/migrate/limits_to_mysql.rb | 1 + 343 files changed, 344 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 678f7db025b..c637f5e12f5 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -13,7 +13,8 @@ AllCops: # Exclude some GitLab files Exclude: - 'vendor/**/*' - - 'db/**/*' + - 'db/*' + - 'db/fixtures/**/*' - 'tmp/**/*' - 'bin/**/*' - 'lib/backup/**/*' diff --git a/db/migrate/20121220064453_init_schema.rb b/db/migrate/20121220064453_init_schema.rb index d7644b6847a..f93dc92b70f 100644 --- a/db/migrate/20121220064453_init_schema.rb +++ b/db/migrate/20121220064453_init_schema.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class InitSchema < ActiveRecord::Migration def up diff --git a/db/migrate/20130102143055_rename_owner_to_creator_for_project.rb b/db/migrate/20130102143055_rename_owner_to_creator_for_project.rb index d0fca269871..84fd2060770 100644 --- a/db/migrate/20130102143055_rename_owner_to_creator_for_project.rb +++ b/db/migrate/20130102143055_rename_owner_to_creator_for_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RenameOwnerToCreatorForProject < ActiveRecord::Migration def change rename_column :projects, :owner_id, :creator_id diff --git a/db/migrate/20130110172407_add_public_to_project.rb b/db/migrate/20130110172407_add_public_to_project.rb index 45edba48152..4362aadcc1d 100644 --- a/db/migrate/20130110172407_add_public_to_project.rb +++ b/db/migrate/20130110172407_add_public_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPublicToProject < ActiveRecord::Migration def change add_column :projects, :public, :boolean, default: false, null: false diff --git a/db/migrate/20130123114545_add_issues_tracker_to_project.rb b/db/migrate/20130123114545_add_issues_tracker_to_project.rb index 288d0f07c9a..ba8c50b53e2 100644 --- a/db/migrate/20130123114545_add_issues_tracker_to_project.rb +++ b/db/migrate/20130123114545_add_issues_tracker_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIssuesTrackerToProject < ActiveRecord::Migration def change add_column :projects, :issues_tracker, :string, default: :gitlab, null: false diff --git a/db/migrate/20130125090214_add_user_permissions.rb b/db/migrate/20130125090214_add_user_permissions.rb index 38b5f439a2d..1350eadb60e 100644 --- a/db/migrate/20130125090214_add_user_permissions.rb +++ b/db/migrate/20130125090214_add_user_permissions.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddUserPermissions < ActiveRecord::Migration def up add_column :users, :can_create_group, :boolean, default: true, null: false diff --git a/db/migrate/20130131070232_remove_private_flag_from_project.rb b/db/migrate/20130131070232_remove_private_flag_from_project.rb index 5754db11558..f0273ba448e 100644 --- a/db/migrate/20130131070232_remove_private_flag_from_project.rb +++ b/db/migrate/20130131070232_remove_private_flag_from_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemovePrivateFlagFromProject < ActiveRecord::Migration def up remove_column :projects, :private_flag diff --git a/db/migrate/20130206084024_add_description_to_namsespace.rb b/db/migrate/20130206084024_add_description_to_namsespace.rb index ef02e489d03..62676ce8914 100644 --- a/db/migrate/20130206084024_add_description_to_namsespace.rb +++ b/db/migrate/20130206084024_add_description_to_namsespace.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDescriptionToNamsespace < ActiveRecord::Migration def change add_column :namespaces, :description, :string, default: '', null: false diff --git a/db/migrate/20130207104426_add_description_to_teams.rb b/db/migrate/20130207104426_add_description_to_teams.rb index 6d03777901c..bd9a4767b69 100644 --- a/db/migrate/20130207104426_add_description_to_teams.rb +++ b/db/migrate/20130207104426_add_description_to_teams.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDescriptionToTeams < ActiveRecord::Migration def change add_column :user_teams, :description, :string, default: '', null: false diff --git a/db/migrate/20130211085435_add_issues_tracker_id_to_project.rb b/db/migrate/20130211085435_add_issues_tracker_id_to_project.rb index 71763d18aee..56b01cbf892 100644 --- a/db/migrate/20130211085435_add_issues_tracker_id_to_project.rb +++ b/db/migrate/20130211085435_add_issues_tracker_id_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIssuesTrackerIdToProject < ActiveRecord::Migration def change add_column :projects, :issues_tracker_id, :string diff --git a/db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb b/db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb index 23797fe1894..4722cc13d4b 100644 --- a/db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb +++ b/db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RenameStateToMergeStatusInMilestone < ActiveRecord::Migration def change rename_column :merge_requests, :state, :merge_status diff --git a/db/migrate/20130218140952_add_state_to_issue.rb b/db/migrate/20130218140952_add_state_to_issue.rb index 062103d0e33..3a5e978a182 100644 --- a/db/migrate/20130218140952_add_state_to_issue.rb +++ b/db/migrate/20130218140952_add_state_to_issue.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddStateToIssue < ActiveRecord::Migration def change add_column :issues, :state, :string diff --git a/db/migrate/20130218141038_add_state_to_merge_request.rb b/db/migrate/20130218141038_add_state_to_merge_request.rb index ac4108ee311..e0180c755e2 100644 --- a/db/migrate/20130218141038_add_state_to_merge_request.rb +++ b/db/migrate/20130218141038_add_state_to_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddStateToMergeRequest < ActiveRecord::Migration def change add_column :merge_requests, :state, :string diff --git a/db/migrate/20130218141117_add_state_to_milestone.rb b/db/migrate/20130218141117_add_state_to_milestone.rb index c84039106bd..5f71608692c 100644 --- a/db/migrate/20130218141117_add_state_to_milestone.rb +++ b/db/migrate/20130218141117_add_state_to_milestone.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddStateToMilestone < ActiveRecord::Migration def change add_column :milestones, :state, :string diff --git a/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb b/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb index 99289166e81..94c0a6845d5 100644 --- a/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb +++ b/db/migrate/20130218141258_convert_closed_to_state_in_issue.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ConvertClosedToStateInIssue < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb b/db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb index bd1e016d679..64a9c761352 100644 --- a/db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb +++ b/db/migrate/20130218141327_convert_closed_to_state_in_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ConvertClosedToStateInMergeRequest < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb b/db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb index d1174bc3d98..41508c2dc95 100644 --- a/db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb +++ b/db/migrate/20130218141344_convert_closed_to_state_in_milestone.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ConvertClosedToStateInMilestone < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20130218141444_remove_merged_from_merge_request.rb b/db/migrate/20130218141444_remove_merged_from_merge_request.rb index a7bd82f5000..afa5137061e 100644 --- a/db/migrate/20130218141444_remove_merged_from_merge_request.rb +++ b/db/migrate/20130218141444_remove_merged_from_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveMergedFromMergeRequest < ActiveRecord::Migration def up remove_column :merge_requests, :merged diff --git a/db/migrate/20130218141507_remove_closed_from_issue.rb b/db/migrate/20130218141507_remove_closed_from_issue.rb index 95cc064252b..f250288bc3b 100644 --- a/db/migrate/20130218141507_remove_closed_from_issue.rb +++ b/db/migrate/20130218141507_remove_closed_from_issue.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveClosedFromIssue < ActiveRecord::Migration def up remove_column :issues, :closed diff --git a/db/migrate/20130218141536_remove_closed_from_merge_request.rb b/db/migrate/20130218141536_remove_closed_from_merge_request.rb index 371835938b2..efa12e32636 100644 --- a/db/migrate/20130218141536_remove_closed_from_merge_request.rb +++ b/db/migrate/20130218141536_remove_closed_from_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveClosedFromMergeRequest < ActiveRecord::Migration def up remove_column :merge_requests, :closed diff --git a/db/migrate/20130218141554_remove_closed_from_milestone.rb b/db/migrate/20130218141554_remove_closed_from_milestone.rb index e8dae4a19b1..75ac14e43be 100644 --- a/db/migrate/20130218141554_remove_closed_from_milestone.rb +++ b/db/migrate/20130218141554_remove_closed_from_milestone.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveClosedFromMilestone < ActiveRecord::Migration def up remove_column :milestones, :closed diff --git a/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb b/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb index d78bd0ae923..97615e47c89 100644 --- a/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb +++ b/db/migrate/20130220124204_add_new_merge_status_to_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNewMergeStatusToMergeRequest < ActiveRecord::Migration def change add_column :merge_requests, :new_merge_status, :string diff --git a/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb b/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb index 1c758c56ffe..3b8c3686c55 100644 --- a/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb +++ b/db/migrate/20130220125544_convert_merge_status_in_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ConvertMergeStatusInMergeRequest < ActiveRecord::Migration def up execute "UPDATE #{table_name} SET new_merge_status = 'unchecked' WHERE merge_status = 1" diff --git a/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb b/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb index 9083183beb0..bd25ffbfc99 100644 --- a/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb +++ b/db/migrate/20130220125545_remove_merge_status_from_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveMergeStatusFromMergeRequest < ActiveRecord::Migration def up remove_column :merge_requests, :merge_status diff --git a/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb b/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb index 3f8f38dc979..f0595720a39 100644 --- a/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb +++ b/db/migrate/20130220133245_rename_new_merge_status_to_merge_status_in_milestone.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RenameNewMergeStatusToMergeStatusInMilestone < ActiveRecord::Migration def change rename_column :merge_requests, :new_merge_status, :merge_status diff --git a/db/migrate/20130304104623_add_state_to_user.rb b/db/migrate/20130304104623_add_state_to_user.rb index 8154c21065f..4456d022e3f 100644 --- a/db/migrate/20130304104623_add_state_to_user.rb +++ b/db/migrate/20130304104623_add_state_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddStateToUser < ActiveRecord::Migration def change add_column :users, :state, :string diff --git a/db/migrate/20130304104740_convert_blocked_to_state.rb b/db/migrate/20130304104740_convert_blocked_to_state.rb index e8d5257ac96..9afd1093645 100644 --- a/db/migrate/20130304104740_convert_blocked_to_state.rb +++ b/db/migrate/20130304104740_convert_blocked_to_state.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ConvertBlockedToState < ActiveRecord::Migration def up User.transaction do diff --git a/db/migrate/20130304105317_remove_blocked_from_user.rb b/db/migrate/20130304105317_remove_blocked_from_user.rb index e010474538c..8f5b2c59b43 100644 --- a/db/migrate/20130304105317_remove_blocked_from_user.rb +++ b/db/migrate/20130304105317_remove_blocked_from_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveBlockedFromUser < ActiveRecord::Migration def up remove_column :users, :blocked diff --git a/db/migrate/20130315124931_user_color_scheme.rb b/db/migrate/20130315124931_user_color_scheme.rb index 56c9a31ee3c..06e28a49d9d 100644 --- a/db/migrate/20130315124931_user_color_scheme.rb +++ b/db/migrate/20130315124931_user_color_scheme.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class UserColorScheme < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20130318212250_add_snippets_to_features.rb b/db/migrate/20130318212250_add_snippets_to_features.rb index ad0b4434c43..9860b85f504 100644 --- a/db/migrate/20130318212250_add_snippets_to_features.rb +++ b/db/migrate/20130318212250_add_snippets_to_features.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddSnippetsToFeatures < ActiveRecord::Migration def change add_column :projects, :snippets_enabled, :boolean, null: false, default: true diff --git a/db/migrate/20130319214458_create_forked_project_links.rb b/db/migrate/20130319214458_create_forked_project_links.rb index f91afc26e77..66eb11a4b2b 100644 --- a/db/migrate/20130319214458_create_forked_project_links.rb +++ b/db/migrate/20130319214458_create_forked_project_links.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateForkedProjectLinks < ActiveRecord::Migration def change create_table :forked_project_links do |t| diff --git a/db/migrate/20130323174317_add_private_to_snippets.rb b/db/migrate/20130323174317_add_private_to_snippets.rb index 92f3a5c7011..376f4618d41 100644 --- a/db/migrate/20130323174317_add_private_to_snippets.rb +++ b/db/migrate/20130323174317_add_private_to_snippets.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPrivateToSnippets < ActiveRecord::Migration def change add_column :snippets, :private, :boolean, null: false, default: true diff --git a/db/migrate/20130324151736_add_type_to_snippets.rb b/db/migrate/20130324151736_add_type_to_snippets.rb index 276aab2ca15..097cb9bc7cb 100644 --- a/db/migrate/20130324151736_add_type_to_snippets.rb +++ b/db/migrate/20130324151736_add_type_to_snippets.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTypeToSnippets < ActiveRecord::Migration def change add_column :snippets, :type, :string diff --git a/db/migrate/20130324172327_change_project_id_to_null_in_snipepts.rb b/db/migrate/20130324172327_change_project_id_to_null_in_snipepts.rb index 4c992bac4d1..9256e62086e 100644 --- a/db/migrate/20130324172327_change_project_id_to_null_in_snipepts.rb +++ b/db/migrate/20130324172327_change_project_id_to_null_in_snipepts.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ChangeProjectIdToNullInSnipepts < ActiveRecord::Migration def up change_column :snippets, :project_id, :integer, :null => true diff --git a/db/migrate/20130324203535_add_type_value_for_snippets.rb b/db/migrate/20130324203535_add_type_value_for_snippets.rb index 8c05dd2cc71..6e910fd74c7 100644 --- a/db/migrate/20130324203535_add_type_value_for_snippets.rb +++ b/db/migrate/20130324203535_add_type_value_for_snippets.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTypeValueForSnippets < ActiveRecord::Migration def up Snippet.where("project_id IS NOT NULL").update_all(type: 'ProjectSnippet') diff --git a/db/migrate/20130325173941_add_notification_level_to_user.rb b/db/migrate/20130325173941_add_notification_level_to_user.rb index 9f466e38c13..1dc58d4bcc8 100644 --- a/db/migrate/20130325173941_add_notification_level_to_user.rb +++ b/db/migrate/20130325173941_add_notification_level_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNotificationLevelToUser < ActiveRecord::Migration def change add_column :users, :notification_level, :integer, null: false, default: 1 diff --git a/db/migrate/20130326142630_add_index_to_users_authentication_token.rb b/db/migrate/20130326142630_add_index_to_users_authentication_token.rb index d42ef113738..0592181927e 100644 --- a/db/migrate/20130326142630_add_index_to_users_authentication_token.rb +++ b/db/migrate/20130326142630_add_index_to_users_authentication_token.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexToUsersAuthenticationToken < ActiveRecord::Migration def change add_index :users, :authentication_token, unique: true diff --git a/db/migrate/20130403003950_add_last_activity_column_into_project.rb b/db/migrate/20130403003950_add_last_activity_column_into_project.rb index 85e31608d79..04a01612c6f 100644 --- a/db/migrate/20130403003950_add_last_activity_column_into_project.rb +++ b/db/migrate/20130403003950_add_last_activity_column_into_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddLastActivityColumnIntoProject < ActiveRecord::Migration def up add_column :projects, :last_activity_at, :datetime diff --git a/db/migrate/20130404164628_add_notification_level_to_user_project.rb b/db/migrate/20130404164628_add_notification_level_to_user_project.rb index 27de5d6bf55..1e072d9c6e1 100644 --- a/db/migrate/20130404164628_add_notification_level_to_user_project.rb +++ b/db/migrate/20130404164628_add_notification_level_to_user_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNotificationLevelToUserProject < ActiveRecord::Migration def change add_column :users_projects, :notification_level, :integer, null: false, default: 3 diff --git a/db/migrate/20130410175022_remove_wiki_table.rb b/db/migrate/20130410175022_remove_wiki_table.rb index 9077aa2473c..5885b1cc375 100644 --- a/db/migrate/20130410175022_remove_wiki_table.rb +++ b/db/migrate/20130410175022_remove_wiki_table.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveWikiTable < ActiveRecord::Migration def up drop_table :wikis diff --git a/db/migrate/20130419190306_allow_merges_for_forks.rb b/db/migrate/20130419190306_allow_merges_for_forks.rb index 56ea97e8561..ec953986c6a 100644 --- a/db/migrate/20130419190306_allow_merges_for_forks.rb +++ b/db/migrate/20130419190306_allow_merges_for_forks.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AllowMergesForForks < ActiveRecord::Migration def self.up add_column :merge_requests, :target_project_id, :integer, :null => true diff --git a/db/migrate/20130506085413_add_type_to_key.rb b/db/migrate/20130506085413_add_type_to_key.rb index 315e7ca77b3..c9f1ee4e389 100644 --- a/db/migrate/20130506085413_add_type_to_key.rb +++ b/db/migrate/20130506085413_add_type_to_key.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTypeToKey < ActiveRecord::Migration def change add_column :keys, :type, :string diff --git a/db/migrate/20130506090604_create_deploy_keys_projects.rb b/db/migrate/20130506090604_create_deploy_keys_projects.rb index 0dc8cdeb07d..7d6662d358a 100644 --- a/db/migrate/20130506090604_create_deploy_keys_projects.rb +++ b/db/migrate/20130506090604_create_deploy_keys_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateDeployKeysProjects < ActiveRecord::Migration def change create_table :deploy_keys_projects do |t| diff --git a/db/migrate/20130506095501_remove_project_id_from_key.rb b/db/migrate/20130506095501_remove_project_id_from_key.rb index 6b794cfb5c1..53abc4e7b52 100644 --- a/db/migrate/20130506095501_remove_project_id_from_key.rb +++ b/db/migrate/20130506095501_remove_project_id_from_key.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveProjectIdFromKey < ActiveRecord::Migration def up puts 'Migrate deploy keys: ' diff --git a/db/migrate/20130522141856_add_more_fields_to_service.rb b/db/migrate/20130522141856_add_more_fields_to_service.rb index 298e902df2f..9f764a1d050 100644 --- a/db/migrate/20130522141856_add_more_fields_to_service.rb +++ b/db/migrate/20130522141856_add_more_fields_to_service.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMoreFieldsToService < ActiveRecord::Migration def change add_column :services, :subdomain, :string diff --git a/db/migrate/20130528184641_add_system_to_notes.rb b/db/migrate/20130528184641_add_system_to_notes.rb index 1b22a4934f9..27fbf8983ac 100644 --- a/db/migrate/20130528184641_add_system_to_notes.rb +++ b/db/migrate/20130528184641_add_system_to_notes.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddSystemToNotes < ActiveRecord::Migration class Note < ActiveRecord::Base end diff --git a/db/migrate/20130611210815_increase_snippet_text_column_size.rb b/db/migrate/20130611210815_increase_snippet_text_column_size.rb index f7b4447e43e..f710c79a9a5 100644 --- a/db/migrate/20130611210815_increase_snippet_text_column_size.rb +++ b/db/migrate/20130611210815_increase_snippet_text_column_size.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class IncreaseSnippetTextColumnSize < ActiveRecord::Migration def up # MYSQL LARGETEXT for snippet diff --git a/db/migrate/20130613165816_add_password_expires_at_to_users.rb b/db/migrate/20130613165816_add_password_expires_at_to_users.rb index 3479c8e64d0..47306a370a8 100644 --- a/db/migrate/20130613165816_add_password_expires_at_to_users.rb +++ b/db/migrate/20130613165816_add_password_expires_at_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPasswordExpiresAtToUsers < ActiveRecord::Migration def change add_column :users, :password_expires_at, :datetime diff --git a/db/migrate/20130613173246_add_created_by_id_to_user.rb b/db/migrate/20130613173246_add_created_by_id_to_user.rb index 615e96eb156..3138c0f40a7 100644 --- a/db/migrate/20130613173246_add_created_by_id_to_user.rb +++ b/db/migrate/20130613173246_add_created_by_id_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCreatedByIdToUser < ActiveRecord::Migration def change add_column :users, :created_by_id, :integer diff --git a/db/migrate/20130614132337_add_improted_to_project.rb b/db/migrate/20130614132337_add_improted_to_project.rb index cc882c3f10a..26dc16e3b43 100644 --- a/db/migrate/20130614132337_add_improted_to_project.rb +++ b/db/migrate/20130614132337_add_improted_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddImprotedToProject < ActiveRecord::Migration def change add_column :projects, :imported, :boolean, default: false, null: false diff --git a/db/migrate/20130617095603_create_users_groups.rb b/db/migrate/20130617095603_create_users_groups.rb index 2efc04f1151..45cff93fe4a 100644 --- a/db/migrate/20130617095603_create_users_groups.rb +++ b/db/migrate/20130617095603_create_users_groups.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateUsersGroups < ActiveRecord::Migration def change create_table :users_groups do |t| diff --git a/db/migrate/20130621195223_add_notification_level_to_user_group.rb b/db/migrate/20130621195223_add_notification_level_to_user_group.rb index 8c2e3dfcaca..6fd4941f615 100644 --- a/db/migrate/20130621195223_add_notification_level_to_user_group.rb +++ b/db/migrate/20130621195223_add_notification_level_to_user_group.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNotificationLevelToUserGroup < ActiveRecord::Migration def change add_column :users_groups, :notification_level, :integer, null: false, default: 3 diff --git a/db/migrate/20130622115340_add_more_db_index.rb b/db/migrate/20130622115340_add_more_db_index.rb index 9570a7a3f1e..4113217de59 100644 --- a/db/migrate/20130622115340_add_more_db_index.rb +++ b/db/migrate/20130622115340_add_more_db_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMoreDbIndex < ActiveRecord::Migration def change add_index :deploy_keys_projects, :project_id diff --git a/db/migrate/20130624162710_add_fingerprint_to_key.rb b/db/migrate/20130624162710_add_fingerprint_to_key.rb index 544a8366727..3e574ea81b9 100644 --- a/db/migrate/20130624162710_add_fingerprint_to_key.rb +++ b/db/migrate/20130624162710_add_fingerprint_to_key.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddFingerprintToKey < ActiveRecord::Migration def change add_column :keys, :fingerprint, :string diff --git a/db/migrate/20130711063759_create_project_group_links.rb b/db/migrate/20130711063759_create_project_group_links.rb index 395083f2a03..bd9d40a50db 100644 --- a/db/migrate/20130711063759_create_project_group_links.rb +++ b/db/migrate/20130711063759_create_project_group_links.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateProjectGroupLinks < ActiveRecord::Migration def change create_table :project_group_links do |t| diff --git a/db/migrate/20130804151314_add_st_diff_to_note.rb b/db/migrate/20130804151314_add_st_diff_to_note.rb index 3f9abb975c3..9e2da73b695 100644 --- a/db/migrate/20130804151314_add_st_diff_to_note.rb +++ b/db/migrate/20130804151314_add_st_diff_to_note.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddStDiffToNote < ActiveRecord::Migration def change add_column :notes, :st_diff, :text, :null => true diff --git a/db/migrate/20130809124851_add_permission_check_to_user.rb b/db/migrate/20130809124851_add_permission_check_to_user.rb index c26157904c7..9f9dea36101 100644 --- a/db/migrate/20130809124851_add_permission_check_to_user.rb +++ b/db/migrate/20130809124851_add_permission_check_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPermissionCheckToUser < ActiveRecord::Migration def change add_column :users, :last_credential_check_at, :datetime diff --git a/db/migrate/20130812143708_add_import_url_to_project.rb b/db/migrate/20130812143708_add_import_url_to_project.rb index 023a48741b2..d2bdfe1894e 100644 --- a/db/migrate/20130812143708_add_import_url_to_project.rb +++ b/db/migrate/20130812143708_add_import_url_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddImportUrlToProject < ActiveRecord::Migration def change add_column :projects, :import_url, :string diff --git a/db/migrate/20130819182730_add_internal_ids_to_issues_and_mr.rb b/db/migrate/20130819182730_add_internal_ids_to_issues_and_mr.rb index e55ae38f144..0e0e78b0f0d 100644 --- a/db/migrate/20130819182730_add_internal_ids_to_issues_and_mr.rb +++ b/db/migrate/20130819182730_add_internal_ids_to_issues_and_mr.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddInternalIdsToIssuesAndMr < ActiveRecord::Migration def change add_column :issues, :iid, :integer diff --git a/db/migrate/20130820102832_add_access_to_project_group_link.rb b/db/migrate/20130820102832_add_access_to_project_group_link.rb index 00e3947a6bb..98f3fa87523 100644 --- a/db/migrate/20130820102832_add_access_to_project_group_link.rb +++ b/db/migrate/20130820102832_add_access_to_project_group_link.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddAccessToProjectGroupLink < ActiveRecord::Migration def change add_column :project_group_links, :group_access, :integer, null: false, default: ProjectGroupLink.default_access diff --git a/db/migrate/20130821090530_remove_deprecated_tables.rb b/db/migrate/20130821090530_remove_deprecated_tables.rb index 539c0617eeb..d22e713a7a1 100644 --- a/db/migrate/20130821090530_remove_deprecated_tables.rb +++ b/db/migrate/20130821090530_remove_deprecated_tables.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveDeprecatedTables < ActiveRecord::Migration def up drop_table :user_teams diff --git a/db/migrate/20130821090531_add_internal_ids_to_milestones.rb b/db/migrate/20130821090531_add_internal_ids_to_milestones.rb index 33e5bae5805..e25b8f91662 100644 --- a/db/migrate/20130821090531_add_internal_ids_to_milestones.rb +++ b/db/migrate/20130821090531_add_internal_ids_to_milestones.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddInternalIdsToMilestones < ActiveRecord::Migration def change add_column :milestones, :iid, :integer diff --git a/db/migrate/20130909132950_add_description_to_merge_request.rb b/db/migrate/20130909132950_add_description_to_merge_request.rb index 9bcd0c7ee06..fbac50c8216 100644 --- a/db/migrate/20130909132950_add_description_to_merge_request.rb +++ b/db/migrate/20130909132950_add_description_to_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDescriptionToMergeRequest < ActiveRecord::Migration def change add_column :merge_requests, :description, :text, null: true diff --git a/db/migrate/20130926081215_change_owner_id_for_group.rb b/db/migrate/20130926081215_change_owner_id_for_group.rb index 8f1992c37ab..2bdd22d5a04 100644 --- a/db/migrate/20130926081215_change_owner_id_for_group.rb +++ b/db/migrate/20130926081215_change_owner_id_for_group.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ChangeOwnerIdForGroup < ActiveRecord::Migration def up change_column :namespaces, :owner_id, :integer, null: true diff --git a/db/migrate/20131005191208_add_avatar_to_users.rb b/db/migrate/20131005191208_add_avatar_to_users.rb index 7b4de37ad72..df9057b81d6 100644 --- a/db/migrate/20131005191208_add_avatar_to_users.rb +++ b/db/migrate/20131005191208_add_avatar_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddAvatarToUsers < ActiveRecord::Migration def change add_column :users, :avatar, :string diff --git a/db/migrate/20131009115346_add_confirmable_to_users.rb b/db/migrate/20131009115346_add_confirmable_to_users.rb index 249cbe704ed..d714dd98e85 100644 --- a/db/migrate/20131009115346_add_confirmable_to_users.rb +++ b/db/migrate/20131009115346_add_confirmable_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddConfirmableToUsers < ActiveRecord::Migration def self.up add_column :users, :confirmation_token, :string diff --git a/db/migrate/20131106151520_remove_default_branch.rb b/db/migrate/20131106151520_remove_default_branch.rb index 88a890eb3eb..fd3d1ed7ab3 100644 --- a/db/migrate/20131106151520_remove_default_branch.rb +++ b/db/migrate/20131106151520_remove_default_branch.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveDefaultBranch < ActiveRecord::Migration def up remove_column :projects, :default_branch diff --git a/db/migrate/20131112114325_create_broadcast_messages.rb b/db/migrate/20131112114325_create_broadcast_messages.rb index 147178e9dcf..ce37a8e2708 100644 --- a/db/migrate/20131112114325_create_broadcast_messages.rb +++ b/db/migrate/20131112114325_create_broadcast_messages.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateBroadcastMessages < ActiveRecord::Migration def change create_table :broadcast_messages do |t| diff --git a/db/migrate/20131112220935_add_visibility_level_to_projects.rb b/db/migrate/20131112220935_add_visibility_level_to_projects.rb index 89421cbedad..5efc17b228e 100644 --- a/db/migrate/20131112220935_add_visibility_level_to_projects.rb +++ b/db/migrate/20131112220935_add_visibility_level_to_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddVisibilityLevelToProjects < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20131129154016_add_archived_to_projects.rb b/db/migrate/20131129154016_add_archived_to_projects.rb index 917e690ba47..e8e6908d137 100644 --- a/db/migrate/20131129154016_add_archived_to_projects.rb +++ b/db/migrate/20131129154016_add_archived_to_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddArchivedToProjects < ActiveRecord::Migration def change add_column :projects, :archived, :boolean, default: false, null: false diff --git a/db/migrate/20131130165425_add_color_and_font_to_broadcast_messages.rb b/db/migrate/20131130165425_add_color_and_font_to_broadcast_messages.rb index 473f355eceb..348a284a53e 100644 --- a/db/migrate/20131130165425_add_color_and_font_to_broadcast_messages.rb +++ b/db/migrate/20131130165425_add_color_and_font_to_broadcast_messages.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddColorAndFontToBroadcastMessages < ActiveRecord::Migration def change add_column :broadcast_messages, :color, :string diff --git a/db/migrate/20131202192556_add_event_fields_for_web_hook.rb b/db/migrate/20131202192556_add_event_fields_for_web_hook.rb index d29e996852e..99d76611524 100644 --- a/db/migrate/20131202192556_add_event_fields_for_web_hook.rb +++ b/db/migrate/20131202192556_add_event_fields_for_web_hook.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddEventFieldsForWebHook < ActiveRecord::Migration def change add_column :web_hooks, :push_events, :boolean, default: true, null: false diff --git a/db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb b/db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb index 7cec79e7ee8..4333dc59323 100644 --- a/db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb +++ b/db/migrate/20131214224427_add_hide_no_ssh_key_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddHideNoSshKeyToUsers < ActiveRecord::Migration def change add_column :users, :hide_no_ssh_key, :boolean, :default => false diff --git a/db/migrate/20131217102743_add_recipients_to_service.rb b/db/migrate/20131217102743_add_recipients_to_service.rb index 9695c251352..3c76be0f68d 100644 --- a/db/migrate/20131217102743_add_recipients_to_service.rb +++ b/db/migrate/20131217102743_add_recipients_to_service.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddRecipientsToService < ActiveRecord::Migration def change add_column :services, :recipients, :text diff --git a/db/migrate/20140116231608_add_website_url_to_users.rb b/db/migrate/20140116231608_add_website_url_to_users.rb index 0996fdcad73..1c39423562e 100644 --- a/db/migrate/20140116231608_add_website_url_to_users.rb +++ b/db/migrate/20140116231608_add_website_url_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddWebsiteUrlToUsers < ActiveRecord::Migration def change add_column :users, :website_url, :string, {:null => false, :default => ''} diff --git a/db/migrate/20140122112253_create_merge_request_diffs.rb b/db/migrate/20140122112253_create_merge_request_diffs.rb index f34e30925df..395c3edfc79 100644 --- a/db/migrate/20140122112253_create_merge_request_diffs.rb +++ b/db/migrate/20140122112253_create_merge_request_diffs.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateMergeRequestDiffs < ActiveRecord::Migration def up create_table :merge_request_diffs do |t| diff --git a/db/migrate/20140122114406_migrate_mr_diffs.rb b/db/migrate/20140122114406_migrate_mr_diffs.rb index 1595e2b6472..429aeb2293f 100644 --- a/db/migrate/20140122114406_migrate_mr_diffs.rb +++ b/db/migrate/20140122114406_migrate_mr_diffs.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateMrDiffs < ActiveRecord::Migration def self.up execute "INSERT INTO merge_request_diffs ( merge_request_id, st_commits, st_diffs ) SELECT id, st_commits, st_diffs FROM merge_requests" diff --git a/db/migrate/20140122122549_remove_m_rdiff_fields.rb b/db/migrate/20140122122549_remove_m_rdiff_fields.rb index 8f863d85a68..bbf35811b61 100644 --- a/db/migrate/20140122122549_remove_m_rdiff_fields.rb +++ b/db/migrate/20140122122549_remove_m_rdiff_fields.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveMRdiffFields < ActiveRecord::Migration def up remove_column :merge_requests, :st_commits diff --git a/db/migrate/20140125162722_add_avatar_to_projects.rb b/db/migrate/20140125162722_add_avatar_to_projects.rb index 9523ac722f2..888341b7535 100644 --- a/db/migrate/20140125162722_add_avatar_to_projects.rb +++ b/db/migrate/20140125162722_add_avatar_to_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddAvatarToProjects < ActiveRecord::Migration def change add_column :projects, :avatar, :string diff --git a/db/migrate/20140127170938_add_group_avatars.rb b/db/migrate/20140127170938_add_group_avatars.rb index 2911096dd5d..95d1c1c6b27 100644 --- a/db/migrate/20140127170938_add_group_avatars.rb +++ b/db/migrate/20140127170938_add_group_avatars.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddGroupAvatars < ActiveRecord::Migration def change add_column :namespaces, :avatar, :string diff --git a/db/migrate/20140209025651_create_emails.rb b/db/migrate/20140209025651_create_emails.rb index cb78c4af11b..571beb19cdd 100644 --- a/db/migrate/20140209025651_create_emails.rb +++ b/db/migrate/20140209025651_create_emails.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateEmails < ActiveRecord::Migration def change create_table :emails do |t| diff --git a/db/migrate/20140214102325_add_api_key_to_services.rb b/db/migrate/20140214102325_add_api_key_to_services.rb index 30eeca2c1f6..b58c36c0a30 100644 --- a/db/migrate/20140214102325_add_api_key_to_services.rb +++ b/db/migrate/20140214102325_add_api_key_to_services.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddApiKeyToServices < ActiveRecord::Migration def change add_column :services, :api_key, :string diff --git a/db/migrate/20140304005354_add_index_merge_request_diffs_on_merge_request_id.rb b/db/migrate/20140304005354_add_index_merge_request_diffs_on_merge_request_id.rb index 65d28e8cb01..aab8a41c2c3 100644 --- a/db/migrate/20140304005354_add_index_merge_request_diffs_on_merge_request_id.rb +++ b/db/migrate/20140304005354_add_index_merge_request_diffs_on_merge_request_id.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexMergeRequestDiffsOnMergeRequestId < ActiveRecord::Migration def change add_index :merge_request_diffs, :merge_request_id, unique: true diff --git a/db/migrate/20140305193308_add_tag_push_hooks_to_project_hook.rb b/db/migrate/20140305193308_add_tag_push_hooks_to_project_hook.rb index 7017148702a..ec163bb843c 100644 --- a/db/migrate/20140305193308_add_tag_push_hooks_to_project_hook.rb +++ b/db/migrate/20140305193308_add_tag_push_hooks_to_project_hook.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTagPushHooksToProjectHook < ActiveRecord::Migration def change add_column :web_hooks, :tag_push_events, :boolean, default: false diff --git a/db/migrate/20140312145357_add_import_status_to_project.rb b/db/migrate/20140312145357_add_import_status_to_project.rb index ef972e8342a..9947cd8c6f9 100644 --- a/db/migrate/20140312145357_add_import_status_to_project.rb +++ b/db/migrate/20140312145357_add_import_status_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddImportStatusToProject < ActiveRecord::Migration def change add_column :projects, :import_status, :string diff --git a/db/migrate/20140313092127_migrate_already_imported_projects.rb b/db/migrate/20140313092127_migrate_already_imported_projects.rb index 0a9f73a5758..f2e91fe1b40 100644 --- a/db/migrate/20140313092127_migrate_already_imported_projects.rb +++ b/db/migrate/20140313092127_migrate_already_imported_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateAlreadyImportedProjects < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20140407135544_fix_namespaces.rb b/db/migrate/20140407135544_fix_namespaces.rb index 59665d538f0..91374966698 100644 --- a/db/migrate/20140407135544_fix_namespaces.rb +++ b/db/migrate/20140407135544_fix_namespaces.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class FixNamespaces < ActiveRecord::Migration def up Namespace.where('name <> path and type is null').each do |namespace| diff --git a/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb b/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb index 1f6d85d5f66..fb9c7a6636e 100644 --- a/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb +++ b/db/migrate/20140414131055_change_state_to_allow_empty_merge_request_diffs.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ChangeStateToAllowEmptyMergeRequestDiffs < ActiveRecord::Migration def up change_column :merge_request_diffs, :state, :string, null: true, diff --git a/db/migrate/20140415124820_limits_to_mysql.rb b/db/migrate/20140415124820_limits_to_mysql.rb index 3f6e62617c5..c712423bcd1 100644 --- a/db/migrate/20140415124820_limits_to_mysql.rb +++ b/db/migrate/20140415124820_limits_to_mysql.rb @@ -1 +1,2 @@ +# rubocop:disable all require_relative 'limits_to_mysql' diff --git a/db/migrate/20140416074002_add_index_on_iid.rb b/db/migrate/20140416074002_add_index_on_iid.rb index 85269e2a03b..6cdaa5a3c08 100644 --- a/db/migrate/20140416074002_add_index_on_iid.rb +++ b/db/migrate/20140416074002_add_index_on_iid.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexOnIid < ActiveRecord::Migration def change RemoveDuplicateIid.clean(Issue) diff --git a/db/migrate/20140416185734_index_on_current_sign_in_at.rb b/db/migrate/20140416185734_index_on_current_sign_in_at.rb index 0bf80ce154a..8c620b545bd 100644 --- a/db/migrate/20140416185734_index_on_current_sign_in_at.rb +++ b/db/migrate/20140416185734_index_on_current_sign_in_at.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class IndexOnCurrentSignInAt < ActiveRecord::Migration def change add_index :users, :current_sign_in_at diff --git a/db/migrate/20140428105831_add_notes_index_updated_at.rb b/db/migrate/20140428105831_add_notes_index_updated_at.rb index 6c25570f128..0589101af93 100644 --- a/db/migrate/20140428105831_add_notes_index_updated_at.rb +++ b/db/migrate/20140428105831_add_notes_index_updated_at.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNotesIndexUpdatedAt < ActiveRecord::Migration def change add_index :notes, :updated_at diff --git a/db/migrate/20140502115131_add_repo_size_to_db.rb b/db/migrate/20140502115131_add_repo_size_to_db.rb index 7361d1a9440..090b30a4f26 100644 --- a/db/migrate/20140502115131_add_repo_size_to_db.rb +++ b/db/migrate/20140502115131_add_repo_size_to_db.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddRepoSizeToDb < ActiveRecord::Migration def change add_column :projects, :repository_size, :float, default: 0 diff --git a/db/migrate/20140502125220_migrate_repo_size.rb b/db/migrate/20140502125220_migrate_repo_size.rb index efdf53112fd..84463727b3b 100644 --- a/db/migrate/20140502125220_migrate_repo_size.rb +++ b/db/migrate/20140502125220_migrate_repo_size.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateRepoSize < ActiveRecord::Migration def up project_data = execute('SELECT projects.id, namespaces.path AS namespace_path, projects.path AS project_path FROM projects LEFT JOIN namespaces ON projects.namespace_id = namespaces.id') diff --git a/db/migrate/20140611135229_add_position_to_merge_request.rb b/db/migrate/20140611135229_add_position_to_merge_request.rb index d5fdecd0c39..3a7d2f7c359 100644 --- a/db/migrate/20140611135229_add_position_to_merge_request.rb +++ b/db/migrate/20140611135229_add_position_to_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPositionToMergeRequest < ActiveRecord::Migration def change add_column :merge_requests, :position, :integer, default: 0 diff --git a/db/migrate/20140625115202_create_users_star_projects.rb b/db/migrate/20140625115202_create_users_star_projects.rb index 412f0f6f34b..32dd99e83be 100644 --- a/db/migrate/20140625115202_create_users_star_projects.rb +++ b/db/migrate/20140625115202_create_users_star_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateUsersStarProjects < ActiveRecord::Migration def change create_table :users_star_projects do |t| diff --git a/db/migrate/20140729134820_create_labels.rb b/db/migrate/20140729134820_create_labels.rb index 3a4b6a152dc..df0f8cb9f03 100644 --- a/db/migrate/20140729134820_create_labels.rb +++ b/db/migrate/20140729134820_create_labels.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateLabels < ActiveRecord::Migration def change create_table :labels do |t| diff --git a/db/migrate/20140729140420_create_label_links.rb b/db/migrate/20140729140420_create_label_links.rb index 2bfc4ae2094..fa5992605f8 100644 --- a/db/migrate/20140729140420_create_label_links.rb +++ b/db/migrate/20140729140420_create_label_links.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateLabelLinks < ActiveRecord::Migration def change create_table :label_links do |t| diff --git a/db/migrate/20140729145339_migrate_project_tags.rb b/db/migrate/20140729145339_migrate_project_tags.rb index 5760e4bfeaa..ac46847f3e6 100644 --- a/db/migrate/20140729145339_migrate_project_tags.rb +++ b/db/migrate/20140729145339_migrate_project_tags.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateProjectTags < ActiveRecord::Migration def up ActsAsTaggableOn::Tagging.where(taggable_type: 'Project', context: 'labels').update_all(context: 'tags') diff --git a/db/migrate/20140729152420_migrate_taggable_labels.rb b/db/migrate/20140729152420_migrate_taggable_labels.rb index dc28d727d9a..04cdc6beadd 100644 --- a/db/migrate/20140729152420_migrate_taggable_labels.rb +++ b/db/migrate/20140729152420_migrate_taggable_labels.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateTaggableLabels < ActiveRecord::Migration def up taggings = ActsAsTaggableOn::Tagging.where(taggable_type: ['Issue', 'MergeRequest'], context: 'labels') diff --git a/db/migrate/20140730111702_add_index_to_labels.rb b/db/migrate/20140730111702_add_index_to_labels.rb index 494241c873c..cc7ac1fc449 100644 --- a/db/migrate/20140730111702_add_index_to_labels.rb +++ b/db/migrate/20140730111702_add_index_to_labels.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexToLabels < ActiveRecord::Migration def change add_index "labels", :project_id diff --git a/db/migrate/20140903115954_migrate_to_new_shell.rb b/db/migrate/20140903115954_migrate_to_new_shell.rb index 54cbe48960a..04acf24284b 100644 --- a/db/migrate/20140903115954_migrate_to_new_shell.rb +++ b/db/migrate/20140903115954_migrate_to_new_shell.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateToNewShell < ActiveRecord::Migration def change return if Rails.env.test? diff --git a/db/migrate/20140907220153_serialize_service_properties.rb b/db/migrate/20140907220153_serialize_service_properties.rb index d45a10465be..c2d67fad0ab 100644 --- a/db/migrate/20140907220153_serialize_service_properties.rb +++ b/db/migrate/20140907220153_serialize_service_properties.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class SerializeServiceProperties < ActiveRecord::Migration def change unless column_exists?(:services, :properties) diff --git a/db/migrate/20140914113604_add_members_table.rb b/db/migrate/20140914113604_add_members_table.rb index d311f3033ee..bc3c1bb61e4 100644 --- a/db/migrate/20140914113604_add_members_table.rb +++ b/db/migrate/20140914113604_add_members_table.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMembersTable < ActiveRecord::Migration def change create_table :members do |t| diff --git a/db/migrate/20140914145549_migrate_to_new_members_model.rb b/db/migrate/20140914145549_migrate_to_new_members_model.rb index 2a5a49c724a..b4c98f016d0 100644 --- a/db/migrate/20140914145549_migrate_to_new_members_model.rb +++ b/db/migrate/20140914145549_migrate_to_new_members_model.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateToNewMembersModel < ActiveRecord::Migration def up execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, group_id, 'Namespace', group_access, notification_level, 'GroupMember' FROM users_groups" diff --git a/db/migrate/20140914173417_remove_old_member_tables.rb b/db/migrate/20140914173417_remove_old_member_tables.rb index 408b9551dbb..aff8e94e5be 100644 --- a/db/migrate/20140914173417_remove_old_member_tables.rb +++ b/db/migrate/20140914173417_remove_old_member_tables.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveOldMemberTables < ActiveRecord::Migration def up drop_table :users_groups diff --git a/db/migrate/20141006143943_move_slack_service_to_webhook.rb b/db/migrate/20141006143943_move_slack_service_to_webhook.rb index 5836cd6b8db..8cb120f7007 100644 --- a/db/migrate/20141006143943_move_slack_service_to_webhook.rb +++ b/db/migrate/20141006143943_move_slack_service_to_webhook.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MoveSlackServiceToWebhook < ActiveRecord::Migration def change SlackService.all.each do |slack_service| diff --git a/db/migrate/20141007100818_add_visibility_level_to_snippet.rb b/db/migrate/20141007100818_add_visibility_level_to_snippet.rb index 93826185e8b..688d8578478 100644 --- a/db/migrate/20141007100818_add_visibility_level_to_snippet.rb +++ b/db/migrate/20141007100818_add_visibility_level_to_snippet.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddVisibilityLevelToSnippet < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20141118150935_add_audit_event.rb b/db/migrate/20141118150935_add_audit_event.rb index 07383c6bbc7..3884228456f 100644 --- a/db/migrate/20141118150935_add_audit_event.rb +++ b/db/migrate/20141118150935_add_audit_event.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddAuditEvent < ActiveRecord::Migration def change create_table :audit_events do |t| diff --git a/db/migrate/20141121133009_add_timestamps_to_members.rb b/db/migrate/20141121133009_add_timestamps_to_members.rb index ef6d4dedf32..68f164cd35d 100644 --- a/db/migrate/20141121133009_add_timestamps_to_members.rb +++ b/db/migrate/20141121133009_add_timestamps_to_members.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # In 20140914145549_migrate_to_new_members_model.rb we forgot to set the # created_at and updated_at times for new records in the 'members' table. This # became a problem after commit c8e78d972a5a628870eefca0f2ccea0199c55bda which diff --git a/db/migrate/20141121161704_add_identity_table.rb b/db/migrate/20141121161704_add_identity_table.rb index a85b0426cec..5a399f0d325 100644 --- a/db/migrate/20141121161704_add_identity_table.rb +++ b/db/migrate/20141121161704_add_identity_table.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIdentityTable < ActiveRecord::Migration def up create_table :identities do |t| diff --git a/db/migrate/20141205134006_add_locked_at_to_merge_request.rb b/db/migrate/20141205134006_add_locked_at_to_merge_request.rb index 49651c44a82..5aa91c7587a 100644 --- a/db/migrate/20141205134006_add_locked_at_to_merge_request.rb +++ b/db/migrate/20141205134006_add_locked_at_to_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddLockedAtToMergeRequest < ActiveRecord::Migration def change add_column :merge_requests, :locked_at, :datetime diff --git a/db/migrate/20141216155758_create_doorkeeper_tables.rb b/db/migrate/20141216155758_create_doorkeeper_tables.rb index af5aa7d8b73..b323ffe96f5 100644 --- a/db/migrate/20141216155758_create_doorkeeper_tables.rb +++ b/db/migrate/20141216155758_create_doorkeeper_tables.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateDoorkeeperTables < ActiveRecord::Migration def change create_table :oauth_applications do |t| diff --git a/db/migrate/20141217125223_add_owner_to_application.rb b/db/migrate/20141217125223_add_owner_to_application.rb index 7d5e6d07d0f..e5a669ab4d8 100644 --- a/db/migrate/20141217125223_add_owner_to_application.rb +++ b/db/migrate/20141217125223_add_owner_to_application.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddOwnerToApplication < ActiveRecord::Migration def change add_column :oauth_applications, :owner_id, :integer, null: true diff --git a/db/migrate/20141223135007_add_import_data_to_project_table.rb b/db/migrate/20141223135007_add_import_data_to_project_table.rb index 5db78f94cc9..9c8a483e4d5 100644 --- a/db/migrate/20141223135007_add_import_data_to_project_table.rb +++ b/db/migrate/20141223135007_add_import_data_to_project_table.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddImportDataToProjectTable < ActiveRecord::Migration def change add_column :projects, :import_type, :string diff --git a/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb b/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb index 70e7272f7f3..a18b2f4974d 100644 --- a/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb +++ b/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDevelopersCanPushToProtectedBranches < ActiveRecord::Migration def change add_column :protected_branches, :developers_can_push, :boolean, default: false, null: false diff --git a/db/migrate/20150108073740_create_application_settings.rb b/db/migrate/20150108073740_create_application_settings.rb index 651e35fdf7a..dfa2f765357 100644 --- a/db/migrate/20150108073740_create_application_settings.rb +++ b/db/migrate/20150108073740_create_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateApplicationSettings < ActiveRecord::Migration def change create_table :application_settings do |t| diff --git a/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb b/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb index aa179ce3a4d..10e6549c729 100644 --- a/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb +++ b/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddHomePageUrlForApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :home_page_url, :string diff --git a/db/migrate/20150116234545_add_gitlab_access_token_to_user.rb b/db/migrate/20150116234545_add_gitlab_access_token_to_user.rb index c28ba3197ac..e083973615a 100644 --- a/db/migrate/20150116234545_add_gitlab_access_token_to_user.rb +++ b/db/migrate/20150116234545_add_gitlab_access_token_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddGitlabAccessTokenToUser < ActiveRecord::Migration def change add_column :users, :gitlab_access_token, :string diff --git a/db/migrate/20150125163100_add_default_branch_protection_setting.rb b/db/migrate/20150125163100_add_default_branch_protection_setting.rb index 5020daf55f3..7ca3116d354 100644 --- a/db/migrate/20150125163100_add_default_branch_protection_setting.rb +++ b/db/migrate/20150125163100_add_default_branch_protection_setting.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDefaultBranchProtectionSetting < ActiveRecord::Migration def change add_column :application_settings, :default_branch_protection, :integer, :default => 2 diff --git a/db/migrate/20150205211843_add_timestamps_to_identities.rb b/db/migrate/20150205211843_add_timestamps_to_identities.rb index 77cddbfec3b..a78e28eb4eb 100644 --- a/db/migrate/20150205211843_add_timestamps_to_identities.rb +++ b/db/migrate/20150205211843_add_timestamps_to_identities.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTimestampsToIdentities < ActiveRecord::Migration def change add_timestamps(:identities) diff --git a/db/migrate/20150206181414_add_index_to_created_at.rb b/db/migrate/20150206181414_add_index_to_created_at.rb index fc624fca60d..a161fad79dc 100644 --- a/db/migrate/20150206181414_add_index_to_created_at.rb +++ b/db/migrate/20150206181414_add_index_to_created_at.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexToCreatedAt < ActiveRecord::Migration def change add_index "users", [:created_at, :id] diff --git a/db/migrate/20150206222854_add_notification_email_to_user.rb b/db/migrate/20150206222854_add_notification_email_to_user.rb index ab80f7e582f..ebae092cac8 100644 --- a/db/migrate/20150206222854_add_notification_email_to_user.rb +++ b/db/migrate/20150206222854_add_notification_email_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNotificationEmailToUser < ActiveRecord::Migration def up add_column :users, :notification_email, :string diff --git a/db/migrate/20150209222013_add_missing_index.rb b/db/migrate/20150209222013_add_missing_index.rb index a816c2e9e8c..18e3ac2cbbb 100644 --- a/db/migrate/20150209222013_add_missing_index.rb +++ b/db/migrate/20150209222013_add_missing_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMissingIndex < ActiveRecord::Migration def change add_index "services", [:created_at, :id] diff --git a/db/migrate/20150211172122_add_template_to_service.rb b/db/migrate/20150211172122_add_template_to_service.rb index b1bfbc45ee9..a3e96b25c56 100644 --- a/db/migrate/20150211172122_add_template_to_service.rb +++ b/db/migrate/20150211172122_add_template_to_service.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTemplateToService < ActiveRecord::Migration def change add_column :services, :template, :boolean, default: false diff --git a/db/migrate/20150211174341_allow_null_in_services_project_id.rb b/db/migrate/20150211174341_allow_null_in_services_project_id.rb index 68f02812791..fea95c79adf 100644 --- a/db/migrate/20150211174341_allow_null_in_services_project_id.rb +++ b/db/migrate/20150211174341_allow_null_in_services_project_id.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AllowNullInServicesProjectId < ActiveRecord::Migration def change change_column :services, :project_id, :integer, null: true diff --git a/db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb b/db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb index a0439172391..334020376e4 100644 --- a/db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb +++ b/db/migrate/20150213104043_add_twitter_sharing_enabled_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTwitterSharingEnabledToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :twitter_sharing_enabled, :boolean, default: true diff --git a/db/migrate/20150213114800_add_hide_no_password_to_user.rb b/db/migrate/20150213114800_add_hide_no_password_to_user.rb index 685f0844276..a2af3510b9c 100644 --- a/db/migrate/20150213114800_add_hide_no_password_to_user.rb +++ b/db/migrate/20150213114800_add_hide_no_password_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddHideNoPasswordToUser < ActiveRecord::Migration def change add_column :users, :hide_no_password, :boolean, default: false diff --git a/db/migrate/20150213121042_add_password_automatically_set_to_user.rb b/db/migrate/20150213121042_add_password_automatically_set_to_user.rb index c3c7c1ffc77..4e84a13f0d2 100644 --- a/db/migrate/20150213121042_add_password_automatically_set_to_user.rb +++ b/db/migrate/20150213121042_add_password_automatically_set_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPasswordAutomaticallySetToUser < ActiveRecord::Migration def change add_column :users, :password_automatically_set, :boolean, default: false diff --git a/db/migrate/20150217123345_add_bitbucket_access_token_and_secret_to_user.rb b/db/migrate/20150217123345_add_bitbucket_access_token_and_secret_to_user.rb index 23ac1b399ec..78e9fd0c3a9 100644 --- a/db/migrate/20150217123345_add_bitbucket_access_token_and_secret_to_user.rb +++ b/db/migrate/20150217123345_add_bitbucket_access_token_and_secret_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddBitbucketAccessTokenAndSecretToUser < ActiveRecord::Migration def change add_column :users, :bitbucket_access_token, :string diff --git a/db/migrate/20150219004514_add_events_to_services.rb b/db/migrate/20150219004514_add_events_to_services.rb index cf73a0174f4..560382c3fa1 100644 --- a/db/migrate/20150219004514_add_events_to_services.rb +++ b/db/migrate/20150219004514_add_events_to_services.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddEventsToServices < ActiveRecord::Migration def change add_column :services, :push_events, :boolean, :default => true diff --git a/db/migrate/20150223022001_set_missing_last_activity_at.rb b/db/migrate/20150223022001_set_missing_last_activity_at.rb index 3f6d4d83474..300381ad65b 100644 --- a/db/migrate/20150223022001_set_missing_last_activity_at.rb +++ b/db/migrate/20150223022001_set_missing_last_activity_at.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class SetMissingLastActivityAt < ActiveRecord::Migration def up execute "UPDATE projects SET last_activity_at = updated_at WHERE last_activity_at IS NULL" diff --git a/db/migrate/20150225065047_add_note_events_to_services.rb b/db/migrate/20150225065047_add_note_events_to_services.rb index d54ba9e482f..7843cabc43b 100644 --- a/db/migrate/20150225065047_add_note_events_to_services.rb +++ b/db/migrate/20150225065047_add_note_events_to_services.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNoteEventsToServices < ActiveRecord::Migration def change add_column :services, :note_events, :boolean, default: true, null: false diff --git a/db/migrate/20150301014758_add_restricted_visibility_levels_to_application_settings.rb b/db/migrate/20150301014758_add_restricted_visibility_levels_to_application_settings.rb index 494c3033bff..7d8d65ef2ee 100644 --- a/db/migrate/20150301014758_add_restricted_visibility_levels_to_application_settings.rb +++ b/db/migrate/20150301014758_add_restricted_visibility_levels_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddRestrictedVisibilityLevelsToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :restricted_visibility_levels, :text diff --git a/db/migrate/20150306023106_fix_namespace_duplication.rb b/db/migrate/20150306023106_fix_namespace_duplication.rb index 334e5574559..ea53a9d71f2 100644 --- a/db/migrate/20150306023106_fix_namespace_duplication.rb +++ b/db/migrate/20150306023106_fix_namespace_duplication.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class FixNamespaceDuplication < ActiveRecord::Migration def up #fixes path duplication diff --git a/db/migrate/20150306023112_add_unique_index_to_namespace.rb b/db/migrate/20150306023112_add_unique_index_to_namespace.rb index 6472138e3ef..f293a9b643f 100644 --- a/db/migrate/20150306023112_add_unique_index_to_namespace.rb +++ b/db/migrate/20150306023112_add_unique_index_to_namespace.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddUniqueIndexToNamespace < ActiveRecord::Migration def change remove_index :namespaces, column: :name if index_exists?(:namespaces, :name) diff --git a/db/migrate/20150310194358_add_version_check_to_application_settings.rb b/db/migrate/20150310194358_add_version_check_to_application_settings.rb index e9d42c1e749..5d3dae6e7d8 100644 --- a/db/migrate/20150310194358_add_version_check_to_application_settings.rb +++ b/db/migrate/20150310194358_add_version_check_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddVersionCheckToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :version_check_enabled, :boolean, default: true diff --git a/db/migrate/20150313012111_create_subscriptions_table.rb b/db/migrate/20150313012111_create_subscriptions_table.rb index a1d4d9dedc5..8adb193b27f 100644 --- a/db/migrate/20150313012111_create_subscriptions_table.rb +++ b/db/migrate/20150313012111_create_subscriptions_table.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateSubscriptionsTable < ActiveRecord::Migration def change create_table :subscriptions do |t| diff --git a/db/migrate/20150320234437_add_location_to_user.rb b/db/migrate/20150320234437_add_location_to_user.rb index 32731d37d75..df046570361 100644 --- a/db/migrate/20150320234437_add_location_to_user.rb +++ b/db/migrate/20150320234437_add_location_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddLocationToUser < ActiveRecord::Migration def change add_column :users, :location, :string diff --git a/db/migrate/20150324155957_set_incorrect_assignee_id_to_null.rb b/db/migrate/20150324155957_set_incorrect_assignee_id_to_null.rb index 42dc8173e46..9f8b6f4bd59 100644 --- a/db/migrate/20150324155957_set_incorrect_assignee_id_to_null.rb +++ b/db/migrate/20150324155957_set_incorrect_assignee_id_to_null.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class SetIncorrectAssigneeIdToNull < ActiveRecord::Migration def up execute "UPDATE issues SET assignee_id = NULL WHERE assignee_id = -1" diff --git a/db/migrate/20150327122227_add_public_to_key.rb b/db/migrate/20150327122227_add_public_to_key.rb index 6ffbf4cda19..33c20d65e03 100644 --- a/db/migrate/20150327122227_add_public_to_key.rb +++ b/db/migrate/20150327122227_add_public_to_key.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPublicToKey < ActiveRecord::Migration def change add_column :keys, :public, :boolean, default: false, null: false diff --git a/db/migrate/20150327150017_add_import_data_to_project.rb b/db/migrate/20150327150017_add_import_data_to_project.rb index 12c00339eec..67b1554dfd1 100644 --- a/db/migrate/20150327150017_add_import_data_to_project.rb +++ b/db/migrate/20150327150017_add_import_data_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddImportDataToProject < ActiveRecord::Migration def change add_column :projects, :import_data, :text diff --git a/db/migrate/20150327223628_add_devise_two_factor_to_users.rb b/db/migrate/20150327223628_add_devise_two_factor_to_users.rb index 11b026ee8f3..eccb0123e77 100644 --- a/db/migrate/20150327223628_add_devise_two_factor_to_users.rb +++ b/db/migrate/20150327223628_add_devise_two_factor_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDeviseTwoFactorToUsers < ActiveRecord::Migration def change add_column :users, :encrypted_otp_secret, :string diff --git a/db/migrate/20150328132231_add_max_attachment_size_to_application_settings.rb b/db/migrate/20150328132231_add_max_attachment_size_to_application_settings.rb index 1d161674a9a..4c56a2fb78b 100644 --- a/db/migrate/20150328132231_add_max_attachment_size_to_application_settings.rb +++ b/db/migrate/20150328132231_add_max_attachment_size_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMaxAttachmentSizeToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :max_attachment_size, :integer, default: 10, null: false diff --git a/db/migrate/20150331183602_add_devise_two_factor_backupable_to_users.rb b/db/migrate/20150331183602_add_devise_two_factor_backupable_to_users.rb index 913958db7c5..fdb6d72917e 100644 --- a/db/migrate/20150331183602_add_devise_two_factor_backupable_to_users.rb +++ b/db/migrate/20150331183602_add_devise_two_factor_backupable_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDeviseTwoFactorBackupableToUsers < ActiveRecord::Migration def change add_column :users, :otp_backup_codes, :text diff --git a/db/migrate/20150406133311_add_invite_data_to_member.rb b/db/migrate/20150406133311_add_invite_data_to_member.rb index 5d3e856ddce..63d0f184f32 100644 --- a/db/migrate/20150406133311_add_invite_data_to_member.rb +++ b/db/migrate/20150406133311_add_invite_data_to_member.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddInviteDataToMember < ActiveRecord::Migration def up add_column :members, :created_by_id, :integer diff --git a/db/migrate/20150411000035_fix_identities.rb b/db/migrate/20150411000035_fix_identities.rb index d9051f9fffd..a10fcc001f4 100644 --- a/db/migrate/20150411000035_fix_identities.rb +++ b/db/migrate/20150411000035_fix_identities.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class FixIdentities < ActiveRecord::Migration def up # Up until now, legacy 'ldap' references in the database were charitably diff --git a/db/migrate/20150411180045_rename_buildbox_service.rb b/db/migrate/20150411180045_rename_buildbox_service.rb index 5a0b5d07e50..9f3b25c3971 100644 --- a/db/migrate/20150411180045_rename_buildbox_service.rb +++ b/db/migrate/20150411180045_rename_buildbox_service.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RenameBuildboxService < ActiveRecord::Migration def up execute "UPDATE services SET type = 'BuildkiteService' WHERE type = 'BuildboxService';" diff --git a/db/migrate/20150413192223_add_public_email_to_users.rb b/db/migrate/20150413192223_add_public_email_to_users.rb index 700e9f343a6..0fed5eaf461 100644 --- a/db/migrate/20150413192223_add_public_email_to_users.rb +++ b/db/migrate/20150413192223_add_public_email_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPublicEmailToUsers < ActiveRecord::Migration def change add_column :users, :public_email, :string, default: "", null: false diff --git a/db/migrate/20150417121913_create_project_import_data.rb b/db/migrate/20150417121913_create_project_import_data.rb index c78f5fde85e..fc357cbacc8 100644 --- a/db/migrate/20150417121913_create_project_import_data.rb +++ b/db/migrate/20150417121913_create_project_import_data.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateProjectImportData < ActiveRecord::Migration def change create_table :project_import_data do |t| diff --git a/db/migrate/20150417122318_remove_import_data_from_project.rb b/db/migrate/20150417122318_remove_import_data_from_project.rb index 46cf63593c9..5a008218fa5 100644 --- a/db/migrate/20150417122318_remove_import_data_from_project.rb +++ b/db/migrate/20150417122318_remove_import_data_from_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveImportDataFromProject < ActiveRecord::Migration def up remove_column :projects, :import_data diff --git a/db/migrate/20150421120000_remove_periods_at_ends_of_usernames.rb b/db/migrate/20150421120000_remove_periods_at_ends_of_usernames.rb index 3057ea3c68c..3445e9ce59e 100644 --- a/db/migrate/20150421120000_remove_periods_at_ends_of_usernames.rb +++ b/db/migrate/20150421120000_remove_periods_at_ends_of_usernames.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration include Gitlab::ShellAdapter diff --git a/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb b/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb index 50a9b2439e0..129ce4d04af 100644 --- a/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb +++ b/db/migrate/20150423033240_add_default_project_visibililty_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDefaultProjectVisibililtyToApplicationSettings < ActiveRecord::Migration def up add_column :application_settings, :default_project_visibility, :integer diff --git a/db/migrate/20150425164646_gitlab_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20150425164646_gitlab_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index 281c88d2a7d..8f352414ffd 100644 --- a/db/migrate/20150425164646_gitlab_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150425164646_gitlab_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # This migration is a duplicate of 20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb # It shold be applied before the index additions to ensure that `name` is case sensitive. diff --git a/db/migrate/20150425164647_remove_duplicate_tags.rb b/db/migrate/20150425164647_remove_duplicate_tags.rb index 13e5038db9c..e77623bf507 100644 --- a/db/migrate/20150425164647_remove_duplicate_tags.rb +++ b/db/migrate/20150425164647_remove_duplicate_tags.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveDuplicateTags < ActiveRecord::Migration def up select_all("SELECT name, COUNT(id) as cnt FROM tags GROUP BY name HAVING COUNT(id) > 1").each do |tag| diff --git a/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb index c1b78681519..cbff98cdbc4 100644 --- a/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150425164648_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # This migration comes from acts_as_taggable_on_engine (originally 2) class AddMissingUniqueIndices < ActiveRecord::Migration def self.up diff --git a/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index 8edb5080781..1568d2dd4ce 100644 --- a/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150425164649_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # This migration comes from acts_as_taggable_on_engine (originally 3) class AddTaggingsCounterCacheToTags < ActiveRecord::Migration def self.up diff --git a/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb index 71f2d7f4330..88829b87711 100644 --- a/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150425164650_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # This migration comes from acts_as_taggable_on_engine (originally 4) class AddMissingTaggableIndex < ActiveRecord::Migration def self.up diff --git a/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index bfb06bc7cda..642c4745321 100644 --- a/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150425164651_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # This migration comes from acts_as_taggable_on_engine (originally 5) # This migration is added to circumvent issue #623 and have special characters # work properly diff --git a/db/migrate/20150425173433_add_default_snippet_visibility_to_app_settings.rb b/db/migrate/20150425173433_add_default_snippet_visibility_to_app_settings.rb index 8f1b0cc8935..dd13def4176 100644 --- a/db/migrate/20150425173433_add_default_snippet_visibility_to_app_settings.rb +++ b/db/migrate/20150425173433_add_default_snippet_visibility_to_app_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDefaultSnippetVisibilityToAppSettings < ActiveRecord::Migration def up add_column :application_settings, :default_snippet_visibility, :integer diff --git a/db/migrate/20150429002313_remove_abandoned_group_members_records.rb b/db/migrate/20150429002313_remove_abandoned_group_members_records.rb index 244637e1c4a..d2c7f3c442e 100644 --- a/db/migrate/20150429002313_remove_abandoned_group_members_records.rb +++ b/db/migrate/20150429002313_remove_abandoned_group_members_records.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveAbandonedGroupMembersRecords < ActiveRecord::Migration def up execute("DELETE FROM members WHERE type = 'GroupMember' AND source_id NOT IN(\ diff --git a/db/migrate/20150502064022_add_restricted_signup_domains_to_application_settings.rb b/db/migrate/20150502064022_add_restricted_signup_domains_to_application_settings.rb index 184e2653610..b63ea9aec7a 100644 --- a/db/migrate/20150502064022_add_restricted_signup_domains_to_application_settings.rb +++ b/db/migrate/20150502064022_add_restricted_signup_domains_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddRestrictedSignupDomainsToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :restricted_signup_domains, :text diff --git a/db/migrate/20150509180749_convert_legacy_reference_notes.rb b/db/migrate/20150509180749_convert_legacy_reference_notes.rb index b02605489be..cd8bf90108d 100644 --- a/db/migrate/20150509180749_convert_legacy_reference_notes.rb +++ b/db/migrate/20150509180749_convert_legacy_reference_notes.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # Convert legacy Markdown-emphasized notes to the current, non-emphasized format # # _mentioned in 54f7727c850972f0401c1312a7c4a6a380de5666_ diff --git a/db/migrate/20150516060434_add_note_events_to_web_hooks.rb b/db/migrate/20150516060434_add_note_events_to_web_hooks.rb index 0097587b4f6..bf72e5e2e3a 100644 --- a/db/migrate/20150516060434_add_note_events_to_web_hooks.rb +++ b/db/migrate/20150516060434_add_note_events_to_web_hooks.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNoteEventsToWebHooks < ActiveRecord::Migration def up add_column :web_hooks, :note_events, :boolean, default: false, null: false diff --git a/db/migrate/20150529111607_add_user_oauth_applications_to_application_settings.rb b/db/migrate/20150529111607_add_user_oauth_applications_to_application_settings.rb index 6a78294f0b2..9b02eda56ab 100644 --- a/db/migrate/20150529111607_add_user_oauth_applications_to_application_settings.rb +++ b/db/migrate/20150529111607_add_user_oauth_applications_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddUserOauthApplicationsToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :user_oauth_applications, :bool, default: true diff --git a/db/migrate/20150529150354_add_after_sign_out_path_for_application_settings.rb b/db/migrate/20150529150354_add_after_sign_out_path_for_application_settings.rb index 83e08101407..833c36de52d 100644 --- a/db/migrate/20150529150354_add_after_sign_out_path_for_application_settings.rb +++ b/db/migrate/20150529150354_add_after_sign_out_path_for_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddAfterSignOutPathForApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :after_sign_out_path, :string diff --git a/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb b/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb index 61ff0af41f4..1f5cf1fe5f1 100644 --- a/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb +++ b/db/migrate/20150609141121_add_session_expire_delay_for_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddSessionExpireDelayForApplicationSettings < ActiveRecord::Migration def change unless column_exists?(:application_settings, :session_expire_delay) diff --git a/db/migrate/20150610065936_add_dashboard_to_users.rb b/db/migrate/20150610065936_add_dashboard_to_users.rb index 2628e450722..df38472f893 100644 --- a/db/migrate/20150610065936_add_dashboard_to_users.rb +++ b/db/migrate/20150610065936_add_dashboard_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDashboardToUsers < ActiveRecord::Migration def up add_column :users, :dashboard, :integer, default: 0 diff --git a/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb b/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb index 8eed8678b2f..da0fd457a34 100644 --- a/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb +++ b/db/migrate/20150620233230_add_default_otp_required_for_login_value.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDefaultOtpRequiredForLoginValue < ActiveRecord::Migration def up execute %q{UPDATE users SET otp_required_for_login = FALSE WHERE otp_required_for_login IS NULL} diff --git a/db/migrate/20150713160110_add_project_view_to_users.rb b/db/migrate/20150713160110_add_project_view_to_users.rb index fe3d206df89..0de5a93035c 100644 --- a/db/migrate/20150713160110_add_project_view_to_users.rb +++ b/db/migrate/20150713160110_add_project_view_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddProjectViewToUsers < ActiveRecord::Migration def change add_column :users, :project_view, :integer, default: 0 diff --git a/db/migrate/20150717130904_add_commits_count_to_project.rb b/db/migrate/20150717130904_add_commits_count_to_project.rb index 9b46daa5933..5799e068c69 100644 --- a/db/migrate/20150717130904_add_commits_count_to_project.rb +++ b/db/migrate/20150717130904_add_commits_count_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCommitsCountToProject < ActiveRecord::Migration def change add_column :projects, :commit_count, :integer, default: 0 diff --git a/db/migrate/20150730122406_add_updated_by_to_issuables_and_notes.rb b/db/migrate/20150730122406_add_updated_by_to_issuables_and_notes.rb index 78d45c7f96b..be30e881c74 100644 --- a/db/migrate/20150730122406_add_updated_by_to_issuables_and_notes.rb +++ b/db/migrate/20150730122406_add_updated_by_to_issuables_and_notes.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddUpdatedByToIssuablesAndNotes < ActiveRecord::Migration def change add_column :notes, :updated_by_id, :integer diff --git a/db/migrate/20150806104937_create_abuse_reports.rb b/db/migrate/20150806104937_create_abuse_reports.rb index e97dc4cf04c..3c749b5d9a9 100644 --- a/db/migrate/20150806104937_create_abuse_reports.rb +++ b/db/migrate/20150806104937_create_abuse_reports.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateAbuseReports < ActiveRecord::Migration def change create_table :abuse_reports do |t| diff --git a/db/migrate/20150812080800_add_settings_import_sources.rb b/db/migrate/20150812080800_add_settings_import_sources.rb index 276d2fdb2b1..07f417fa3e3 100644 --- a/db/migrate/20150812080800_add_settings_import_sources.rb +++ b/db/migrate/20150812080800_add_settings_import_sources.rb @@ -1,3 +1,4 @@ +# rubocop:disable all require 'yaml' class AddSettingsImportSources < ActiveRecord::Migration diff --git a/db/migrate/20150814065925_remove_oauth_tokens_from_users.rb b/db/migrate/20150814065925_remove_oauth_tokens_from_users.rb index de2078a9268..7eaa7eda311 100644 --- a/db/migrate/20150814065925_remove_oauth_tokens_from_users.rb +++ b/db/migrate/20150814065925_remove_oauth_tokens_from_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveOauthTokensFromUsers < ActiveRecord::Migration def change remove_column :users, :github_access_token, :string diff --git a/db/migrate/20150817163600_deduplicate_user_identities.rb b/db/migrate/20150817163600_deduplicate_user_identities.rb index fceffc48018..b0cfad7d20f 100644 --- a/db/migrate/20150817163600_deduplicate_user_identities.rb +++ b/db/migrate/20150817163600_deduplicate_user_identities.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class DeduplicateUserIdentities < ActiveRecord::Migration def change execute 'DROP TABLE IF EXISTS tt_migration_DeduplicateUserIdentities;' diff --git a/db/migrate/20150818213832_add_sent_notifications.rb b/db/migrate/20150818213832_add_sent_notifications.rb index 43e8d6a1a82..fa0c3ce0acf 100644 --- a/db/migrate/20150818213832_add_sent_notifications.rb +++ b/db/migrate/20150818213832_add_sent_notifications.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddSentNotifications < ActiveRecord::Migration def change create_table :sent_notifications do |t| diff --git a/db/migrate/20150824002011_add_enable_ssl_verification.rb b/db/migrate/20150824002011_add_enable_ssl_verification.rb index 093c068fbde..6e992f08834 100644 --- a/db/migrate/20150824002011_add_enable_ssl_verification.rb +++ b/db/migrate/20150824002011_add_enable_ssl_verification.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddEnableSslVerification < ActiveRecord::Migration def change add_column :web_hooks, :enable_ssl_verification, :boolean, default: false diff --git a/db/migrate/20150826001931_add_ci_tables.rb b/db/migrate/20150826001931_add_ci_tables.rb index c4f51363e57..d1f8506d1fe 100644 --- a/db/migrate/20150826001931_add_ci_tables.rb +++ b/db/migrate/20150826001931_add_ci_tables.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCiTables < ActiveRecord::Migration def change create_table "ci_application_settings", force: true do |t| diff --git a/db/migrate/20150902001023_add_template_to_label.rb b/db/migrate/20150902001023_add_template_to_label.rb index bd381a97b69..0f6ae8d6cc3 100644 --- a/db/migrate/20150902001023_add_template_to_label.rb +++ b/db/migrate/20150902001023_add_template_to_label.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTemplateToLabel < ActiveRecord::Migration def change add_column :labels, :template, :boolean, default: false diff --git a/db/migrate/20150914215247_add_ci_tags.rb b/db/migrate/20150914215247_add_ci_tags.rb index df3390e8a82..b647bc9c8a2 100644 --- a/db/migrate/20150914215247_add_ci_tags.rb +++ b/db/migrate/20150914215247_add_ci_tags.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCiTags < ActiveRecord::Migration def change create_table "ci_taggings", force: true do |t| diff --git a/db/migrate/20150915001905_enable_ssl_verification_by_default.rb b/db/migrate/20150915001905_enable_ssl_verification_by_default.rb index 6e924262a13..3f070139418 100644 --- a/db/migrate/20150915001905_enable_ssl_verification_by_default.rb +++ b/db/migrate/20150915001905_enable_ssl_verification_by_default.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class EnableSslVerificationByDefault < ActiveRecord::Migration def change change_column :web_hooks, :enable_ssl_verification, :boolean, default: true diff --git a/db/migrate/20150916000405_enable_ssl_verification_for_web_hooks.rb b/db/migrate/20150916000405_enable_ssl_verification_for_web_hooks.rb index 90ce6c2db3d..ea2ab6e4093 100644 --- a/db/migrate/20150916000405_enable_ssl_verification_for_web_hooks.rb +++ b/db/migrate/20150916000405_enable_ssl_verification_for_web_hooks.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class EnableSslVerificationForWebHooks < ActiveRecord::Migration def up execute("UPDATE web_hooks SET enable_ssl_verification = true") diff --git a/db/migrate/20150916114643_add_help_page_text_to_application_settings.rb b/db/migrate/20150916114643_add_help_page_text_to_application_settings.rb index 37a27f11935..a504f25b1be 100644 --- a/db/migrate/20150916114643_add_help_page_text_to_application_settings.rb +++ b/db/migrate/20150916114643_add_help_page_text_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddHelpPageTextToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :help_page_text, :text diff --git a/db/migrate/20150916145038_add_index_for_committed_at_and_id.rb b/db/migrate/20150916145038_add_index_for_committed_at_and_id.rb index 78d9e5f61a1..a18ed93cf37 100644 --- a/db/migrate/20150916145038_add_index_for_committed_at_and_id.rb +++ b/db/migrate/20150916145038_add_index_for_committed_at_and_id.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexForCommittedAtAndId < ActiveRecord::Migration def change add_index :ci_commits, [:project_id, :committed_at, :id] diff --git a/db/migrate/20150918084513_add_ci_enabled_to_application_settings.rb b/db/migrate/20150918084513_add_ci_enabled_to_application_settings.rb index 6cf668a170e..c9b6e035122 100644 --- a/db/migrate/20150918084513_add_ci_enabled_to_application_settings.rb +++ b/db/migrate/20150918084513_add_ci_enabled_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCiEnabledToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :ci_enabled, :boolean, null: false, default: true diff --git a/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb b/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb index 0aad6fe5e6e..e1818b566d7 100644 --- a/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb +++ b/db/migrate/20150918161719_remove_invalid_milestones_from_merge_requests.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveInvalidMilestonesFromMergeRequests < ActiveRecord::Migration def up execute("UPDATE merge_requests SET milestone_id = NULL where milestone_id NOT IN (SELECT id FROM milestones)") diff --git a/db/migrate/20150920010715_add_consumed_timestep_to_users.rb b/db/migrate/20150920010715_add_consumed_timestep_to_users.rb index c8438b3f6aa..e6975f5b9fe 100644 --- a/db/migrate/20150920010715_add_consumed_timestep_to_users.rb +++ b/db/migrate/20150920010715_add_consumed_timestep_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddConsumedTimestepToUsers < ActiveRecord::Migration def change add_column :users, :consumed_timestep, :integer diff --git a/db/migrate/20150920161119_add_line_code_to_sent_notification.rb b/db/migrate/20150920161119_add_line_code_to_sent_notification.rb index d9af4e71751..1bcb06e4bda 100644 --- a/db/migrate/20150920161119_add_line_code_to_sent_notification.rb +++ b/db/migrate/20150920161119_add_line_code_to_sent_notification.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddLineCodeToSentNotification < ActiveRecord::Migration def change add_column :sent_notifications, :line_code, :string diff --git a/db/migrate/20150924125150_add_project_id_to_ci_commit.rb b/db/migrate/20150924125150_add_project_id_to_ci_commit.rb index 1a761fe0f86..905332b7dc7 100644 --- a/db/migrate/20150924125150_add_project_id_to_ci_commit.rb +++ b/db/migrate/20150924125150_add_project_id_to_ci_commit.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddProjectIdToCiCommit < ActiveRecord::Migration def up add_column :ci_commits, :gl_project_id, :integer diff --git a/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb b/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb index 2be57b6062e..fb0e0ba1fa5 100644 --- a/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb +++ b/db/migrate/20150924125436_migrate_project_id_for_ci_commits.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateProjectIdForCiCommits < ActiveRecord::Migration def up subquery = 'SELECT gitlab_id FROM ci_projects WHERE ci_projects.id = ci_commits.project_id' diff --git a/db/migrate/20150930001110_merge_request_error_field.rb b/db/migrate/20150930001110_merge_request_error_field.rb index c2ee498ef3f..71a8ae3938a 100644 --- a/db/migrate/20150930001110_merge_request_error_field.rb +++ b/db/migrate/20150930001110_merge_request_error_field.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MergeRequestErrorField < ActiveRecord::Migration def up add_column :merge_requests, :merge_error, :string diff --git a/db/migrate/20150930095736_add_null_to_name_for_ci_projects.rb b/db/migrate/20150930095736_add_null_to_name_for_ci_projects.rb index 8d47dac6441..229c9942b50 100644 --- a/db/migrate/20150930095736_add_null_to_name_for_ci_projects.rb +++ b/db/migrate/20150930095736_add_null_to_name_for_ci_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNullToNameForCiProjects < ActiveRecord::Migration def up change_column_null :ci_projects, :name, true diff --git a/db/migrate/20150930110012_add_group_share_lock.rb b/db/migrate/20150930110012_add_group_share_lock.rb index 78d1a4538f2..96938bf9ab6 100644 --- a/db/migrate/20150930110012_add_group_share_lock.rb +++ b/db/migrate/20150930110012_add_group_share_lock.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddGroupShareLock < ActiveRecord::Migration def change add_column :namespaces, :share_with_group_lock, :boolean, default: false diff --git a/db/migrate/20151002112914_add_stage_idx_to_builds.rb b/db/migrate/20151002112914_add_stage_idx_to_builds.rb index 68a745ffef4..4297ba0e7c8 100644 --- a/db/migrate/20151002112914_add_stage_idx_to_builds.rb +++ b/db/migrate/20151002112914_add_stage_idx_to_builds.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddStageIdxToBuilds < ActiveRecord::Migration def change add_column :ci_builds, :stage_idx, :integer diff --git a/db/migrate/20151002121400_add_index_for_builds.rb b/db/migrate/20151002121400_add_index_for_builds.rb index 4ffc1363910..bd945c54540 100644 --- a/db/migrate/20151002121400_add_index_for_builds.rb +++ b/db/migrate/20151002121400_add_index_for_builds.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexForBuilds < ActiveRecord::Migration def up add_index :ci_builds, [:commit_id, :stage_idx, :created_at] diff --git a/db/migrate/20151002122929_add_ref_and_tag_to_builds.rb b/db/migrate/20151002122929_add_ref_and_tag_to_builds.rb index e3d2ac1cea5..3c0fcf6c45d 100644 --- a/db/migrate/20151002122929_add_ref_and_tag_to_builds.rb +++ b/db/migrate/20151002122929_add_ref_and_tag_to_builds.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddRefAndTagToBuilds < ActiveRecord::Migration def change add_column :ci_builds, :tag, :boolean diff --git a/db/migrate/20151002122943_migrate_ref_and_tag_to_build.rb b/db/migrate/20151002122943_migrate_ref_and_tag_to_build.rb index 01d7b3f6773..52217ce5af2 100644 --- a/db/migrate/20151002122943_migrate_ref_and_tag_to_build.rb +++ b/db/migrate/20151002122943_migrate_ref_and_tag_to_build.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateRefAndTagToBuild < ActiveRecord::Migration def change execute('UPDATE ci_builds SET ref=(SELECT ref FROM ci_commits WHERE ci_commits.id = ci_builds.commit_id) WHERE ref IS NULL') diff --git a/db/migrate/20151005075649_add_user_id_to_build.rb b/db/migrate/20151005075649_add_user_id_to_build.rb index 0f4b92b8b79..be9d403e002 100644 --- a/db/migrate/20151005075649_add_user_id_to_build.rb +++ b/db/migrate/20151005075649_add_user_id_to_build.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddUserIdToBuild < ActiveRecord::Migration def change add_column :ci_builds, :user_id, :integer diff --git a/db/migrate/20151005150751_add_layout_option_for_users.rb b/db/migrate/20151005150751_add_layout_option_for_users.rb index ead9b1f8977..7e68606969f 100644 --- a/db/migrate/20151005150751_add_layout_option_for_users.rb +++ b/db/migrate/20151005150751_add_layout_option_for_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddLayoutOptionForUsers < ActiveRecord::Migration def change add_column :users, :layout, :integer, default: 0 diff --git a/db/migrate/20151005162154_remove_ci_enabled_from_application_settings.rb b/db/migrate/20151005162154_remove_ci_enabled_from_application_settings.rb index be6aa810bb5..07dba598749 100644 --- a/db/migrate/20151005162154_remove_ci_enabled_from_application_settings.rb +++ b/db/migrate/20151005162154_remove_ci_enabled_from_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveCiEnabledFromApplicationSettings < ActiveRecord::Migration def change remove_column :application_settings, :ci_enabled, :boolean, null: false, default: true diff --git a/db/migrate/20151007120511_namespaces_projects_path_lower_indexes.rb b/db/migrate/20151007120511_namespaces_projects_path_lower_indexes.rb index 7f6cd6d5a78..38208e59804 100644 --- a/db/migrate/20151007120511_namespaces_projects_path_lower_indexes.rb +++ b/db/migrate/20151007120511_namespaces_projects_path_lower_indexes.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class NamespacesProjectsPathLowerIndexes < ActiveRecord::Migration disable_ddl_transaction! diff --git a/db/migrate/20151008110232_add_users_lower_username_email_indexes.rb b/db/migrate/20151008110232_add_users_lower_username_email_indexes.rb index 2f2dc776785..6080d2a0fcf 100644 --- a/db/migrate/20151008110232_add_users_lower_username_email_indexes.rb +++ b/db/migrate/20151008110232_add_users_lower_username_email_indexes.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddUsersLowerUsernameEmailIndexes < ActiveRecord::Migration disable_ddl_transaction! diff --git a/db/migrate/20151008123042_add_type_and_description_to_builds.rb b/db/migrate/20151008123042_add_type_and_description_to_builds.rb index c72b1c611c6..a19eb6c6c49 100644 --- a/db/migrate/20151008123042_add_type_and_description_to_builds.rb +++ b/db/migrate/20151008123042_add_type_and_description_to_builds.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTypeAndDescriptionToBuilds < ActiveRecord::Migration def change add_column :ci_builds, :type, :string diff --git a/db/migrate/20151008130321_migrate_name_to_description_for_builds.rb b/db/migrate/20151008130321_migrate_name_to_description_for_builds.rb index f5c44babd84..306fa7092ea 100644 --- a/db/migrate/20151008130321_migrate_name_to_description_for_builds.rb +++ b/db/migrate/20151008130321_migrate_name_to_description_for_builds.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateNameToDescriptionForBuilds < ActiveRecord::Migration def change execute("UPDATE ci_builds SET type='Ci::Build' WHERE type IS NULL") diff --git a/db/migrate/20151008143519_add_admin_notification_email_setting.rb b/db/migrate/20151008143519_add_admin_notification_email_setting.rb index 0bb581efe2c..f48ec9aa4a6 100644 --- a/db/migrate/20151008143519_add_admin_notification_email_setting.rb +++ b/db/migrate/20151008143519_add_admin_notification_email_setting.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddAdminNotificationEmailSetting < ActiveRecord::Migration def change add_column :application_settings, :admin_notification_email, :string diff --git a/db/migrate/20151012173029_set_jira_service_api_url.rb b/db/migrate/20151012173029_set_jira_service_api_url.rb index 2af99e0db0b..2b6f61428c0 100644 --- a/db/migrate/20151012173029_set_jira_service_api_url.rb +++ b/db/migrate/20151012173029_set_jira_service_api_url.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class SetJiraServiceApiUrl < ActiveRecord::Migration # This migration can be performed online without errors, but some Jira API calls may be missed # when doing so because api_url is not yet available. diff --git a/db/migrate/20151013092124_add_artifacts_file_to_builds.rb b/db/migrate/20151013092124_add_artifacts_file_to_builds.rb index 5a299f7b26d..a54ac9d57a4 100644 --- a/db/migrate/20151013092124_add_artifacts_file_to_builds.rb +++ b/db/migrate/20151013092124_add_artifacts_file_to_builds.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddArtifactsFileToBuilds < ActiveRecord::Migration def change add_column :ci_builds, :artifacts_file, :text diff --git a/db/migrate/20151016131433_add_ci_projects_gl_project_id_index.rb b/db/migrate/20151016131433_add_ci_projects_gl_project_id_index.rb index 52a47aa9c54..eb3351eb767 100644 --- a/db/migrate/20151016131433_add_ci_projects_gl_project_id_index.rb +++ b/db/migrate/20151016131433_add_ci_projects_gl_project_id_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCiProjectsGlProjectIdIndex < ActiveRecord::Migration def change add_index :ci_commits, :gl_project_id diff --git a/db/migrate/20151016195451_add_ci_builds_and_projects_indexes.rb b/db/migrate/20151016195451_add_ci_builds_and_projects_indexes.rb index 7f1af1c7583..899e004d610 100644 --- a/db/migrate/20151016195451_add_ci_builds_and_projects_indexes.rb +++ b/db/migrate/20151016195451_add_ci_builds_and_projects_indexes.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCiBuildsAndProjectsIndexes < ActiveRecord::Migration def change add_index :ci_projects, :gitlab_id diff --git a/db/migrate/20151016195706_add_notes_line_code_index.rb b/db/migrate/20151016195706_add_notes_line_code_index.rb index aeeb1a759fa..3298630c1e8 100644 --- a/db/migrate/20151016195706_add_notes_line_code_index.rb +++ b/db/migrate/20151016195706_add_notes_line_code_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNotesLineCodeIndex < ActiveRecord::Migration def change add_index :notes, :line_code diff --git a/db/migrate/20151019111551_fix_build_tags.rb b/db/migrate/20151019111551_fix_build_tags.rb index 299a24b0a7c..8c05acfc190 100644 --- a/db/migrate/20151019111551_fix_build_tags.rb +++ b/db/migrate/20151019111551_fix_build_tags.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class FixBuildTags < ActiveRecord::Migration def up execute("UPDATE taggings SET taggable_type='CommitStatus' WHERE taggable_type='Ci::Build'") diff --git a/db/migrate/20151019111703_fail_build_without_names.rb b/db/migrate/20151019111703_fail_build_without_names.rb index dcdb5d1b25d..362e31eb435 100644 --- a/db/migrate/20151019111703_fail_build_without_names.rb +++ b/db/migrate/20151019111703_fail_build_without_names.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class FailBuildWithoutNames < ActiveRecord::Migration def up execute("UPDATE ci_builds SET status='failed' WHERE name IS NULL AND status='pending'") diff --git a/db/migrate/20151020145526_add_services_template_index.rb b/db/migrate/20151020145526_add_services_template_index.rb index 1b04f313565..14ff07bd726 100644 --- a/db/migrate/20151020145526_add_services_template_index.rb +++ b/db/migrate/20151020145526_add_services_template_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddServicesTemplateIndex < ActiveRecord::Migration def change add_index :services, :template diff --git a/db/migrate/20151020173516_ci_limits_to_mysql.rb b/db/migrate/20151020173516_ci_limits_to_mysql.rb index 9bb960082f5..5314611cbcd 100644 --- a/db/migrate/20151020173516_ci_limits_to_mysql.rb +++ b/db/migrate/20151020173516_ci_limits_to_mysql.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CiLimitsToMysql < ActiveRecord::Migration def change return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/ diff --git a/db/migrate/20151020173906_add_ci_builds_index_for_status.rb b/db/migrate/20151020173906_add_ci_builds_index_for_status.rb index c3f0e0606da..81a31e46ff8 100644 --- a/db/migrate/20151020173906_add_ci_builds_index_for_status.rb +++ b/db/migrate/20151020173906_add_ci_builds_index_for_status.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCiBuildsIndexForStatus < ActiveRecord::Migration def change add_index :ci_builds, [:commit_id, :status, :type] diff --git a/db/migrate/20151023112551_fail_build_with_empty_name.rb b/db/migrate/20151023112551_fail_build_with_empty_name.rb index 41c0f0649cd..0666dfeaef4 100644 --- a/db/migrate/20151023112551_fail_build_with_empty_name.rb +++ b/db/migrate/20151023112551_fail_build_with_empty_name.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class FailBuildWithEmptyName < ActiveRecord::Migration def up execute("UPDATE ci_builds SET status='failed' WHERE (name IS NULL OR name='') AND status='pending'") diff --git a/db/migrate/20151023144219_remove_satellites.rb b/db/migrate/20151023144219_remove_satellites.rb index e73f300028a..98fe0bd7d1d 100644 --- a/db/migrate/20151023144219_remove_satellites.rb +++ b/db/migrate/20151023144219_remove_satellites.rb @@ -1,3 +1,4 @@ +# rubocop:disable all require 'fileutils' class RemoveSatellites < ActiveRecord::Migration diff --git a/db/migrate/20151026182941_add_project_path_index.rb b/db/migrate/20151026182941_add_project_path_index.rb index a62fe199d70..117f65c1a1b 100644 --- a/db/migrate/20151026182941_add_project_path_index.rb +++ b/db/migrate/20151026182941_add_project_path_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddProjectPathIndex < ActiveRecord::Migration def up add_index :projects, :path diff --git a/db/migrate/20151028152939_add_merge_when_build_succeeds_to_merge_request.rb b/db/migrate/20151028152939_add_merge_when_build_succeeds_to_merge_request.rb index ceb52f0c222..4a989669464 100644 --- a/db/migrate/20151028152939_add_merge_when_build_succeeds_to_merge_request.rb +++ b/db/migrate/20151028152939_add_merge_when_build_succeeds_to_merge_request.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMergeWhenBuildSucceedsToMergeRequest < ActiveRecord::Migration def change add_column :merge_requests, :merge_params, :text diff --git a/db/migrate/20151103001141_add_public_to_group.rb b/db/migrate/20151103001141_add_public_to_group.rb index 635346300c2..ba1f7c27832 100644 --- a/db/migrate/20151103001141_add_public_to_group.rb +++ b/db/migrate/20151103001141_add_public_to_group.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPublicToGroup < ActiveRecord::Migration def change add_column :namespaces, :public, :boolean, default: false diff --git a/db/migrate/20151103133339_add_shared_runners_setting.rb b/db/migrate/20151103133339_add_shared_runners_setting.rb index 4231dfd5c2e..b5b34d4ca61 100644 --- a/db/migrate/20151103133339_add_shared_runners_setting.rb +++ b/db/migrate/20151103133339_add_shared_runners_setting.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddSharedRunnersSetting < ActiveRecord::Migration def up add_column :application_settings, :shared_runners_enabled, :boolean, default: true, null: false diff --git a/db/migrate/20151103134857_create_lfs_objects.rb b/db/migrate/20151103134857_create_lfs_objects.rb index 2d04c170a88..745b52e2b24 100644 --- a/db/migrate/20151103134857_create_lfs_objects.rb +++ b/db/migrate/20151103134857_create_lfs_objects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateLfsObjects < ActiveRecord::Migration def change create_table :lfs_objects do |t| diff --git a/db/migrate/20151103134958_create_lfs_objects_projects.rb b/db/migrate/20151103134958_create_lfs_objects_projects.rb index f3f58b931ec..3178e85b899 100644 --- a/db/migrate/20151103134958_create_lfs_objects_projects.rb +++ b/db/migrate/20151103134958_create_lfs_objects_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateLfsObjectsProjects < ActiveRecord::Migration def change create_table :lfs_objects_projects do |t| diff --git a/db/migrate/20151104105513_add_file_to_lfs_objects.rb b/db/migrate/20151104105513_add_file_to_lfs_objects.rb index 7c57f3f0df6..4e46ae8101c 100644 --- a/db/migrate/20151104105513_add_file_to_lfs_objects.rb +++ b/db/migrate/20151104105513_add_file_to_lfs_objects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddFileToLfsObjects < ActiveRecord::Migration def change add_column :lfs_objects, :file, :string diff --git a/db/migrate/20151105094515_create_releases.rb b/db/migrate/20151105094515_create_releases.rb index fe4608c6662..145b8db1486 100644 --- a/db/migrate/20151105094515_create_releases.rb +++ b/db/migrate/20151105094515_create_releases.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateReleases < ActiveRecord::Migration def change create_table :releases do |t| diff --git a/db/migrate/20151106000015_add_is_award_to_notes.rb b/db/migrate/20151106000015_add_is_award_to_notes.rb index 02b271637e9..b463d939b78 100644 --- a/db/migrate/20151106000015_add_is_award_to_notes.rb +++ b/db/migrate/20151106000015_add_is_award_to_notes.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIsAwardToNotes < ActiveRecord::Migration def change add_column :notes, :is_award, :boolean, default: false, null: false diff --git a/db/migrate/20151109100728_add_max_artifacts_size_to_application_settings.rb b/db/migrate/20151109100728_add_max_artifacts_size_to_application_settings.rb index 01d8c0f043e..25106ace7e9 100644 --- a/db/migrate/20151109100728_add_max_artifacts_size_to_application_settings.rb +++ b/db/migrate/20151109100728_add_max_artifacts_size_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMaxArtifactsSizeToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :max_artifacts_size, :integer, default: 100, null: false diff --git a/db/migrate/20151109134526_add_issues_state_index.rb b/db/migrate/20151109134526_add_issues_state_index.rb index 1c4d2e30171..7a9970e8591 100644 --- a/db/migrate/20151109134526_add_issues_state_index.rb +++ b/db/migrate/20151109134526_add_issues_state_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIssuesStateIndex < ActiveRecord::Migration def change add_index :issues, :state diff --git a/db/migrate/20151109134916_add_projects_visibility_level_index.rb b/db/migrate/20151109134916_add_projects_visibility_level_index.rb index 600b4bafd98..471db437b11 100644 --- a/db/migrate/20151109134916_add_projects_visibility_level_index.rb +++ b/db/migrate/20151109134916_add_projects_visibility_level_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddProjectsVisibilityLevelIndex < ActiveRecord::Migration def change add_index :projects, :visibility_level diff --git a/db/migrate/20151110125604_add_import_error_to_project.rb b/db/migrate/20151110125604_add_import_error_to_project.rb index 7fc990f8d0a..793358c305e 100644 --- a/db/migrate/20151110125604_add_import_error_to_project.rb +++ b/db/migrate/20151110125604_add_import_error_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddImportErrorToProject < ActiveRecord::Migration def change add_column :projects, :import_error, :text diff --git a/db/migrate/20151114113410_add_index_for_lfs_oid_and_size.rb b/db/migrate/20151114113410_add_index_for_lfs_oid_and_size.rb index d10f1f6e605..00a4c74ffbc 100644 --- a/db/migrate/20151114113410_add_index_for_lfs_oid_and_size.rb +++ b/db/migrate/20151114113410_add_index_for_lfs_oid_and_size.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexForLfsOidAndSize < ActiveRecord::Migration def change add_index :lfs_objects, :oid diff --git a/db/migrate/20151116144118_add_unique_for_lfs_oid_index.rb b/db/migrate/20151116144118_add_unique_for_lfs_oid_index.rb index 41b93da0a86..1f192544ea1 100644 --- a/db/migrate/20151116144118_add_unique_for_lfs_oid_index.rb +++ b/db/migrate/20151116144118_add_unique_for_lfs_oid_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddUniqueForLfsOidIndex < ActiveRecord::Migration def change remove_index :lfs_objects, :oid diff --git a/db/migrate/20151118162244_add_projects_public_index.rb b/db/migrate/20151118162244_add_projects_public_index.rb index fded70e3c0c..589f124c21e 100644 --- a/db/migrate/20151118162244_add_projects_public_index.rb +++ b/db/migrate/20151118162244_add_projects_public_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddProjectsPublicIndex < ActiveRecord::Migration def change add_index :namespaces, :public diff --git a/db/migrate/20151201203948_raise_hook_url_limit.rb b/db/migrate/20151201203948_raise_hook_url_limit.rb index 98a7fca6f6f..c490b7ace0f 100644 --- a/db/migrate/20151201203948_raise_hook_url_limit.rb +++ b/db/migrate/20151201203948_raise_hook_url_limit.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RaiseHookUrlLimit < ActiveRecord::Migration def change change_column :web_hooks, :url, :string, limit: 2000 diff --git a/db/migrate/20151203162133_add_hide_project_limit_to_users.rb b/db/migrate/20151203162133_add_hide_project_limit_to_users.rb index 6ffadfa1894..5dc6d8bf445 100644 --- a/db/migrate/20151203162133_add_hide_project_limit_to_users.rb +++ b/db/migrate/20151203162133_add_hide_project_limit_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddHideProjectLimitToUsers < ActiveRecord::Migration def change add_column :users, :hide_project_limit, :boolean, default: false diff --git a/db/migrate/20151203162134_add_build_events_to_services.rb b/db/migrate/20151203162134_add_build_events_to_services.rb index c5542cb864d..455882e5ec0 100644 --- a/db/migrate/20151203162134_add_build_events_to_services.rb +++ b/db/migrate/20151203162134_add_build_events_to_services.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddBuildEventsToServices < ActiveRecord::Migration def change add_column :services, :build_events, :boolean, default: false, null: false diff --git a/db/migrate/20151209144329_migrate_ci_web_hooks.rb b/db/migrate/20151209144329_migrate_ci_web_hooks.rb index d7e196e6763..cb1e556623a 100644 --- a/db/migrate/20151209144329_migrate_ci_web_hooks.rb +++ b/db/migrate/20151209144329_migrate_ci_web_hooks.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateCiWebHooks < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20151209145909_migrate_ci_emails.rb b/db/migrate/20151209145909_migrate_ci_emails.rb index 7f330a2cf0a..6b7a106814d 100644 --- a/db/migrate/20151209145909_migrate_ci_emails.rb +++ b/db/migrate/20151209145909_migrate_ci_emails.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateCiEmails < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20151210030143_add_unlock_token_to_user.rb b/db/migrate/20151210030143_add_unlock_token_to_user.rb index 0ea66ba65df..d23c648f782 100644 --- a/db/migrate/20151210030143_add_unlock_token_to_user.rb +++ b/db/migrate/20151210030143_add_unlock_token_to_user.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddUnlockTokenToUser < ActiveRecord::Migration def change add_column :users, :unlock_token, :string diff --git a/db/migrate/20151210072243_add_runners_registration_token_to_application_settings.rb b/db/migrate/20151210072243_add_runners_registration_token_to_application_settings.rb index 00f88180e46..92c7b5befd2 100644 --- a/db/migrate/20151210072243_add_runners_registration_token_to_application_settings.rb +++ b/db/migrate/20151210072243_add_runners_registration_token_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddRunnersRegistrationTokenToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :runners_registration_token, :string diff --git a/db/migrate/20151210125232_migrate_ci_slack_service.rb b/db/migrate/20151210125232_migrate_ci_slack_service.rb index f14efa3e95d..633d5148d97 100644 --- a/db/migrate/20151210125232_migrate_ci_slack_service.rb +++ b/db/migrate/20151210125232_migrate_ci_slack_service.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateCiSlackService < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb b/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb index b9e04323576..dae084ce180 100644 --- a/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb +++ b/db/migrate/20151210125927_migrate_ci_hip_chat_service.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateCiHipChatService < ActiveRecord::Migration include Gitlab::Database diff --git a/db/migrate/20151210125928_add_ci_to_project.rb b/db/migrate/20151210125928_add_ci_to_project.rb index 8c167f64a2b..a9ff49a3f7e 100644 --- a/db/migrate/20151210125928_add_ci_to_project.rb +++ b/db/migrate/20151210125928_add_ci_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCiToProject < ActiveRecord::Migration def change add_column :projects, :ci_id, :integer diff --git a/db/migrate/20151210125929_add_project_id_to_ci.rb b/db/migrate/20151210125929_add_project_id_to_ci.rb index 84273591fa2..b5de64b82ca 100644 --- a/db/migrate/20151210125929_add_project_id_to_ci.rb +++ b/db/migrate/20151210125929_add_project_id_to_ci.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddProjectIdToCi < ActiveRecord::Migration def change add_column :ci_builds, :gl_project_id, :integer diff --git a/db/migrate/20151210125930_migrate_ci_to_project.rb b/db/migrate/20151210125930_migrate_ci_to_project.rb index c32c7feb193..bb6d74ae212 100644 --- a/db/migrate/20151210125930_migrate_ci_to_project.rb +++ b/db/migrate/20151210125930_migrate_ci_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class MigrateCiToProject < ActiveRecord::Migration def up migrate_project_id_for_table('ci_runner_projects') diff --git a/db/migrate/20151210125931_add_index_to_ci_tables.rb b/db/migrate/20151210125931_add_index_to_ci_tables.rb index 5e129c9303d..d87d335cf6b 100644 --- a/db/migrate/20151210125931_add_index_to_ci_tables.rb +++ b/db/migrate/20151210125931_add_index_to_ci_tables.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexToCiTables < ActiveRecord::Migration def change add_index :ci_builds, :gl_project_id diff --git a/db/migrate/20151210125932_drop_null_for_ci_tables.rb b/db/migrate/20151210125932_drop_null_for_ci_tables.rb index c520c2ed56f..e1a0a964589 100644 --- a/db/migrate/20151210125932_drop_null_for_ci_tables.rb +++ b/db/migrate/20151210125932_drop_null_for_ci_tables.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class DropNullForCiTables < ActiveRecord::Migration def change remove_index :ci_variables, :project_id diff --git a/db/migrate/20151218154042_add_tfa_to_application_settings.rb b/db/migrate/20151218154042_add_tfa_to_application_settings.rb index dd95db775c5..afdaf76b917 100644 --- a/db/migrate/20151218154042_add_tfa_to_application_settings.rb +++ b/db/migrate/20151218154042_add_tfa_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTfaToApplicationSettings < ActiveRecord::Migration def change change_table :application_settings do |t| diff --git a/db/migrate/20151221234414_add_tfa_additional_fields.rb b/db/migrate/20151221234414_add_tfa_additional_fields.rb index c16df47932f..c3e4aaa606a 100644 --- a/db/migrate/20151221234414_add_tfa_additional_fields.rb +++ b/db/migrate/20151221234414_add_tfa_additional_fields.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTfaAdditionalFields < ActiveRecord::Migration def change change_table :users do |t| diff --git a/db/migrate/20151224123230_rename_emojis.rb b/db/migrate/20151224123230_rename_emojis.rb index 62d921dfdcc..2c24f3beeea 100644 --- a/db/migrate/20151224123230_rename_emojis.rb +++ b/db/migrate/20151224123230_rename_emojis.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # Migration type: online without errors (works on previous version and new one) class RenameEmojis < ActiveRecord::Migration def up diff --git a/db/migrate/20151228111122_remove_public_from_namespace.rb b/db/migrate/20151228111122_remove_public_from_namespace.rb index f4c848bbf47..bcb322d9cba 100644 --- a/db/migrate/20151228111122_remove_public_from_namespace.rb +++ b/db/migrate/20151228111122_remove_public_from_namespace.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # Migration type: online class RemovePublicFromNamespace < ActiveRecord::Migration def change diff --git a/db/migrate/20151228150906_influxdb_settings.rb b/db/migrate/20151228150906_influxdb_settings.rb index 3012bd52cfd..2e080a02e6a 100644 --- a/db/migrate/20151228150906_influxdb_settings.rb +++ b/db/migrate/20151228150906_influxdb_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class InfluxdbSettings < ActiveRecord::Migration def change add_column :application_settings, :metrics_enabled, :boolean, default: false diff --git a/db/migrate/20151228175719_add_recaptcha_to_application_settings.rb b/db/migrate/20151228175719_add_recaptcha_to_application_settings.rb index 259fd0248d2..e0dd19b2b06 100644 --- a/db/migrate/20151228175719_add_recaptcha_to_application_settings.rb +++ b/db/migrate/20151228175719_add_recaptcha_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddRecaptchaToApplicationSettings < ActiveRecord::Migration def change change_table :application_settings do |t| diff --git a/db/migrate/20151229102248_influxdb_udp_port_setting.rb b/db/migrate/20151229102248_influxdb_udp_port_setting.rb index ae0499f936d..3e1bfd43899 100644 --- a/db/migrate/20151229102248_influxdb_udp_port_setting.rb +++ b/db/migrate/20151229102248_influxdb_udp_port_setting.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class InfluxdbUdpPortSetting < ActiveRecord::Migration def change add_column :application_settings, :metrics_port, :integer, default: 8089 diff --git a/db/migrate/20151229112614_influxdb_remote_database_setting.rb b/db/migrate/20151229112614_influxdb_remote_database_setting.rb index f0e1ee1e7a7..d2ac906ead3 100644 --- a/db/migrate/20151229112614_influxdb_remote_database_setting.rb +++ b/db/migrate/20151229112614_influxdb_remote_database_setting.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class InfluxdbRemoteDatabaseSetting < ActiveRecord::Migration def change remove_column :application_settings, :metrics_database diff --git a/db/migrate/20151230132518_add_artifacts_metadata_to_ci_build.rb b/db/migrate/20151230132518_add_artifacts_metadata_to_ci_build.rb index 6c282fc5039..4fcca06d905 100644 --- a/db/migrate/20151230132518_add_artifacts_metadata_to_ci_build.rb +++ b/db/migrate/20151230132518_add_artifacts_metadata_to_ci_build.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddArtifactsMetadataToCiBuild < ActiveRecord::Migration def change add_column :ci_builds, :artifacts_metadata, :text diff --git a/db/migrate/20151231152326_add_akismet_to_application_settings.rb b/db/migrate/20151231152326_add_akismet_to_application_settings.rb index 3f52c758f9a..7b0fab6f557 100644 --- a/db/migrate/20151231152326_add_akismet_to_application_settings.rb +++ b/db/migrate/20151231152326_add_akismet_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddAkismetToApplicationSettings < ActiveRecord::Migration def change change_table :application_settings do |t| diff --git a/db/migrate/20151231202530_remove_alert_type_from_broadcast_messages.rb b/db/migrate/20151231202530_remove_alert_type_from_broadcast_messages.rb index 78fdfeaf5cf..0bdd639eb21 100644 --- a/db/migrate/20151231202530_remove_alert_type_from_broadcast_messages.rb +++ b/db/migrate/20151231202530_remove_alert_type_from_broadcast_messages.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveAlertTypeFromBroadcastMessages < ActiveRecord::Migration def change remove_column :broadcast_messages, :alert_type, :integer diff --git a/db/migrate/20160106162223_add_index_milestones_title.rb b/db/migrate/20160106162223_add_index_milestones_title.rb index 767885e2aac..9b9b6445a08 100644 --- a/db/migrate/20160106162223_add_index_milestones_title.rb +++ b/db/migrate/20160106162223_add_index_milestones_title.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexMilestonesTitle < ActiveRecord::Migration def change add_index :milestones, :title diff --git a/db/migrate/20160106164438_remove_influxdb_credentials.rb b/db/migrate/20160106164438_remove_influxdb_credentials.rb index 47e74400b97..987d75d6fda 100644 --- a/db/migrate/20160106164438_remove_influxdb_credentials.rb +++ b/db/migrate/20160106164438_remove_influxdb_credentials.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveInfluxdbCredentials < ActiveRecord::Migration def change remove_column :application_settings, :metrics_username, :string diff --git a/db/migrate/20160109054846_create_spam_logs.rb b/db/migrate/20160109054846_create_spam_logs.rb index f12fe9f8f78..f7103276639 100644 --- a/db/migrate/20160109054846_create_spam_logs.rb +++ b/db/migrate/20160109054846_create_spam_logs.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateSpamLogs < ActiveRecord::Migration def change create_table :spam_logs do |t| diff --git a/db/migrate/20160113111034_add_metrics_sample_interval.rb b/db/migrate/20160113111034_add_metrics_sample_interval.rb index b741f5d2c75..c1041da818c 100644 --- a/db/migrate/20160113111034_add_metrics_sample_interval.rb +++ b/db/migrate/20160113111034_add_metrics_sample_interval.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMetricsSampleInterval < ActiveRecord::Migration def change add_column :application_settings, :metrics_sample_interval, :integer, diff --git a/db/migrate/20160118155830_add_sentry_to_application_settings.rb b/db/migrate/20160118155830_add_sentry_to_application_settings.rb index fa7ff9d9228..a6f715263ef 100644 --- a/db/migrate/20160118155830_add_sentry_to_application_settings.rb +++ b/db/migrate/20160118155830_add_sentry_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddSentryToApplicationSettings < ActiveRecord::Migration def change change_table :application_settings do |t| diff --git a/db/migrate/20160118232755_add_ip_blocking_settings_to_application_settings.rb b/db/migrate/20160118232755_add_ip_blocking_settings_to_application_settings.rb index 26606b10b54..19ea40b5547 100644 --- a/db/migrate/20160118232755_add_ip_blocking_settings_to_application_settings.rb +++ b/db/migrate/20160118232755_add_ip_blocking_settings_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIpBlockingSettingsToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :ip_blocking_enabled, :boolean, default: false diff --git a/db/migrate/20160119111158_add_services_category.rb b/db/migrate/20160119111158_add_services_category.rb index a9110a8418b..f77484b2f96 100644 --- a/db/migrate/20160119111158_add_services_category.rb +++ b/db/migrate/20160119111158_add_services_category.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddServicesCategory < ActiveRecord::Migration def up add_column :services, :category, :string, default: 'common', null: false diff --git a/db/migrate/20160119112418_add_services_default.rb b/db/migrate/20160119112418_add_services_default.rb index 69a42d7b873..7fa531899fe 100644 --- a/db/migrate/20160119112418_add_services_default.rb +++ b/db/migrate/20160119112418_add_services_default.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddServicesDefault < ActiveRecord::Migration def up add_column :services, :default, :boolean, default: false diff --git a/db/migrate/20160119145451_add_ldap_email_to_users.rb b/db/migrate/20160119145451_add_ldap_email_to_users.rb index 654d31ab15a..5b2b0bd31ca 100644 --- a/db/migrate/20160119145451_add_ldap_email_to_users.rb +++ b/db/migrate/20160119145451_add_ldap_email_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddLdapEmailToUsers < ActiveRecord::Migration def up add_column :users, :ldap_email, :boolean, default: false, null: false diff --git a/db/migrate/20160120172143_add_base_commit_sha_to_merge_request_diffs.rb b/db/migrate/20160120172143_add_base_commit_sha_to_merge_request_diffs.rb index d6c6aa4a4e8..3837208f81e 100644 --- a/db/migrate/20160120172143_add_base_commit_sha_to_merge_request_diffs.rb +++ b/db/migrate/20160120172143_add_base_commit_sha_to_merge_request_diffs.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddBaseCommitShaToMergeRequestDiffs < ActiveRecord::Migration def change add_column :merge_request_diffs, :base_commit_sha, :string diff --git a/db/migrate/20160121030729_add_email_author_in_body_to_application_settings.rb b/db/migrate/20160121030729_add_email_author_in_body_to_application_settings.rb index d50791410f9..9a2570ae544 100644 --- a/db/migrate/20160121030729_add_email_author_in_body_to_application_settings.rb +++ b/db/migrate/20160121030729_add_email_author_in_body_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddEmailAuthorInBodyToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :email_author_in_body, :boolean, default: false diff --git a/db/migrate/20160122185421_add_pending_delete_to_project.rb b/db/migrate/20160122185421_add_pending_delete_to_project.rb index 046a5d8fc32..61db852843f 100644 --- a/db/migrate/20160122185421_add_pending_delete_to_project.rb +++ b/db/migrate/20160122185421_add_pending_delete_to_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPendingDeleteToProject < ActiveRecord::Migration def change add_column :projects, :pending_delete, :boolean, default: false diff --git a/db/migrate/20160128212447_remove_ip_blocking_settings_from_application_settings.rb b/db/migrate/20160128212447_remove_ip_blocking_settings_from_application_settings.rb index 41821cdcc42..60ecda998dd 100644 --- a/db/migrate/20160128212447_remove_ip_blocking_settings_from_application_settings.rb +++ b/db/migrate/20160128212447_remove_ip_blocking_settings_from_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveIpBlockingSettingsFromApplicationSettings < ActiveRecord::Migration def change remove_column :application_settings, :ip_blocking_enabled, :boolean, default: false diff --git a/db/migrate/20160128233227_change_lfs_objects_size_column.rb b/db/migrate/20160128233227_change_lfs_objects_size_column.rb index e7fd1f71777..645c0cdb192 100644 --- a/db/migrate/20160128233227_change_lfs_objects_size_column.rb +++ b/db/migrate/20160128233227_change_lfs_objects_size_column.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ChangeLfsObjectsSizeColumn < ActiveRecord::Migration def change change_column :lfs_objects, :size, :integer, limit: 8 diff --git a/db/migrate/20160129135155_remove_dot_atom_path_ending_of_projects.rb b/db/migrate/20160129135155_remove_dot_atom_path_ending_of_projects.rb index d3ea956952e..b10c0602e24 100644 --- a/db/migrate/20160129135155_remove_dot_atom_path_ending_of_projects.rb +++ b/db/migrate/20160129135155_remove_dot_atom_path_ending_of_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveDotAtomPathEndingOfProjects < ActiveRecord::Migration include Gitlab::ShellAdapter diff --git a/db/migrate/20160129155512_add_merge_commit_sha_to_merge_requests.rb b/db/migrate/20160129155512_add_merge_commit_sha_to_merge_requests.rb index f0d94226514..332b5a756e8 100644 --- a/db/migrate/20160129155512_add_merge_commit_sha_to_merge_requests.rb +++ b/db/migrate/20160129155512_add_merge_commit_sha_to_merge_requests.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMergeCommitShaToMergeRequests < ActiveRecord::Migration def change add_column :merge_requests, :merge_commit_sha, :string diff --git a/db/migrate/20160202091601_add_erasable_to_ci_build.rb b/db/migrate/20160202091601_add_erasable_to_ci_build.rb index f9912f2274e..767ae160d08 100644 --- a/db/migrate/20160202091601_add_erasable_to_ci_build.rb +++ b/db/migrate/20160202091601_add_erasable_to_ci_build.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddErasableToCiBuild < ActiveRecord::Migration def change add_reference :ci_builds, :erased_by, references: :users, index: true diff --git a/db/migrate/20160202164642_add_allow_guest_to_access_builds_project.rb b/db/migrate/20160202164642_add_allow_guest_to_access_builds_project.rb index 793984343b4..2c5cb307fad 100644 --- a/db/migrate/20160202164642_add_allow_guest_to_access_builds_project.rb +++ b/db/migrate/20160202164642_add_allow_guest_to_access_builds_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddAllowGuestToAccessBuildsProject < ActiveRecord::Migration def change add_column :projects, :public_builds, :boolean, default: true, null: false diff --git a/db/migrate/20160204144558_add_real_size_to_merge_request_diffs.rb b/db/migrate/20160204144558_add_real_size_to_merge_request_diffs.rb index f996ae74dca..11b6ff31000 100644 --- a/db/migrate/20160204144558_add_real_size_to_merge_request_diffs.rb +++ b/db/migrate/20160204144558_add_real_size_to_merge_request_diffs.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddRealSizeToMergeRequestDiffs < ActiveRecord::Migration def change add_column :merge_request_diffs, :real_size, :string diff --git a/db/migrate/20160209130428_add_index_to_snippet.rb b/db/migrate/20160209130428_add_index_to_snippet.rb index 95d5719be59..4d17c3a2917 100644 --- a/db/migrate/20160209130428_add_index_to_snippet.rb +++ b/db/migrate/20160209130428_add_index_to_snippet.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexToSnippet < ActiveRecord::Migration def change add_index :snippets, :updated_at diff --git a/db/migrate/20160212123307_create_tasks.rb b/db/migrate/20160212123307_create_tasks.rb index c3f6f3abc26..20573b01351 100644 --- a/db/migrate/20160212123307_create_tasks.rb +++ b/db/migrate/20160212123307_create_tasks.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateTasks < ActiveRecord::Migration def change create_table :tasks do |t| diff --git a/db/migrate/20160217100506_add_description_to_label.rb b/db/migrate/20160217100506_add_description_to_label.rb index eed6d1f236a..af5af167470 100644 --- a/db/migrate/20160217100506_add_description_to_label.rb +++ b/db/migrate/20160217100506_add_description_to_label.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDescriptionToLabel < ActiveRecord::Migration def change add_column :labels, :description, :string diff --git a/db/migrate/20160217174422_add_note_to_tasks.rb b/db/migrate/20160217174422_add_note_to_tasks.rb index da5cb2e05db..a9a2b77e423 100644 --- a/db/migrate/20160217174422_add_note_to_tasks.rb +++ b/db/migrate/20160217174422_add_note_to_tasks.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNoteToTasks < ActiveRecord::Migration def change add_reference :tasks, :note, index: true diff --git a/db/migrate/20160220123949_rename_tasks_to_todos.rb b/db/migrate/20160220123949_rename_tasks_to_todos.rb index 30c10d27146..f16b37537f3 100644 --- a/db/migrate/20160220123949_rename_tasks_to_todos.rb +++ b/db/migrate/20160220123949_rename_tasks_to_todos.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RenameTasksToTodos < ActiveRecord::Migration def change rename_table :tasks, :todos diff --git a/db/migrate/20160222153918_create_appearances_ce.rb b/db/migrate/20160222153918_create_appearances_ce.rb index bec66bcc71e..b2d5949b23f 100644 --- a/db/migrate/20160222153918_create_appearances_ce.rb +++ b/db/migrate/20160222153918_create_appearances_ce.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateAppearancesCe < ActiveRecord::Migration def change unless table_exists?(:appearances) diff --git a/db/migrate/20160223192159_add_confidential_to_issues.rb b/db/migrate/20160223192159_add_confidential_to_issues.rb index e9d47fd589a..5b99ce30e9f 100644 --- a/db/migrate/20160223192159_add_confidential_to_issues.rb +++ b/db/migrate/20160223192159_add_confidential_to_issues.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddConfidentialToIssues < ActiveRecord::Migration def change add_column :issues, :confidential, :boolean, default: false diff --git a/db/migrate/20160225090018_add_delete_at_to_issues.rb b/db/migrate/20160225090018_add_delete_at_to_issues.rb index 3ddbef92978..139f911e1c9 100644 --- a/db/migrate/20160225090018_add_delete_at_to_issues.rb +++ b/db/migrate/20160225090018_add_delete_at_to_issues.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDeleteAtToIssues < ActiveRecord::Migration def change add_column :issues, :deleted_at, :datetime diff --git a/db/migrate/20160225101956_add_delete_at_to_merge_requests.rb b/db/migrate/20160225101956_add_delete_at_to_merge_requests.rb index 9d09105f17d..4ca3f0dcdc5 100644 --- a/db/migrate/20160225101956_add_delete_at_to_merge_requests.rb +++ b/db/migrate/20160225101956_add_delete_at_to_merge_requests.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDeleteAtToMergeRequests < ActiveRecord::Migration def change add_column :merge_requests, :deleted_at, :datetime diff --git a/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb b/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb index d7b00e3d6ed..375e389e07a 100644 --- a/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb +++ b/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTrigramIndexesForSearching < ActiveRecord::Migration disable_ddl_transaction! diff --git a/db/migrate/20160227120001_add_event_field_for_web_hook.rb b/db/migrate/20160227120001_add_event_field_for_web_hook.rb index 65f2a47bb3c..89910893ee1 100644 --- a/db/migrate/20160227120001_add_event_field_for_web_hook.rb +++ b/db/migrate/20160227120001_add_event_field_for_web_hook.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddEventFieldForWebHook < ActiveRecord::Migration def change add_column :web_hooks, :wiki_page_events, :boolean, default: false, null: false diff --git a/db/migrate/20160227120047_add_event_to_services.rb b/db/migrate/20160227120047_add_event_to_services.rb index f5040d770de..fe7c54ca4eb 100644 --- a/db/migrate/20160227120047_add_event_to_services.rb +++ b/db/migrate/20160227120047_add_event_to_services.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddEventToServices < ActiveRecord::Migration def change add_column :services, :wiki_page_events, :boolean, default: true diff --git a/db/migrate/20160229193553_add_main_language_to_repository.rb b/db/migrate/20160229193553_add_main_language_to_repository.rb index b5446c6a447..ad5167b4c93 100644 --- a/db/migrate/20160229193553_add_main_language_to_repository.rb +++ b/db/migrate/20160229193553_add_main_language_to_repository.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMainLanguageToRepository < ActiveRecord::Migration def change add_column :projects, :main_language, :string diff --git a/db/migrate/20160301124843_add_visibility_level_to_groups.rb b/db/migrate/20160301124843_add_visibility_level_to_groups.rb index d1b921bb208..a874e6758dd 100644 --- a/db/migrate/20160301124843_add_visibility_level_to_groups.rb +++ b/db/migrate/20160301124843_add_visibility_level_to_groups.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddVisibilityLevelToGroups < ActiveRecord::Migration def up add_column :namespaces, :visibility_level, :integer, null: false, default: Gitlab::VisibilityLevel::PUBLIC diff --git a/db/migrate/20160302151724_add_import_credentials_to_project_import_data.rb b/db/migrate/20160302151724_add_import_credentials_to_project_import_data.rb index ffcd64266e3..1f400566f9f 100644 --- a/db/migrate/20160302151724_add_import_credentials_to_project_import_data.rb +++ b/db/migrate/20160302151724_add_import_credentials_to_project_import_data.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddImportCredentialsToProjectImportData < ActiveRecord::Migration def change add_column :project_import_data, :encrypted_credentials, :text diff --git a/db/migrate/20160302152808_remove_wrong_import_url_from_projects.rb b/db/migrate/20160302152808_remove_wrong_import_url_from_projects.rb index 6aed0fe03d2..ac7eac0ea7c 100644 --- a/db/migrate/20160302152808_remove_wrong_import_url_from_projects.rb +++ b/db/migrate/20160302152808_remove_wrong_import_url_from_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # Loops through old importer projects that kept a token/password in the import URL # and encrypts the credentials into a separate field in project#import_data # #down method not supported diff --git a/db/migrate/20160305220806_remove_expires_at_from_snippets.rb b/db/migrate/20160305220806_remove_expires_at_from_snippets.rb index fc12b5b09e6..cac78703bc2 100644 --- a/db/migrate/20160305220806_remove_expires_at_from_snippets.rb +++ b/db/migrate/20160305220806_remove_expires_at_from_snippets.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveExpiresAtFromSnippets < ActiveRecord::Migration def change remove_column :snippets, :expires_at, :datetime diff --git a/db/migrate/20160307221555_disallow_blank_line_code_on_note.rb b/db/migrate/20160307221555_disallow_blank_line_code_on_note.rb index 49e787d9a9a..10f2b8cc56a 100644 --- a/db/migrate/20160307221555_disallow_blank_line_code_on_note.rb +++ b/db/migrate/20160307221555_disallow_blank_line_code_on_note.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class DisallowBlankLineCodeOnNote < ActiveRecord::Migration def up execute("UPDATE notes SET line_code = NULL WHERE line_code = ''") diff --git a/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb b/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb index 72b862d67d2..92c0a1e088e 100644 --- a/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb +++ b/db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # Create visibility level field on DB # Sets default_visibility_level to value on settings if not restricted # If value is restricted takes higher visibility level allowed diff --git a/db/migrate/20160309140734_fix_todos.rb b/db/migrate/20160309140734_fix_todos.rb index ebe0fc82305..94fe1e4fdc3 100644 --- a/db/migrate/20160309140734_fix_todos.rb +++ b/db/migrate/20160309140734_fix_todos.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class FixTodos < ActiveRecord::Migration def up execute <<-SQL diff --git a/db/migrate/20160310124959_add_due_date_to_issues.rb b/db/migrate/20160310124959_add_due_date_to_issues.rb index ec08bd9fdfa..a4eb6aaee63 100644 --- a/db/migrate/20160310124959_add_due_date_to_issues.rb +++ b/db/migrate/20160310124959_add_due_date_to_issues.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDueDateToIssues < ActiveRecord::Migration def change add_column :issues, :due_date, :date diff --git a/db/migrate/20160310185910_add_external_flag_to_users.rb b/db/migrate/20160310185910_add_external_flag_to_users.rb index 54937f1eb71..209496dc786 100644 --- a/db/migrate/20160310185910_add_external_flag_to_users.rb +++ b/db/migrate/20160310185910_add_external_flag_to_users.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddExternalFlagToUsers < ActiveRecord::Migration def change add_column :users, :external, :boolean, default: false diff --git a/db/migrate/20160314094147_add_priority_to_label.rb b/db/migrate/20160314094147_add_priority_to_label.rb index 8ddf7782972..7fb23cba4c9 100644 --- a/db/migrate/20160314094147_add_priority_to_label.rb +++ b/db/migrate/20160314094147_add_priority_to_label.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddPriorityToLabel < ActiveRecord::Migration def change add_column :labels, :priority, :integer diff --git a/db/migrate/20160314143402_projects_add_pushes_since_gc.rb b/db/migrate/20160314143402_projects_add_pushes_since_gc.rb index 5d30a38bc99..9f8ffe073a3 100644 --- a/db/migrate/20160314143402_projects_add_pushes_since_gc.rb +++ b/db/migrate/20160314143402_projects_add_pushes_since_gc.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ProjectsAddPushesSinceGc < ActiveRecord::Migration def change add_column :projects, :pushes_since_gc, :integer, default: 0 diff --git a/db/migrate/20160315135439_project_add_repository_check.rb b/db/migrate/20160315135439_project_add_repository_check.rb index 8687d5d6296..8fe649246c7 100644 --- a/db/migrate/20160315135439_project_add_repository_check.rb +++ b/db/migrate/20160315135439_project_add_repository_check.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ProjectAddRepositoryCheck < ActiveRecord::Migration def change add_column :projects, :last_repository_check_failed, :boolean diff --git a/db/migrate/20160316123110_ci_runners_token_index.rb b/db/migrate/20160316123110_ci_runners_token_index.rb index 67bf5b4f978..ff3d36d68ee 100644 --- a/db/migrate/20160316123110_ci_runners_token_index.rb +++ b/db/migrate/20160316123110_ci_runners_token_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CiRunnersTokenIndex < ActiveRecord::Migration disable_ddl_transaction! diff --git a/db/migrate/20160316192622_change_target_id_to_null_on_todos.rb b/db/migrate/20160316192622_change_target_id_to_null_on_todos.rb index 6871b3920df..65e0e61c78f 100644 --- a/db/migrate/20160316192622_change_target_id_to_null_on_todos.rb +++ b/db/migrate/20160316192622_change_target_id_to_null_on_todos.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ChangeTargetIdToNullOnTodos < ActiveRecord::Migration def change change_column_null :todos, :target_id, true diff --git a/db/migrate/20160316204731_add_commit_id_to_todos.rb b/db/migrate/20160316204731_add_commit_id_to_todos.rb index ae19fdd1abd..d79858fc920 100644 --- a/db/migrate/20160316204731_add_commit_id_to_todos.rb +++ b/db/migrate/20160316204731_add_commit_id_to_todos.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCommitIdToTodos < ActiveRecord::Migration def change add_column :todos, :commit_id, :string diff --git a/db/migrate/20160317092222_add_moved_to_to_issue.rb b/db/migrate/20160317092222_add_moved_to_to_issue.rb index 461e7fb3a9b..9dde668ddff 100644 --- a/db/migrate/20160317092222_add_moved_to_to_issue.rb +++ b/db/migrate/20160317092222_add_moved_to_to_issue.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMovedToToIssue < ActiveRecord::Migration def change add_reference :issues, :moved_to, references: :issues diff --git a/db/migrate/20160320204112_index_namespaces_on_visibility_level.rb b/db/migrate/20160320204112_index_namespaces_on_visibility_level.rb index 370b339d45c..07ae7c95477 100644 --- a/db/migrate/20160320204112_index_namespaces_on_visibility_level.rb +++ b/db/migrate/20160320204112_index_namespaces_on_visibility_level.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class IndexNamespacesOnVisibilityLevel < ActiveRecord::Migration def change unless index_exists?(:namespaces, :visibility_level) diff --git a/db/migrate/20160324020319_remove_todos_for_deleted_issues.rb b/db/migrate/20160324020319_remove_todos_for_deleted_issues.rb index 1fff9759d1e..a9a851cfe63 100644 --- a/db/migrate/20160324020319_remove_todos_for_deleted_issues.rb +++ b/db/migrate/20160324020319_remove_todos_for_deleted_issues.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveTodosForDeletedIssues < ActiveRecord::Migration def up execute <<-SQL diff --git a/db/migrate/20160328112808_create_notification_settings.rb b/db/migrate/20160328112808_create_notification_settings.rb index 4755da8b806..7d77e8004ba 100644 --- a/db/migrate/20160328112808_create_notification_settings.rb +++ b/db/migrate/20160328112808_create_notification_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateNotificationSettings < ActiveRecord::Migration def change create_table :notification_settings do |t| diff --git a/db/migrate/20160328115649_migrate_new_notification_setting.rb b/db/migrate/20160328115649_migrate_new_notification_setting.rb index 3c81b2c37bf..eb6b7d07219 100644 --- a/db/migrate/20160328115649_migrate_new_notification_setting.rb +++ b/db/migrate/20160328115649_migrate_new_notification_setting.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # This migration will create one row of NotificationSetting for each Member row # It can take long time on big instances. # diff --git a/db/migrate/20160328121138_add_notification_setting_index.rb b/db/migrate/20160328121138_add_notification_setting_index.rb index 8aebce0244d..667270d6b04 100644 --- a/db/migrate/20160328121138_add_notification_setting_index.rb +++ b/db/migrate/20160328121138_add_notification_setting_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddNotificationSettingIndex < ActiveRecord::Migration def change add_index :notification_settings, :user_id diff --git a/db/migrate/20160329144452_add_index_on_pending_delete_projects.rb b/db/migrate/20160329144452_add_index_on_pending_delete_projects.rb index 275554e736e..a3df8fb4e2e 100644 --- a/db/migrate/20160329144452_add_index_on_pending_delete_projects.rb +++ b/db/migrate/20160329144452_add_index_on_pending_delete_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexOnPendingDeleteProjects < ActiveRecord::Migration def change add_index :projects, :pending_delete diff --git a/db/migrate/20160331133914_remove_todos_for_deleted_merge_requests.rb b/db/migrate/20160331133914_remove_todos_for_deleted_merge_requests.rb index 54cea964ff2..b15af79b9b5 100644 --- a/db/migrate/20160331133914_remove_todos_for_deleted_merge_requests.rb +++ b/db/migrate/20160331133914_remove_todos_for_deleted_merge_requests.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveTodosForDeletedMergeRequests < ActiveRecord::Migration def up execute <<-SQL diff --git a/db/migrate/20160331223143_remove_twitter_sharing_enabled_from_application_settings.rb b/db/migrate/20160331223143_remove_twitter_sharing_enabled_from_application_settings.rb index 0d736e323b6..dec80497fb3 100644 --- a/db/migrate/20160331223143_remove_twitter_sharing_enabled_from_application_settings.rb +++ b/db/migrate/20160331223143_remove_twitter_sharing_enabled_from_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveTwitterSharingEnabledFromApplicationSettings < ActiveRecord::Migration def change remove_column :application_settings, :twitter_sharing_enabled, :boolean diff --git a/db/migrate/20160407120251_add_images_enabled_for_project.rb b/db/migrate/20160407120251_add_images_enabled_for_project.rb index 47f0ca8e8de..fcffc98b47a 100644 --- a/db/migrate/20160407120251_add_images_enabled_for_project.rb +++ b/db/migrate/20160407120251_add_images_enabled_for_project.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddImagesEnabledForProject < ActiveRecord::Migration def change add_column :projects, :container_registry_enabled, :boolean diff --git a/db/migrate/20160412140240_add_repository_checks_enabled_setting.rb b/db/migrate/20160412140240_add_repository_checks_enabled_setting.rb index ebfa4bcbc7b..920d4d41110 100644 --- a/db/migrate/20160412140240_add_repository_checks_enabled_setting.rb +++ b/db/migrate/20160412140240_add_repository_checks_enabled_setting.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddRepositoryChecksEnabledSetting < ActiveRecord::Migration def change add_column :application_settings, :repository_checks_enabled, :boolean, default: true diff --git a/db/migrate/20160412173416_add_fields_to_ci_commit.rb b/db/migrate/20160412173416_add_fields_to_ci_commit.rb index 125956a3ddd..00162af5cda 100644 --- a/db/migrate/20160412173416_add_fields_to_ci_commit.rb +++ b/db/migrate/20160412173416_add_fields_to_ci_commit.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddFieldsToCiCommit < ActiveRecord::Migration def change add_column :ci_commits, :status, :string diff --git a/db/migrate/20160412173417_update_ci_commit.rb b/db/migrate/20160412173417_update_ci_commit.rb index fd92444dbac..858faeb060e 100644 --- a/db/migrate/20160412173417_update_ci_commit.rb +++ b/db/migrate/20160412173417_update_ci_commit.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class UpdateCiCommit < ActiveRecord::Migration # This migration can be run online, but needs to be executed for the second time after restarting Unicorn workers # Otherwise Offline migration should be used. diff --git a/db/migrate/20160412173418_add_ci_commit_indexes.rb b/db/migrate/20160412173418_add_ci_commit_indexes.rb index 603d4a41610..414f1f8279f 100644 --- a/db/migrate/20160412173418_add_ci_commit_indexes.rb +++ b/db/migrate/20160412173418_add_ci_commit_indexes.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddCiCommitIndexes < ActiveRecord::Migration disable_ddl_transaction! diff --git a/db/migrate/20160413115152_add_token_to_web_hooks.rb b/db/migrate/20160413115152_add_token_to_web_hooks.rb index f04225068cd..628b1d51b30 100644 --- a/db/migrate/20160413115152_add_token_to_web_hooks.rb +++ b/db/migrate/20160413115152_add_token_to_web_hooks.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTokenToWebHooks < ActiveRecord::Migration def change add_column :web_hooks, :token, :string diff --git a/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb b/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb index d493044c67b..b53b9bc6c3d 100644 --- a/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb +++ b/db/migrate/20160415133440_add_shared_runners_text_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddSharedRunnersTextToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :shared_runners_text, :text diff --git a/db/migrate/20160416180807_add_award_emoji.rb b/db/migrate/20160416180807_add_award_emoji.rb index 2ead181921b..a3bee9b1bc6 100644 --- a/db/migrate/20160416180807_add_award_emoji.rb +++ b/db/migrate/20160416180807_add_award_emoji.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddAwardEmoji < ActiveRecord::Migration def change create_table :award_emoji do |t| diff --git a/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb b/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb index 073bbc0fc2a..c226bc11f6c 100644 --- a/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb +++ b/db/migrate/20160416182152_convert_award_note_to_emoji_award.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class ConvertAwardNoteToEmojiAward < ActiveRecord::Migration def change def up diff --git a/db/migrate/20160416190505_remove_note_is_award.rb b/db/migrate/20160416190505_remove_note_is_award.rb index da16372a297..dd24917feb9 100644 --- a/db/migrate/20160416190505_remove_note_is_award.rb +++ b/db/migrate/20160416190505_remove_note_is_award.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveNoteIsAward < ActiveRecord::Migration def change remove_column :notes, :is_award, :boolean diff --git a/db/migrate/20160419120017_add_metrics_packet_size.rb b/db/migrate/20160419120017_add_metrics_packet_size.rb index 78c163d62ac..c759427c590 100644 --- a/db/migrate/20160419120017_add_metrics_packet_size.rb +++ b/db/migrate/20160419120017_add_metrics_packet_size.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddMetricsPacketSize < ActiveRecord::Migration def change add_column :application_settings, :metrics_packet_size, :integer, default: 1 diff --git a/db/migrate/20160421130527_disable_repository_checks.rb b/db/migrate/20160421130527_disable_repository_checks.rb index 808a4b93c7c..7e65ddc45e7 100644 --- a/db/migrate/20160421130527_disable_repository_checks.rb +++ b/db/migrate/20160421130527_disable_repository_checks.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class DisableRepositoryChecks < ActiveRecord::Migration def up change_column_default :application_settings, :repository_checks_enabled, false diff --git a/db/migrate/20160425045124_create_u2f_registrations.rb b/db/migrate/20160425045124_create_u2f_registrations.rb index 93bdd9de2eb..72cbe98ebba 100644 --- a/db/migrate/20160425045124_create_u2f_registrations.rb +++ b/db/migrate/20160425045124_create_u2f_registrations.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class CreateU2fRegistrations < ActiveRecord::Migration def change create_table :u2f_registrations do |t| diff --git a/db/migrate/20160504091942_add_disabled_oauth_sign_in_sources_to_application_settings.rb b/db/migrate/20160504091942_add_disabled_oauth_sign_in_sources_to_application_settings.rb index facd33875ba..bf50616656c 100644 --- a/db/migrate/20160504091942_add_disabled_oauth_sign_in_sources_to_application_settings.rb +++ b/db/migrate/20160504091942_add_disabled_oauth_sign_in_sources_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddDisabledOauthSignInSourcesToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :disabled_oauth_sign_in_sources, :text diff --git a/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb b/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb index 84e5e4eabe2..c60892a6279 100644 --- a/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb +++ b/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddRunUntaggedToCiRunner < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers disable_ddl_transaction! diff --git a/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb b/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb index aa560bc0f0c..6792ffc957a 100644 --- a/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb +++ b/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveWallEnabledFromProjects < ActiveRecord::Migration def change remove_column :projects, :wall_enabled, :boolean, default: true, null: false diff --git a/db/migrate/20160508215820_add_type_to_notes.rb b/db/migrate/20160508215820_add_type_to_notes.rb index 58944d4e651..c1d07c9363f 100644 --- a/db/migrate/20160508215820_add_type_to_notes.rb +++ b/db/migrate/20160508215820_add_type_to_notes.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddTypeToNotes < ActiveRecord::Migration def change add_column :notes, :type, :string diff --git a/db/migrate/20160508221410_set_type_on_legacy_diff_notes.rb b/db/migrate/20160508221410_set_type_on_legacy_diff_notes.rb index c3f23d89d5a..6dd958ff4a0 100644 --- a/db/migrate/20160508221410_set_type_on_legacy_diff_notes.rb +++ b/db/migrate/20160508221410_set_type_on_legacy_diff_notes.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class SetTypeOnLegacyDiffNotes < ActiveRecord::Migration def change execute "UPDATE notes SET type = 'LegacyDiffNote' WHERE line_code IS NOT NULL" diff --git a/db/migrate/20160509201028_add_health_check_access_token_to_application_settings.rb b/db/migrate/20160509201028_add_health_check_access_token_to_application_settings.rb index 9d729fec189..b6a5bea79b6 100644 --- a/db/migrate/20160509201028_add_health_check_access_token_to_application_settings.rb +++ b/db/migrate/20160509201028_add_health_check_access_token_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddHealthCheckAccessTokenToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :health_check_access_token, :string diff --git a/db/migrate/20160516174813_add_send_user_confirmation_email_to_application_settings.rb b/db/migrate/20160516174813_add_send_user_confirmation_email_to_application_settings.rb index c34e7ba5409..8c96353b850 100644 --- a/db/migrate/20160516174813_add_send_user_confirmation_email_to_application_settings.rb +++ b/db/migrate/20160516174813_add_send_user_confirmation_email_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddSendUserConfirmationEmailToApplicationSettings < ActiveRecord::Migration def up add_column :application_settings, :send_user_confirmation_email, :boolean, default: false diff --git a/db/migrate/20160525205328_remove_main_language_from_projects.rb b/db/migrate/20160525205328_remove_main_language_from_projects.rb index 0f9d60c385f..dc4ceacddb1 100644 --- a/db/migrate/20160525205328_remove_main_language_from_projects.rb +++ b/db/migrate/20160525205328_remove_main_language_from_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # See http://doc.gitlab.com/ce/development/migration_style_guide.html # for more information on how to write migrations for GitLab. diff --git a/db/migrate/20160527020117_remove_notification_settings_for_deleted_projects.rb b/db/migrate/20160527020117_remove_notification_settings_for_deleted_projects.rb index 7910120b4e0..3e26be7c09c 100644 --- a/db/migrate/20160527020117_remove_notification_settings_for_deleted_projects.rb +++ b/db/migrate/20160527020117_remove_notification_settings_for_deleted_projects.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveNotificationSettingsForDeletedProjects < ActiveRecord::Migration def up execute <<-SQL diff --git a/db/migrate/20160528043124_add_users_state_index.rb b/db/migrate/20160528043124_add_users_state_index.rb index e77a5460737..6419d2ae71d 100644 --- a/db/migrate/20160528043124_add_users_state_index.rb +++ b/db/migrate/20160528043124_add_users_state_index.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddUsersStateIndex < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20160530150109_add_container_registry_token_expire_delay_to_application_settings.rb b/db/migrate/20160530150109_add_container_registry_token_expire_delay_to_application_settings.rb index e21376bd571..d811fd5271e 100644 --- a/db/migrate/20160530150109_add_container_registry_token_expire_delay_to_application_settings.rb +++ b/db/migrate/20160530150109_add_container_registry_token_expire_delay_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all # This is ONLINE migration class AddContainerRegistryTokenExpireDelayToApplicationSettings < ActiveRecord::Migration diff --git a/db/migrate/20160603180330_remove_duplicated_notification_settings.rb b/db/migrate/20160603180330_remove_duplicated_notification_settings.rb index fe1c863b5b9..4f4f58b1619 100644 --- a/db/migrate/20160603180330_remove_duplicated_notification_settings.rb +++ b/db/migrate/20160603180330_remove_duplicated_notification_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class RemoveDuplicatedNotificationSettings < ActiveRecord::Migration def up duplicates = exec_query(%Q{ diff --git a/db/migrate/20160603182247_add_index_to_notification_settings.rb b/db/migrate/20160603182247_add_index_to_notification_settings.rb index 06462042b09..f6ae26d555f 100644 --- a/db/migrate/20160603182247_add_index_to_notification_settings.rb +++ b/db/migrate/20160603182247_add_index_to_notification_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddIndexToNotificationSettings < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers diff --git a/db/migrate/20160608155312_add_after_sign_up_text_to_application_settings.rb b/db/migrate/20160608155312_add_after_sign_up_text_to_application_settings.rb index 89826fb96cb..3c5d2ad910e 100644 --- a/db/migrate/20160608155312_add_after_sign_up_text_to_application_settings.rb +++ b/db/migrate/20160608155312_add_after_sign_up_text_to_application_settings.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class AddAfterSignUpTextToApplicationSettings < ActiveRecord::Migration def change add_column :application_settings, :after_sign_up_text, :text diff --git a/db/migrate/limits_to_mysql.rb b/db/migrate/limits_to_mysql.rb index 14d7e84d856..be3501c4c2e 100644 --- a/db/migrate/limits_to_mysql.rb +++ b/db/migrate/limits_to_mysql.rb @@ -1,3 +1,4 @@ +# rubocop:disable all class LimitsToMysql < ActiveRecord::Migration def up return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/ From cef3fd28996edd07b1a9bf00f8a6f1d9bc01c1ac Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Wed, 8 Jun 2016 22:48:44 -0300 Subject: [PATCH 06/87] Wrap all rate limiting logic inside GitHub API client --- lib/gitlab/github_import/client.rb | 35 +++++++++++++++- lib/gitlab/github_import/importer.rb | 62 ++++------------------------ 2 files changed, 40 insertions(+), 57 deletions(-) diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb index 67988ea3460..d325eca6d99 100644 --- a/lib/gitlab/github_import/client.rb +++ b/lib/gitlab/github_import/client.rb @@ -1,6 +1,9 @@ module Gitlab module GithubImport class Client + GITHUB_SAFE_REMAINING_REQUESTS = 100 + GITHUB_SAFE_SLEEP_TIME = 500 + attr_reader :client, :api def initialize(access_token) @@ -11,7 +14,7 @@ module Gitlab ) if access_token - ::Octokit.auto_paginate = true + ::Octokit.auto_paginate = false @api = ::Octokit::Client.new( access_token: access_token, @@ -36,7 +39,7 @@ module Gitlab def method_missing(method, *args, &block) if api.respond_to?(method) - api.send(method, *args, &block) + request { api.send(method, *args, &block) } else super(method, *args, &block) end @@ -55,6 +58,34 @@ module Gitlab def github_options config["args"]["client_options"].deep_symbolize_keys end + + def rate_limit + api.rate_limit! + end + + def rate_limit_exceed? + rate_limit.remaining <= GITHUB_SAFE_REMAINING_REQUESTS + end + + def rate_limit_sleep_time + rate_limit.resets_in + GITHUB_SAFE_SLEEP_TIME + end + + def request + sleep rate_limit_sleep_time if rate_limit_exceed? + + data = yield + + last_response = api.last_response + + while last_response.rels[:next] + sleep rate_limit_sleep_time if rate_limit_exceed? + last_response = last_response.rels[:next].get + data.concat(last_response.data) if last_response.data.is_a?(Array) + end + + data + end end end end diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb index 5ef9d66ba68..e5cf66a0371 100644 --- a/lib/gitlab/github_import/importer.rb +++ b/lib/gitlab/github_import/importer.rb @@ -3,9 +3,6 @@ module Gitlab class Importer include Gitlab::ShellAdapter - GITHUB_SAFE_REMAINING_REQUESTS = 100 - GITHUB_SAFE_SLEEP_TIME = 500 - attr_reader :client, :project, :repo, :repo_url def initialize(project) @@ -28,52 +25,12 @@ module Gitlab private - def turn_auto_pagination_off! - client.auto_paginate = false - end - - def turn_auto_pagination_on! - client.auto_paginate = true - end - - def rate_limit - client.rate_limit! - end - - def rate_limit_exceed? - rate_limit.remaining <= GITHUB_SAFE_REMAINING_REQUESTS - end - - def rate_limit_sleep_time - rate_limit.resets_in + GITHUB_SAFE_SLEEP_TIME - end - - def paginate - turn_auto_pagination_off! - - sleep rate_limit_sleep_time if rate_limit_exceed? - - data = yield - - last_response = client.last_response - - while last_response.rels[:next] - sleep rate_limit_sleep_time if rate_limit_exceed? - last_response = last_response.rels[:next].get - data.concat(last_response.data) if last_response.data.is_a?(Array) - end - - turn_auto_pagination_on! - - data - end - def credentials @credentials ||= project.import_data.credentials if project.import_data end def import_labels - labels = paginate { client.labels(repo, per_page: 100) } + labels = client.labels(repo, per_page: 100) labels.each { |raw| LabelFormatter.new(project, raw).create! } true @@ -82,7 +39,7 @@ module Gitlab end def import_milestones - milestones = paginate { client.milestones(repo, state: :all, per_page: 100) } + milestones = client.milestones(repo, state: :all, per_page: 100) milestones.each { |raw| MilestoneFormatter.new(project, raw).create! } true @@ -91,9 +48,9 @@ module Gitlab end def import_issues - data = paginate { client.issues(repo, state: :all, sort: :created, direction: :asc, per_page: 100) } + issues = client.issues(repo, state: :all, sort: :created, direction: :asc, per_page: 100) - data.each do |raw| + issues.each do |raw| gh_issue = IssueFormatter.new(project, raw) if gh_issue.valid? @@ -112,7 +69,7 @@ module Gitlab hooks = client.hooks(repo).map { |raw| HookFormatter.new(raw) }.select(&:valid?) disable_webhooks(hooks) - pull_requests = paginate { client.pull_requests(repo, state: :all, sort: :created, direction: :asc, per_page: 100) } + pull_requests = client.pull_requests(repo, state: :all, sort: :created, direction: :asc, per_page: 100) pull_requests = pull_requests.map { |raw| PullRequestFormatter.new(project, raw) }.select(&:valid?) source_branches_removed = pull_requests.reject(&:source_branch_exists?).map { |pr| [pr.source_branch_name, pr.source_branch_sha] } @@ -146,14 +103,12 @@ module Gitlab def update_webhooks(hooks, options) hooks.each do |hook| - sleep rate_limit_sleep_time if rate_limit_exceed? client.edit_hook(repo, hook.id, hook.name, hook.config, options) end end def restore_branches(branches) branches.each do |name, sha| - sleep rate_limit_sleep_time if rate_limit_exceed? client.create_ref(repo, "refs/heads/#{name}", sha) end @@ -162,15 +117,12 @@ module Gitlab def clean_up_restored_branches(branches) branches.each do |name, _| - sleep rate_limit_sleep_time if rate_limit_exceed? client.delete_ref(repo, "heads/#{name}") project.repository.rm_branch(project.creator, name) end end def apply_labels(issuable) - sleep rate_limit_sleep_time if rate_limit_exceed? - issue = client.issue(repo, issuable.iid) if issue.labels.count > 0 @@ -183,12 +135,12 @@ module Gitlab end def import_comments(issuable) - comments = paginate { client.issue_comments(repo, issuable.iid, per_page: 100) } + comments = client.issue_comments(repo, issuable.iid, per_page: 100) create_comments(issuable, comments) end def import_comments_on_diff(merge_request) - comments = paginate { client.pull_request_comments(repo, merge_request.iid, per_page: 100) } + comments = client.pull_request_comments(repo, merge_request.iid, per_page: 100) create_comments(merge_request, comments) end From 921c356b5e776abc072724dd4238029c1bf13961 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 7 Jun 2016 14:51:00 +0200 Subject: [PATCH 07/87] Rename commit to pipeline in TriggerRequest --- app/models/ci/trigger_request.rb | 2 +- app/services/ci/create_trigger_request_service.rb | 2 +- spec/models/build_spec.rb | 2 +- spec/requests/ci/api/builds_spec.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/ci/trigger_request.rb b/app/models/ci/trigger_request.rb index 59fc9951d11..b69ae37668c 100644 --- a/app/models/ci/trigger_request.rb +++ b/app/models/ci/trigger_request.rb @@ -3,7 +3,7 @@ module Ci extend Ci::Model belongs_to :trigger, class_name: 'Ci::Trigger' - belongs_to :commit, class_name: 'Ci::Pipeline', foreign_key: :commit_id + belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :commit_id has_many :builds, class_name: 'Ci::Build' serialize :variables diff --git a/app/services/ci/create_trigger_request_service.rb b/app/services/ci/create_trigger_request_service.rb index c3194f45b10..1e629cf119a 100644 --- a/app/services/ci/create_trigger_request_service.rb +++ b/app/services/ci/create_trigger_request_service.rb @@ -11,7 +11,7 @@ module Ci trigger_request = trigger.trigger_requests.create!( variables: variables, - commit: pipeline, + pipeline: pipeline, ) if pipeline.create_builds(nil, trigger_request) diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index 7660ea2659c..2beb6cc598d 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -219,7 +219,7 @@ describe Ci::Build, models: true do context 'and trigger variables' do let(:trigger) { create(:ci_trigger, project: project) } - let(:trigger_request) { create(:ci_trigger_request_with_variables, commit: pipeline, trigger: trigger) } + let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: pipeline, trigger: trigger) } let(:trigger_variables) do [ { key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false } diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index 88271642532..e8508f8f950 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -85,7 +85,7 @@ describe Ci::API::API do trigger = FactoryGirl.create(:ci_trigger, project: project) pipeline = FactoryGirl.create(:ci_pipeline, project: project, ref: 'master') - trigger_request = FactoryGirl.create(:ci_trigger_request_with_variables, commit: pipeline, trigger: trigger) + trigger_request = FactoryGirl.create(:ci_trigger_request_with_variables, pipeline: pipeline, trigger: trigger) pipeline.create_builds(nil, trigger_request) project.variables << Ci::Variable.new(key: "SECRET_KEY", value: "secret_value") From 4663ae064d64c6acd488ef4c28afcf60b843bb85 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 8 Jun 2016 12:50:49 +0200 Subject: [PATCH 08/87] Fix CI TriggerRequest entity --- lib/ci/api/entities.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ci/api/entities.rb b/lib/ci/api/entities.rb index b25e0e573a8..255217b1a7c 100644 --- a/lib/ci/api/entities.rb +++ b/lib/ci/api/entities.rb @@ -56,7 +56,7 @@ module Ci class TriggerRequest < Grape::Entity expose :id, :variables - expose :commit, using: Commit + expose :trigger, using: Commit, as: :commit end end end From e796555bdb9884a34a5dcef595815594484aac41 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 9 Jun 2016 09:59:34 +0100 Subject: [PATCH 09/87] Fixed issue where label filtering didnt work Closes #18375 --- app/assets/javascripts/labels_select.js.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee index ec74dfaae1a..6b86b51589c 100644 --- a/app/assets/javascripts/labels_select.js.coffee +++ b/app/assets/javascripts/labels_select.js.coffee @@ -254,7 +254,7 @@ class @LabelsSelect search: fields: ['title'] selectable: true - + filterable: true toggleLabel: (selected, el) -> selected_labels = $('.js-label-select').siblings('.dropdown-menu-labels').find('.is-active') From d301791c2aa101b68f9b5abda24f20dc24a85830 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 9 Jun 2016 10:44:17 +0100 Subject: [PATCH 10/87] Added tests --- app/helpers/dropdowns_helper.rb | 4 ++-- .../shared/issuable/_label_page_default.html.haml | 2 +- spec/features/issues/filter_by_labels_spec.rb | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/helpers/dropdowns_helper.rb b/app/helpers/dropdowns_helper.rb index 14697f774cc..6b617e1730a 100644 --- a/app/helpers/dropdowns_helper.rb +++ b/app/helpers/dropdowns_helper.rb @@ -67,9 +67,9 @@ module DropdownsHelper end end - def dropdown_filter(placeholder) + def dropdown_filter(placeholder, search_id: nil) content_tag :div, class: "dropdown-input" do - filter_output = search_field_tag nil, nil, class: "dropdown-input-field", placeholder: placeholder + filter_output = search_field_tag search_id, nil, class: "dropdown-input-field", placeholder: placeholder filter_output << icon('search', class: "dropdown-input-search") filter_output << icon('times', class: "dropdown-input-clear js-dropdown-input-clear", role: "button") diff --git a/app/views/shared/issuable/_label_page_default.html.haml b/app/views/shared/issuable/_label_page_default.html.haml index 4e280c371ac..0acb8253139 100644 --- a/app/views/shared/issuable/_label_page_default.html.haml +++ b/app/views/shared/issuable/_label_page_default.html.haml @@ -4,7 +4,7 @@ - filter_placeholder = local_assigns.fetch(:filter_placeholder, 'Search labels') .dropdown-page-one = dropdown_title(title) - = dropdown_filter(filter_placeholder) + = dropdown_filter(filter_placeholder, search_id: "label-name") = dropdown_content - if @project && show_footer = dropdown_footer do diff --git a/spec/features/issues/filter_by_labels_spec.rb b/spec/features/issues/filter_by_labels_spec.rb index 0ec8b6b180a..16c619c9288 100644 --- a/spec/features/issues/filter_by_labels_spec.rb +++ b/spec/features/issues/filter_by_labels_spec.rb @@ -199,4 +199,19 @@ feature 'Issue filtering by Labels', feature: true do end end end + + context 'dropdown filtering', js: true do + it 'should filter by label name' do + page.within '.labels-filter' do + click_button 'Label' + wait_for_ajax + fill_in 'label-name', with: 'bug' + + page.within '.dropdown-content' do + expect(page).not_to have_content 'enhancement' + expect(page).to have_content 'bug' + end + end + end + end end From d1506ebeeca6e9bf9d524b0b4174bd81ae5c57a4 Mon Sep 17 00:00:00 2001 From: Connor Shea Date: Fri, 27 May 2016 10:46:06 -0600 Subject: [PATCH 11/87] Add ISSUE_TEMPLATE.md and PULL_REQUEST_TEMPLATE.md to point contributors toward the GitLab.com repository. This adds templates for Issues/Pull Requests in a `.github` directory. These only effect issues/PRs opened in the GitHub mirror of the GitLab project. As we're shutting these down, I thought it'd be good to direct users/contributors to open issues/contribute code in the "correct" project. --- .github/ISSUE_TEMPLATE.md | 3 +++ .github/PULL_REQUEST_TEMPLATE.md | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000000..9231f809146 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,3 @@ +We’re closing our issue tracker on GitHub so we can focus on the GitLab.com issue tracker and respond to issues more quickly. + +We encourage you to open an issue on the [GitLab.com issue tracker](https://gitlab.com/gitlab-org/gitlab-ce/issues). You can login on GitLab using your GitHub account if you'd like to contribute an issue. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..0a7ed80a81c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,3 @@ +Thank you for taking the time to contribute back to GitLab! Due to the high number of contributions we get, we’re unable to review requests on GitHub right now. + +We encourage you to open a merge request [on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests). You can login on GitLab.com using your GitHub account. From 7722caf9d5be1ca419d9c672187fb62c6d21caed Mon Sep 17 00:00:00 2001 From: Connor Shea Date: Thu, 9 Jun 2016 11:25:47 -0600 Subject: [PATCH 12/87] Address feedback about wording. --- .github/ISSUE_TEMPLATE.md | 4 ++-- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 9231f809146..2e88b7aa0a9 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,3 +1,3 @@ -We’re closing our issue tracker on GitHub so we can focus on the GitLab.com issue tracker and respond to issues more quickly. +We’re closing our issue tracker on GitHub so we can focus on the GitLab.com project and respond to issues more quickly. -We encourage you to open an issue on the [GitLab.com issue tracker](https://gitlab.com/gitlab-org/gitlab-ce/issues). You can login on GitLab using your GitHub account if you'd like to contribute an issue. +We encourage you to open an issue on the [GitLab.com issue tracker](https://gitlab.com/gitlab-org/gitlab-ce/issues). You can log into GitLab.com using your GitHub account. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0a7ed80a81c..c3b04026440 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,3 +1,3 @@ -Thank you for taking the time to contribute back to GitLab! Due to the high number of contributions we get, we’re unable to review requests on GitHub right now. +Thank you for taking the time to contribute back to GitLab! -We encourage you to open a merge request [on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests). You can login on GitLab.com using your GitHub account. +Please open a merge request [on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests), we look forward to reviewing your contribution! You can log into GitLab.com using your GitHub account. From 12483e898b2dc94d03c4a633c199256be31a38fb Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Thu, 9 Jun 2016 08:42:50 -0500 Subject: [PATCH 13/87] Update activity SVG path --- app/views/layouts/nav/_project.html.haml | 1 - app/views/shared/icons/_activity.svg | 15 ++++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index 2a58ef224b3..ca99ba8def3 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -129,5 +129,4 @@ %li.hidden = link_to project_commits_path(@project), title: 'Commits', class: 'shortcuts-commits' do Commits - .fade-right diff --git a/app/views/shared/icons/_activity.svg b/app/views/shared/icons/_activity.svg index c87794b9062..d465504b154 100644 --- a/app/views/shared/icons/_activity.svg +++ b/app/views/shared/icons/_activity.svg @@ -3,13 +3,14 @@ path-1 Created with Sketch. - - - + - - - - + + + + + + + \ No newline at end of file From 99d5a91d7a1942f092c87010cbf93279979822a1 Mon Sep 17 00:00:00 2001 From: Timothy Andrew Date: Fri, 10 Jun 2016 14:04:27 +0530 Subject: [PATCH 14/87] Fix failing `EmailOnPush` spec. --- spec/lib/disable_email_interceptor_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/lib/disable_email_interceptor_spec.rb b/spec/lib/disable_email_interceptor_spec.rb index c2a7b20b84d..309a88151cf 100644 --- a/spec/lib/disable_email_interceptor_spec.rb +++ b/spec/lib/disable_email_interceptor_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe DisableEmailInterceptor, lib: true do before do - ActionMailer::Base.register_interceptor(DisableEmailInterceptor) + Mail.register_interceptor(DisableEmailInterceptor) end it 'should not send emails' do @@ -14,7 +14,7 @@ describe DisableEmailInterceptor, lib: true do # Removing interceptor from the list because unregister_interceptor is # implemented in later version of mail gem # See: https://github.com/mikel/mail/pull/705 - Mail.class_variable_set(:@@delivery_interceptors, []) + Mail.unregister_interceptor(DisableEmailInterceptor) end def deliver_mail From e0a90c467c4ffaf6fec03ad54afa5f18b71a6aa3 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 9 Jun 2016 09:10:36 +0100 Subject: [PATCH 15/87] Made the awardable buttons prettier when active Closes #18379 --- app/assets/stylesheets/pages/awards.scss | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/pages/awards.scss b/app/assets/stylesheets/pages/awards.scss index 05d1ee5b998..6211f3a52eb 100644 --- a/app/assets/stylesheets/pages/awards.scss +++ b/app/assets/stylesheets/pages/awards.scss @@ -101,13 +101,21 @@ line-height: 20px; outline: 0; + &:hover, &.active, &:active { - background-color: $white-dark; + background-color: $row-hover; + border-color: $row-hover-border; box-shadow: none; outline: 0; } + &.btn { + &:focus { + outline: 0; + } + } + &.is-loading { .award-control-icon-normal, .emoji-icon { From b2b3fb6c0130af4d8b08ed2a92d76c269fb226eb Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 9 Jun 2016 15:58:02 +0100 Subject: [PATCH 16/87] Revert change to search all users --- app/assets/javascripts/users_select.js.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/users_select.js.coffee b/app/assets/javascripts/users_select.js.coffee index de0eae58bff..88246b0feb8 100644 --- a/app/assets/javascripts/users_select.js.coffee +++ b/app/assets/javascripts/users_select.js.coffee @@ -95,7 +95,7 @@ class @UsersSelect data: (term, callback) => isAuthorFilter = $('.js-author-search') - @users term, term is '' and isAuthorFilter, (users) => + @users term, (users) => if term.length is 0 showDivider = 0 @@ -221,7 +221,7 @@ class @UsersSelect multiple: $(select).hasClass('multiselect') minimumInputLength: 0 query: (query) => - @users query.term, @projectId?, (users) => + @users query.term, (users) => data = { results: users } if query.term.length == 0 @@ -304,7 +304,7 @@ class @UsersSelect # Return users list. Filtered by query # Only active users retrieved - users: (query, fromProject, callback) => + users: (query, callback) => url = @buildUrl(@usersPath) $.ajax( @@ -313,7 +313,7 @@ class @UsersSelect search: query per_page: 20 active: true - project_id: @projectId if fromProject + project_id: @projectId group_id: @groupId current_user: @showCurrentUser author_id: @authorId From a4b3bdabd52494f46fee73271d7b343e6b7e08e9 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 10 Jun 2016 08:52:08 +0100 Subject: [PATCH 17/87] removed tests needed for any author :poop: --- spec/features/issues/filter_issues_spec.rb | 36 ---------------------- 1 file changed, 36 deletions(-) diff --git a/spec/features/issues/filter_issues_spec.rb b/spec/features/issues/filter_issues_spec.rb index 7efbaaa048c..1f0594e6b02 100644 --- a/spec/features/issues/filter_issues_spec.rb +++ b/spec/features/issues/filter_issues_spec.rb @@ -294,40 +294,4 @@ describe 'Filter issues', feature: true do end end end - - describe 'filter by any author', js: true do - before do - user2 = create(:user, name: "tester") - create(:issue, project: project, author: user) - create(:issue, project: project, author: user2) - - visit namespace_project_issues_path(project.namespace, project) - end - - it 'should show filter by any author link' do - click_button "Author" - fill_in "Search authors", with: "tester" - - page.within ".dropdown-menu-author" do - expect(page).to have_content "tester" - end - end - - it 'should show filter issues by any author' do - page.within '.issues-list' do - expect(page).to have_selector ".issue", count: 2 - end - - click_button "Author" - fill_in "Search authors", with: "tester" - - page.within ".dropdown-menu-author" do - click_link "tester" - end - - page.within '.issues-list' do - expect(page).to have_selector ".issue", count: 1 - end - end - end end From 1d95958ba06c7d42c76f8a1599f831ce5251acca Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 10 Jun 2016 08:28:03 +0100 Subject: [PATCH 18/87] Changelog fix for search dropdown arrow keys fix --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index b00c149a753..604007d822b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ v 8.9.0 (unreleased) - Fix endless redirections when accessing user OAuth applications when they are disabled - Allow enabling wiki page events from Webhook management UI - Bump rouge to 1.11.0 + - Fix issue with arrow keys not working in search autocomplete dropdown - Make EmailsOnPushWorker use Sidekiq mailers queue - Fix wiki page events' webhook to point to the wiki repository - Fix issue todo not remove when leave project !4150 (Long Nguyen) @@ -64,7 +65,6 @@ v 8.9.0 (unreleased) v 8.8.5 (unreleased) - Ensure branch cleanup regardless of whether the GitHub import process succeeds - - Fix issue with arrow keys not working in search autocomplete dropdown - Fix todos page throwing errors when you have a project pending deletion - Reduce number of SQL queries when rendering user references - Import GitHub repositories respecting the API rate limit From 10f17c2fcd50d4e4b5bad59a5ae2fb4a13a037d8 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 9 Jun 2016 09:00:57 +0100 Subject: [PATCH 19/87] Correctly shows label errors in dropdown Fixes #18344 --- app/assets/javascripts/labels_select.js.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee index ec74dfaae1a..439c3153392 100644 --- a/app/assets/javascripts/labels_select.js.coffee +++ b/app/assets/javascripts/labels_select.js.coffee @@ -95,8 +95,11 @@ class @LabelsSelect $newLabelCreateButton.enable() if label.message? + errors = _.map label.message, (value, key) -> + "#{key} #{value[0]}" + $newLabelError - .text label.message + .html errors.join("
") .show() else $('.dropdown-menu-back', $dropdown.parent()).trigger 'click' From 701e2df7e55113dafd48c570baad44bf7f24f863 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 10 Jun 2016 12:29:15 +0200 Subject: [PATCH 20/87] Satisfy Rubocop --- lib/api/helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 0e47bb0b8ad..e1d3bbcc02d 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -412,11 +412,11 @@ module API def send_git_blob(repository, blob) env['api.format'] = :txt content_type 'text/plain' - header *Gitlab::Workhorse.send_git_blob(repository, blob) + header(*Gitlab::Workhorse.send_git_blob(repository, blob)) end def send_git_archive(repository, ref:, format:) - header *Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format) + header(*Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format)) end end end From dc6ec2adf82c2b2fe1ab6ef076432fd741d3afbb Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 20 Apr 2016 10:11:22 +0100 Subject: [PATCH 21/87] CI build page UI update Added sidebar Removed elements not present in design --- app/assets/javascripts/application.js.coffee | 4 +- app/assets/javascripts/ci/build.coffee | 91 ++++++--- app/assets/stylesheets/framework/sidebar.scss | 4 +- .../stylesheets/framework/variables.scss | 3 + app/assets/stylesheets/pages/builds.scss | 91 +++++++-- app/assets/stylesheets/pages/issuable.scss | 6 +- app/assets/stylesheets/pages/xterm.scss | 19 +- app/controllers/projects/builds_controller.rb | 2 +- app/helpers/nav_helper.rb | 2 + app/views/projects/artifacts/browse.html.haml | 1 + app/views/projects/builds/_header.html.haml | 16 ++ app/views/projects/builds/_sidebar.html.haml | 93 +++++++++ app/views/projects/builds/_user.html.haml | 4 + app/views/projects/builds/show.html.haml | 189 ++---------------- features/steps/project/builds/artifacts.rb | 4 +- spec/features/builds_spec.rb | 27 +-- 16 files changed, 306 insertions(+), 250 deletions(-) create mode 100644 app/views/projects/builds/_header.html.haml create mode 100644 app/views/projects/builds/_sidebar.html.haml create mode 100644 app/views/projects/builds/_user.html.haml diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index b28327ce12d..e0ca546350b 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -267,8 +267,8 @@ $ -> $(document).trigger('breakpoint:change', [bootstrapBreakpoint]) $(window) - .off "resize" - .on "resize", (e) -> + .off "resize.app" + .on "resize.app", (e) -> fitSidebarForSize() gl.awardsHandler = new AwardsHandler() diff --git a/app/assets/javascripts/ci/build.coffee b/app/assets/javascripts/ci/build.coffee index 98d05e41273..f763ba96e33 100644 --- a/app/assets/javascripts/ci/build.coffee +++ b/app/assets/javascripts/ci/build.coffee @@ -1,19 +1,31 @@ -class CiBuild +class @CiBuild @interval: null @state: null - constructor: (build_url, build_status, build_state) -> + constructor: (@build_url, @build_status, @state) -> clearInterval(CiBuild.interval) - @state = build_state + # Init breakpoint checker + @bp = Breakpoints.get() + @hideSidebar() + $('.js-build-sidebar').niceScroll() + $(document) + .off 'click', '.js-sidebar-build-toggle' + .on 'click', '.js-sidebar-build-toggle', @toggleSidebar - @initScrollButtonAffix() + $(window) + .off 'resize.build' + .on 'resize.build', @hideSidebar - if build_status == "running" || build_status == "pending" + if $('#build-trace').length + @getInitialBuildTrace() + @initScrollButtonAffix() + + if @build_status is "running" or @build_status is "pending" # # Bind autoscroll button to follow build output # - $("#autoscroll-button").bind "click", -> + $('#autoscroll-button').on 'click', -> state = $(this).data("state") if "enabled" is state $(this).data "state", "disabled" @@ -27,26 +39,37 @@ class CiBuild # Only valid for runnig build when output changes during time # CiBuild.interval = setInterval => - if window.location.href.split("#").first() is build_url - last_state = @state - $.ajax - url: build_url + "/trace.json?state=" + encodeURIComponent(@state) - dataType: "json" - success: (log) => - return unless last_state is @state - - if log.state and log.status is "running" - @state = log.state - if log.append - $('.fa-refresh').before log.html - else - $('#build-trace code').html log.html - $('#build-trace code').append '' - @checkAutoscroll() - else if log.status isnt build_status - Turbolinks.visit build_url + if window.location.href.split("#").first() is @build_url + @getBuildTrace() , 4000 + getInitialBuildTrace: -> + $.ajax + url: @build_url + dataType: 'json' + success: (build_data) -> + $('.js-build-output').html build_data.trace_html + + if build_data.status is 'success' or build_data.status is 'failed' + $('.js-build-refresh').remove() + + getBuildTrace: -> + $.ajax + url: "#{@build_url}/trace.json?state=#{encodeURIComponent(@state)}" + dataType: "json" + success: (log) => + if log.state + @state = log.state + + if log.status is "running" + if log.append + $('.js-build-output').append log.html + else + $('.js-build-output').html log.html + @checkAutoscroll() + else if log.status isnt @build_status + Turbolinks.visit @build_url + checkAutoscroll: -> $("html,body").scrollTop $("#build-trace").height() if "enabled" is $("#autoscroll-button").data("state") @@ -61,4 +84,22 @@ class CiBuild $body.outerHeight() - ($buildTrace.outerHeight() + $buildTrace.offset().top) ) -@CiBuild = CiBuild + shouldHideSidebar: -> + bootstrapBreakpoint = @bp.getBreakpointSize() + + bootstrapBreakpoint is 'xs' or bootstrapBreakpoint is 'sm' + + toggleSidebar: => + if @shouldHideSidebar() + $('.js-build-sidebar') + .toggleClass 'right-sidebar-expanded right-sidebar-collapsed' + + hideSidebar: => + if @shouldHideSidebar() + $('.js-build-sidebar') + .removeClass 'right-sidebar-expanded' + .addClass 'right-sidebar-collapsed' + else + $('.js-build-sidebar') + .removeClass 'right-sidebar-collapsed' + .addClass 'right-sidebar-expanded' diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index 94985413746..06a688690f8 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -273,7 +273,9 @@ padding-right: 0; @media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) { - padding-right: $sidebar_collapsed_width; + &:not(.build-sidebar) { + padding-right: $sidebar_collapsed_width; + } } @media (min-width: $screen-md-min) { diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 99e3df119ed..847b2f80bdf 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -260,3 +260,6 @@ $calendar-header-color: #b8b8b8; $calendar-hover-bg: #ecf3fe; $calendar-border-color: rgba(#000, .1); $calendar-unselectable-bg: #faf9f9; + +$ci-output-bg: #1d1f21; +$ci-text-color: #c5c8c6; diff --git a/app/assets/stylesheets/pages/builds.scss b/app/assets/stylesheets/pages/builds.scss index 44222e8e8a4..e8f1935d239 100644 --- a/app/assets/stylesheets/pages/builds.scss +++ b/app/assets/stylesheets/pages/builds.scss @@ -53,37 +53,92 @@ left: 70px; } } +} - .build-widget { - padding: 10px; - background: $background-color; - margin-bottom: 20px; - border-radius: 4px; +.build-header { + position: relative; + padding-right: 40px; - .title { - margin-top: 0; - color: #666; - line-height: 1.5; - } - .attr-name { - color: #777; + @media (min-width: $screen-sm-min) { + padding-right: 0; + } + + a { + color: $gl-gray; + + &:hover { + color: $gl-link-color; + text-decoration: none; } } - .alert-disabled { - background: $background-color; + code { + color: $code-color; + } - a { - color: #3084bb !important; - } + .avatar { + float: none; + margin-right: 2px; + margin-left: 2px; } } table.builds { - .build-link { a { color: $gl-dark-link-color; } } } + +.build-trace { + background: $ci-output-bg; + color: $ci-text-color; + white-space: pre; + overflow-x: auto; + font-size: 12px; + + .fa-refresh { + font-size: 24px; + } + + .bash { + display: block; + } +} + +.right-sidebar.build-sidebar { + padding-top: $gl-padding; + padding-bottom: $gl-padding; + + &.right-sidebar-collapsed { + display: none; + } + + .block { + width: 100%; + } + + .build-sidebar-header { + padding-top: 0; + + .gutter-toggle { + margin-top: 0; + } + } +} + +.build-detail-row { + margin-bottom: 5px; +} + +.build-light-text { + color: $gl-placeholder-color; +} + +.build-gutter-toggle { + position: absolute; + top: 50%; + right: 0; + margin-top: -17px; +} diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index 787c387379e..ea453ce356a 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -29,7 +29,7 @@ } } -.issuable-sidebar { +.right-sidebar { a { color: inherit; } @@ -74,6 +74,10 @@ } } + .block-first { + padding-top: 0; + } + .title { color: $gl-text-color; margin-bottom: 10px; diff --git a/app/assets/stylesheets/pages/xterm.scss b/app/assets/stylesheets/pages/xterm.scss index 3f28e402929..8d855ce99b0 100644 --- a/app/assets/stylesheets/pages/xterm.scss +++ b/app/assets/stylesheets/pages/xterm.scss @@ -11,18 +11,15 @@ $magenta: #cd00cd; $cyan: #00cdcd; $white: #e5e5e5; - $l-black: #7f7f7f; - $l-red: #f00; - $l-green: #0f0; - $l-yellow: #ff0; - $l-blue: #5c5cff; - $l-magenta: #f0f; - $l-cyan: #0ff; - $l-white: #fff; + $l-black: #373b41; + $l-red: #c66; + $l-green: #b5bd68; + $l-yellow: #f0c674; + $l-blue: #81a2be; + $l-magenta: #b294bb; + $l-cyan: #8abeb7; + $l-white: $ci-text-color; - .term-bold { - font-weight: bold; - } .term-italic { font-style: italic; } diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb index 9b80efa5f11..14c82826342 100644 --- a/app/controllers/projects/builds_controller.rb +++ b/app/controllers/projects/builds_controller.rb @@ -41,7 +41,7 @@ class Projects::BuildsController < Projects::ApplicationController def trace respond_to do |format| format.json do - render json: @build.trace_with_state(params[:state]).merge!(id: @build.id, status: @build.status) + render json: @build.trace_with_state(params[:state].presence).merge!(id: @build.id, status: @build.status) end end end diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb index f685e547537..39831ce2e48 100644 --- a/app/helpers/nav_helper.rb +++ b/app/helpers/nav_helper.rb @@ -30,6 +30,8 @@ module NavHelper else "page-gutter right-sidebar-expanded" end + elsif current_path?('builds#show') + "page-gutter build-sidebar right-sidebar-expanded" end end diff --git a/app/views/projects/artifacts/browse.html.haml b/app/views/projects/artifacts/browse.html.haml index ede01dcc1aa..539d07d634a 100644 --- a/app/views/projects/artifacts/browse.html.haml +++ b/app/views/projects/artifacts/browse.html.haml @@ -1,4 +1,5 @@ - page_title 'Artifacts', "#{@build.name} (##{@build.id})", 'Builds' +- header_title project_title(@project, "Builds", project_builds_path(@project)) .top-block.row-content-block.clearfix .pull-right diff --git a/app/views/projects/builds/_header.html.haml b/app/views/projects/builds/_header.html.haml new file mode 100644 index 00000000000..46561249bb8 --- /dev/null +++ b/app/views/projects/builds/_header.html.haml @@ -0,0 +1,16 @@ +.content-block.build-header + = ci_status_with_icon(@build.status) + Build + %strong ##{@build.id} + for commit + = link_to ci_status_path(@build.commit) do + %strong= @build.pipeline.short_sha + from + = link_to namespace_project_commits_path(@project.namespace, @project, @build.ref) do + %code + = @build.ref + - if @build.user + = render "user" + = time_ago_with_tooltip(@build.created_at) + %button.btn.btn-default.pull-right.visible-xs-block.visible-sm-block.build-gutter-toggle.js-sidebar-build-toggle{ role: "button", type: "button" } + = icon('angle-double-left') diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml new file mode 100644 index 00000000000..5d931389dfb --- /dev/null +++ b/app/views/projects/builds/_sidebar.html.haml @@ -0,0 +1,93 @@ +%aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar + .block.build-sidebar-header.visible-xs-block.visible-sm-block.append-bottom-default + Build + %strong ##{@build.id} + %a.gutter-toggle.pull-right.js-sidebar-build-toggle{ href: "#" } + = icon('angle-double-right') + - if @build.coverage + .block.block-first + .title + Test coverage + %p.build-detail-row + #{@build.coverage}% + + - if can?(current_user, :read_build, @project) && @build.artifacts? + .block{ class: ("block-first" if !@build.coverage) } + .title + Build artifacts + .btn-group.btn-group-justified{ role: :group } + = link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do + Download + + - if @build.artifacts_metadata? + = link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do + Browse + + .block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && @build.artifacts?)) } + .title + Build details + - if @build.retryable? + = link_to "Retry", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'pull-right', method: :post + - if @build.merge_request + %p.build-detail-row + %span.build-light-text Merge Request: + = link_to "#{@build.merge_request.to_reference}", merge_request_path(@build.merge_request) + - if @build.duration + %p.build-detail-row + %span.build-light-text Duration: + #{duration_in_words(@build.finished_at, @build.started_at)} + - if @build.finished_at + %p.build-detail-row + %span.build-light-text Finished: + #{time_ago_with_tooltip(@build.finished_at)} + - if @build.erased_at + %p.build-detail-row + %span.build-light-text Erased: + #{time_ago_with_tooltip(@build.erased_at)} + %p.build-detail-row + %span.build-light-text Runner: + - if @build.runner && current_user && current_user.admin + = link_to "##{@build.runner.id}", admin_runner_path(@build.runner.id) + - elsif @build.runner + \##{@build.runner.id} + .btn-group.btn-group-justified{ role: :group } + - if @build.has_trace? + = link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' + - if @build.active? + = link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post + - if can?(current_user, :update_build, @project) && @build.erasable? + = link_to erase_namespace_project_build_path(@project.namespace, @project, @build), + class: "btn btn-sm btn-default", method: :post, + data: { confirm: "Are you sure you want to erase this build?" } do + Erase + + - if @build.trigger_request + .build-widget + %h4.title + Trigger + + %p + %span.build-light-text Token: + #{@build.trigger_request.trigger.short_token} + + - if @build.trigger_request.variables + %p + %span.build-light-text Variables: + + %code + - @build.trigger_request.variables.each do |key, value| + #{key}=#{value} + + .block + .title + Commit message + %p.build-light-text.append-bottom-0 + #{@build.pipeline.git_commit_message} + + - if @build.tags.any? + .block + .title + Tags + - @build.tag_list.each do |tag| + %span.label.label-primary + = tag diff --git a/app/views/projects/builds/_user.html.haml b/app/views/projects/builds/_user.html.haml new file mode 100644 index 00000000000..2642de8021d --- /dev/null +++ b/app/views/projects/builds/_user.html.haml @@ -0,0 +1,4 @@ +by +%a{ href: user_path(@build.user) } + = image_tag avatar_icon(@build.user, 24), class: "avatar s24" + %strong= @build.user.to_reference diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml index 5477fc65c2b..a26f8aeb315 100644 --- a/app/views/projects/builds/show.html.haml +++ b/app/views/projects/builds/show.html.haml @@ -1,18 +1,10 @@ - page_title "#{@build.name} (##{@build.id})", "Builds" - trace_with_state = @build.trace_with_state +- header_title project_title(@project, "Builds", project_builds_path(@project)) .build-page - .row-content-block.top-block - Build ##{@build.id} for commit - %strong.monospace= link_to @build.pipeline.short_sha, ci_status_path(@build.pipeline) - from - = link_to @build.ref, namespace_project_commits_path(@project.namespace, @project, @build.ref) - - merge_request = @build.merge_request - - if merge_request - via - = link_to "merge request #{merge_request.to_reference}", merge_request_path(merge_request) + = render "header" - #up-build-trace - builds = @build.pipeline.builds.latest.to_a - if builds.size > 1 %ul.nav-links.no-top.no-bottom @@ -33,18 +25,6 @@ · %i.fa.fa-warning This build was retried. - - .row-content-block.middle-block - .build-head - .clearfix - = ci_status_with_icon(@build.status) - - if @build.duration - %span - %i.fa.fa-time - #{duration_in_words(@build.finished_at, @build.started_at)} - .pull-right - #{time_ago_with_tooltip(@build.finished_at) if @build.finished_at} - - if @build.stuck? - unless @build.any_runners_online? .bs-callout.bs-callout-warning @@ -64,158 +44,27 @@ = link_to namespace_project_runners_path(@build.project.namespace, @build.project) do Runners page - .row.prepend-top-default - .col-md-9 - .clearfix - - if @build.active? - .autoscroll-container - %button.btn.btn-success.btn-sm#autoscroll-button{:type => "button", :data => {:state => 'disabled'}} enable autoscroll - .clearfix + .prepend-top-default + - if @build.active? + .autoscroll-container + %button.btn.btn-success.btn-sm#autoscroll-button{:type => "button", :data => {:state => 'disabled'}} enable autoscroll #js-build-scroll.scroll-controls - = link_to '#up-build-trace', class: 'btn' do + = link_to '#build-trace', class: 'btn' do %i.fa.fa-angle-up = link_to '#down-build-trace', class: 'btn' do %i.fa.fa-angle-down + - if @build.erased? + .erased.alert.alert-warning + - erased_by = "by #{link_to @build.erased_by.name, user_path(@build.erased_by)}" if @build.erased_by + Build has been erased #{erased_by.html_safe} #{time_ago_with_tooltip(@build.erased_at)} + - else + %pre.build-trace#build-trace + %code.bash.js-build-output + = icon("refresh spin", class: "js-build-refresh") - - if @build.erased? - .erased.alert.alert-warning - - erased_by = "by #{link_to @build.erased_by.name, user_path(@build.erased_by)}" if @build.erased_by - Build has been erased #{erased_by.html_safe} #{time_ago_with_tooltip(@build.erased_at)} - - else - %pre.trace#build-trace - %code.bash - = preserve do - = raw trace_with_state[:html] - - if @build.active? - %i{:class => "fa fa-refresh fa-spin"} + #down-build-trace - %div#down-build-trace += render "sidebar" - .col-md-3 - - if @build.coverage - .build-widget - %h4.title - Test coverage - %h1 #{@build.coverage}% - - - if can?(current_user, :read_build, @project) && @build.artifacts? - .build-widget.artifacts - %h4.title Build artifacts - .center - .btn-group{ role: :group } - = link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-primary' do - = icon('download') - Download - - - if @build.artifacts_metadata? - = link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-primary' do - = icon('folder-open') - Browse - - .build-widget.build-controls - %h4.title - Build ##{@build.id} - - if can?(current_user, :update_build, @project) - .center - .btn-group{ role: :group } - - if @build.active? - = link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-danger', method: :post - - elsif @build.retryable? - = link_to "Retry", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-primary', method: :post - - - if @build.erasable? - = link_to erase_namespace_project_build_path(@project.namespace, @project, @build), - class: 'btn btn-sm btn-warning', method: :post, - data: { confirm: 'Are you sure you want to erase this build?' } do - = icon('eraser') - Erase - - if @build.has_trace? - = link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build), - class: 'btn btn-sm btn-success', target: '_blank' - - .clearfix - - if @build.duration - %p - %span.attr-name Duration: - #{duration_in_words(@build.finished_at, @build.started_at)} - %p - %span.attr-name Created: - #{time_ago_with_tooltip(@build.created_at)} - - if @build.finished_at - %p - %span.attr-name Finished: - #{time_ago_with_tooltip(@build.finished_at)} - - if @build.erased_at - %p - %span.attr-name Erased: - #{time_ago_with_tooltip(@build.erased_at)} - %p - %span.attr-name Runner: - - if @build.runner && current_user && current_user.admin - = link_to "##{@build.runner.id}", admin_runner_path(@build.runner.id) - - elsif @build.runner - \##{@build.runner.id} - - - if @build.trigger_request - .build-widget - %h4.title - Trigger - - %p - %span.attr-name Token: - #{@build.trigger_request.trigger.short_token} - - - if @build.trigger_request.variables - %p - %span.attr-name Variables: - - %code - - @build.trigger_request.variables.each do |key, value| - #{key}=#{value} - - .build-widget - %h4.title - Commit - .pull-right - %small - = link_to @build.pipeline.short_sha, ci_status_path(@build.pipeline), class: "monospace" - %p - %span.attr-name Branch: - = link_to @build.ref, namespace_project_commits_path(@project.namespace, @project, @build.ref) - %p - %span.attr-name Author: - #{@build.pipeline.git_author_name} - %p - %span.attr-name Message: - #{@build.pipeline.git_commit_message} - - - if @build.tags.any? - .build-widget - %h4.title - Tags - - @build.tag_list.each do |tag| - %span.label.label-primary - = tag - - - if @builds.present? - .build-widget - %h4.title #{pluralize(@builds.count(:id), "other build")} for - = succeed ":" do - = link_to @build.pipeline.short_sha, ci_status_path(@build.pipeline), class: "monospace" - %table.table.builds - - @builds.each_with_index do |build, i| - %tr.build - %td - = ci_icon_for_status(build.status) - %td - = link_to namespace_project_build_path(@project.namespace, @project, build) do - - if build.name - = build.name - - else - %span ##{build.id} - - %td.status= build.status - - - :javascript - new CiBuild("#{namespace_project_build_url(@project.namespace, @project, @build)}", "#{@build.status}", "#{trace_with_state[:state]}") +:javascript + new CiBuild("#{namespace_project_build_url(@project.namespace, @project, @build)}", "#{@build.status}", "#{trace_with_state[:state]}") diff --git a/features/steps/project/builds/artifacts.rb b/features/steps/project/builds/artifacts.rb index 1bdb57af9d1..2876e8812e9 100644 --- a/features/steps/project/builds/artifacts.rb +++ b/features/steps/project/builds/artifacts.rb @@ -5,11 +5,11 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps include RepoHelpers step 'I click artifacts download button' do - page.within('.artifacts') { click_link 'Download' } + click_link 'Download' end step 'I click artifacts browse button' do - page.within('.artifacts') { click_link 'Browse' } + click_link 'Browse' end step 'I should see content of artifacts archive' do diff --git a/spec/features/builds_spec.rb b/spec/features/builds_spec.rb index df221ab1f3b..cb94432dbd0 100644 --- a/spec/features/builds_spec.rb +++ b/spec/features/builds_spec.rb @@ -93,9 +93,7 @@ describe "Builds" do end it 'has button to download artifacts' do - page.within('.artifacts') do - expect(page).to have_content 'Download' - end + expect(page).to have_content 'Download' end end @@ -107,9 +105,7 @@ describe "Builds" do end it do - page.within('.build-controls') do - expect(page).to have_link 'Raw' - end + expect(page).to have_link 'Raw' end end end @@ -165,15 +161,10 @@ describe "Builds" do end describe "GET /:project/builds/:id/download" do - context "Build from project" do - before do - @build.update_attributes(artifacts_file: artifacts_file) - visit namespace_project_build_path(@project.namespace, @project, @build) - page.within('.artifacts') { click_link 'Download' } - end - - it { expect(page.status_code).to eq(200) } - it { expect(page.response_headers['Content-Type']).to eq(artifacts_file.content_type) } + before do + @build.update_attributes(artifacts_file: artifacts_file) + visit namespace_project_build_path(@project.namespace, @project, @build) + click_link 'Download' end context "Build from other project" do @@ -246,10 +237,8 @@ describe "Builds" do it { expect(page.status_code).to eq(200) } end - context "Build from other project" do - before do - visit status_namespace_project_build_path(@project.namespace, @project, @build2) - end + it 'sends the right headers' do + click_link 'Raw' it { expect(page.status_code).to eq(404) } end From a6345c14011e9ffa8cca45f9058a1529c7be5b62 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 7 Jun 2016 12:02:37 +0100 Subject: [PATCH 22/87] Fixed failing tests --- spec/features/builds_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/features/builds_spec.rb b/spec/features/builds_spec.rb index cb94432dbd0..0c865e915cb 100644 --- a/spec/features/builds_spec.rb +++ b/spec/features/builds_spec.rb @@ -237,8 +237,10 @@ describe "Builds" do it { expect(page.status_code).to eq(200) } end - it 'sends the right headers' do - click_link 'Raw' + context "Build from other project" do + before do + visit status_namespace_project_build_path(@project.namespace, @project, @build2) + end it { expect(page.status_code).to eq(404) } end From bd257c3d38a704e6fd2d020943d1a96bbfe97d6c Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 8 Jun 2016 13:37:39 +0100 Subject: [PATCH 23/87] Fixed merge conflict that caused tests to fail with build --- app/views/projects/builds/_header.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/builds/_header.html.haml b/app/views/projects/builds/_header.html.haml index 46561249bb8..51b5bd9db42 100644 --- a/app/views/projects/builds/_header.html.haml +++ b/app/views/projects/builds/_header.html.haml @@ -3,7 +3,7 @@ Build %strong ##{@build.id} for commit - = link_to ci_status_path(@build.commit) do + = link_to ci_status_path(@build.pipeline) do %strong= @build.pipeline.short_sha from = link_to namespace_project_commits_path(@project.namespace, @project, @build.ref) do From e7950bd9429d104cc5ef7ca0e0195ecbace4b295 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 10 Jun 2016 10:38:31 +0100 Subject: [PATCH 24/87] Fixed project dropdown being overlapped by sidebar Closes #18410 --- app/assets/stylesheets/framework/header.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index c46d6b14782..b8d4233537b 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -185,7 +185,7 @@ header { margin-left: 0; .header-content { - padding-left: $sidebar_width; + margin-left: $sidebar_width; transition-duration: .3s; } } From 9dfb809c578735d807070d77ad567ab5c3de9b6c Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Wed, 8 Jun 2016 19:39:33 +0200 Subject: [PATCH 25/87] Fix UTF-8 handling in incremental trace update API --- app/models/ci/build.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index b8ada6361ac..6a64ca451f7 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -194,7 +194,7 @@ module Ci def trace_length if raw_trace - raw_trace.length + raw_trace.bytesize else 0 end @@ -216,7 +216,7 @@ module Ci recreate_trace_dir File.truncate(path_to_trace, offset) if File.exist?(path_to_trace) - File.open(path_to_trace, 'a') do |f| + File.open(path_to_trace, 'ab') do |f| f.write(trace_part) end end From e6209a407e2e8abee99bb61f089e262c3a5e51e8 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Fri, 10 Jun 2016 13:26:36 +0200 Subject: [PATCH 26/87] Added description of artifacts:when --- doc/ci/yaml/README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index a3481f58c6c..39fad549a04 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -30,6 +30,7 @@ If you want a quick introduction to GitLab CI, follow our - [when](#when) - [artifacts](#artifacts) - [artifacts:name](#artifacts-name) + - [artifacts:when](#artifacts-when) - [dependencies](#dependencies) - [before_script and after_script](#before_script-and-after_script) - [Hidden jobs](#hidden-jobs) @@ -651,6 +652,32 @@ job: untracked: true ``` +#### artifacts:when + +>**Note:** +Introduced in GitLab 8.9 and GitLab Runner v1.3.0. + +`artifacts:when` is used to upload artifacts on build failure or despite the +failure. + +`artifacts:when` can be set to one of the following values: + +1. `on_success` - upload artifacts only when build succeeds. This is the default +1. `on_failure` - upload artifacts only when build fails +1. `always` - upload artifacts despite the build status + +--- + +**Example configurations** + +To upload artifacts only when build fails + +```yaml +job: + artifacts: + when: on_failure +``` + ### dependencies >**Note:** From 72647eda3121566c92941a1e98088c31a77cb9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 10 Jun 2016 13:44:45 +0200 Subject: [PATCH 27/87] Don't require Gitlab::Redis in mail_room.yml if it's already defined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©my Coutable --- config/mail_room.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/mail_room.yml b/config/mail_room.yml index 761a32adb9e..7cab24b295e 100644 --- a/config/mail_room.yml +++ b/config/mail_room.yml @@ -2,7 +2,7 @@ <% require "yaml" require "json" -require_relative "lib/gitlab/redis" +require_relative "lib/gitlab/redis" unless defined?(Gitlab::Redis) rails_env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development" From c43279a8d9b22b063c1963aae3452f2fe96ea3f2 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Fri, 10 Jun 2016 13:58:33 +0200 Subject: [PATCH 28/87] Fix expose of TriggerRequest --- lib/ci/api/entities.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ci/api/entities.rb b/lib/ci/api/entities.rb index 255217b1a7c..a902ced35d7 100644 --- a/lib/ci/api/entities.rb +++ b/lib/ci/api/entities.rb @@ -56,7 +56,7 @@ module Ci class TriggerRequest < Grape::Entity expose :id, :variables - expose :trigger, using: Commit, as: :commit + expose :pipeline, using: Commit, as: :commit end end end From 07dbd6b3884c4f188b2c3f29dd7419791f1051eb Mon Sep 17 00:00:00 2001 From: Rui Anderson Date: Wed, 27 Apr 2016 15:34:42 -0300 Subject: [PATCH 29/87] Allow or not merge MR with failed build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©my Coutable --- CHANGELOG | 1 + app/assets/javascripts/project_new.js.coffee | 19 +-- app/controllers/projects_controller.rb | 2 +- app/models/merge_request.rb | 6 +- .../_merge_request_settings.html.haml | 11 ++ app/views/projects/edit.html.haml | 2 + .../merge_requests/widget/_open.html.haml | 2 + .../widget/open/_accept.html.haml | 27 ++-- .../widget/open/_build_failed.html.haml | 6 + ...low_merge_if_build_succeeds_to_projects.rb | 15 +++ db/schema.rb | 1 + lib/api/merge_requests.rb | 2 +- .../only_allow_merge_if_build_succeeds.rb | 105 ++++++++++++++++ spec/models/merge_request_spec.rb | 117 ++++++++++++++++++ spec/requests/api/merge_requests_spec.rb | 8 ++ 15 files changed, 301 insertions(+), 23 deletions(-) create mode 100644 app/views/projects/_merge_request_settings.html.haml create mode 100644 app/views/projects/merge_requests/widget/open/_build_failed.html.haml create mode 100644 db/migrate/20160419122101_add_only_allow_merge_if_build_succeeds_to_projects.rb create mode 100644 spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb diff --git a/CHANGELOG b/CHANGELOG index b00c149a753..176fc16943f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -31,6 +31,7 @@ v 8.9.0 (unreleased) - Add rake task 'gitlab:db:configure' for conditionally seeding or migrating the database - Changed the Slack build message to use the singular duration if necessary (Aran Koning) - Links from a wiki page to other wiki pages should be rewritten as expected + - Add option to project to only allow merge requests to be merged if the build succeeds (Rui Santos) - Fix issues filter when ordering by milestone - Todos will display target state if issuable target is 'Closed' or 'Merged' - Fix bug when sorting issues by milestone due date and filtering by two or more labels diff --git a/app/assets/javascripts/project_new.js.coffee b/app/assets/javascripts/project_new.js.coffee index 63dee4ed5d7..e48343a19b5 100644 --- a/app/assets/javascripts/project_new.js.coffee +++ b/app/assets/javascripts/project_new.js.coffee @@ -7,12 +7,17 @@ class @ProjectNew @toggleSettingsOnclick() - toggleSettings: -> - checked = $("#project_builds_enabled").prop("checked") - if checked - $('.builds-feature').show() - else - $('.builds-feature').hide() + toggleSettings: => + @_showOrHide('#project_builds_enabled', '.builds-feature') + @_showOrHide('#project_merge_requests_enabled', '.merge-requests-feature') toggleSettingsOnclick: -> - $("#project_builds_enabled").on 'click', @toggleSettings + $('#project_builds_enabled, #project_merge_requests_enabled').on 'click', @toggleSettings + + _showOrHide: (checkElement, container) -> + $container = $(container) + + if $(checkElement).prop('checked') + $container.show() + else + $container.hide() diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3af62c7696c..a6479c42d94 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -234,7 +234,7 @@ class ProjectsController < Projects::ApplicationController :issues_tracker_id, :default_branch, :wiki_enabled, :visibility_level, :import_url, :last_activity_at, :namespace_id, :avatar, :builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex, - :public_builds, + :public_builds, :only_allow_merge_if_build_succeeds ) end diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index b0ed8182855..43c6bcb8715 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -260,7 +260,7 @@ class MergeRequest < ActiveRecord::Base end def mergeable? - return false unless open? && !work_in_progress? && !broken? + return false if !open? || work_in_progress? || broken? || cannot_be_merged_because_build_failed? check_if_can_be_merged @@ -481,6 +481,10 @@ class MergeRequest < ActiveRecord::Base ::Gitlab::GitAccess.new(user, project).can_push_to_branch?(target_branch) end + def cannot_be_merged_because_build_failed? + project.only_allow_merge_if_build_succeeds? && ci_commit && ci_commit.failed? + end + def state_human_name if merged? "Merged" diff --git a/app/views/projects/_merge_request_settings.html.haml b/app/views/projects/_merge_request_settings.html.haml new file mode 100644 index 00000000000..da522b53417 --- /dev/null +++ b/app/views/projects/_merge_request_settings.html.haml @@ -0,0 +1,11 @@ +%fieldset.builds-feature + %h5.prepend-top-0 + Merge Requests + .form-group + .checkbox + = f.label :only_allow_merge_if_build_succeeds do + = f.check_box :only_allow_merge_if_build_succeeds + %strong Only allow merge requests to be merged if the build succeeds + .help-block + Builds need to be configured to enable this feature. + = link_to icon('question-circle'), help_page_path('workflow', 'merge_requests#only-allow-merge-requests-to-be-merged-if-the-build-succeeds') diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 18b125ff9d4..8449fe1e4e0 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -84,6 +84,8 @@ %br %span.descr Enable Container Registry for this repository %hr + = render 'merge_request_settings', f: f + %hr = render 'builds_settings', f: f %hr %fieldset.features.append-bottom-default diff --git a/app/views/projects/merge_requests/widget/_open.html.haml b/app/views/projects/merge_requests/widget/_open.html.haml index 13359abede7..8de587009e1 100644 --- a/app/views/projects/merge_requests/widget/_open.html.haml +++ b/app/views/projects/merge_requests/widget/_open.html.haml @@ -17,6 +17,8 @@ = render 'projects/merge_requests/widget/open/merge_when_build_succeeds' - elsif !@merge_request.can_be_merged_by?(current_user) = render 'projects/merge_requests/widget/open/not_allowed' + - elsif @merge_request.cannot_be_merged_because_build_failed? + = render 'projects/merge_requests/widget/open/build_failed' - elsif @merge_request.can_be_merged? = render 'projects/merge_requests/widget/open/accept' diff --git a/app/views/projects/merge_requests/widget/open/_accept.html.haml b/app/views/projects/merge_requests/widget/open/_accept.html.haml index 60d7d6ff1f5..941513febbd 100644 --- a/app/views/projects/merge_requests/widget/open/_accept.html.haml +++ b/app/views/projects/merge_requests/widget/open/_accept.html.haml @@ -10,19 +10,20 @@ %span.btn-group = button_tag class: "btn btn-create js-merge-button merge_when_build_succeeds" do Merge When Build Succeeds - = button_tag class: "btn btn-success dropdown-toggle", 'data-toggle' => 'dropdown' do - %span.caret - %span.sr-only - Select Merge Moment - %ul.js-merge-dropdown.dropdown-menu.dropdown-menu-right{ role: 'menu' } - %li - = link_to "#", class: "merge_when_build_succeeds" do - = icon('check fw') - Merge When Build Succeeds - %li - = link_to "#", class: "accept_merge_request" do - = icon('warning fw') - Merge Immediately + - unless @project.only_allow_merge_if_build_succeeds? + = button_tag class: "btn btn-success dropdown-toggle", 'data-toggle' => 'dropdown' do + %span.caret + %span.sr-only + Select Merge Moment + %ul.js-merge-dropdown.dropdown-menu.dropdown-menu-right{ role: 'menu' } + %li + = link_to "#", class: "merge_when_build_succeeds" do + = icon('check fw') + Merge When Build Succeeds + %li + = link_to "#", class: "accept_merge_request" do + = icon('warning fw') + Merge Immediately - else = f.button class: "btn btn-create btn-grouped js-merge-button accept_merge_request #{status_class}" do Accept Merge Request diff --git a/app/views/projects/merge_requests/widget/open/_build_failed.html.haml b/app/views/projects/merge_requests/widget/open/_build_failed.html.haml new file mode 100644 index 00000000000..14f51af5360 --- /dev/null +++ b/app/views/projects/merge_requests/widget/open/_build_failed.html.haml @@ -0,0 +1,6 @@ +%h4 + = icon('exclamation-triangle') + The build for this merge request failed + +%p + Please retry the build or push a new commit to fix the failure. diff --git a/db/migrate/20160419122101_add_only_allow_merge_if_build_succeeds_to_projects.rb b/db/migrate/20160419122101_add_only_allow_merge_if_build_succeeds_to_projects.rb new file mode 100644 index 00000000000..69d64ccd006 --- /dev/null +++ b/db/migrate/20160419122101_add_only_allow_merge_if_build_succeeds_to_projects.rb @@ -0,0 +1,15 @@ +class AddOnlyAllowMergeIfBuildSucceedsToProjects < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + def up + add_column_with_default(:projects, + :only_allow_merge_if_build_succeeds, + :boolean, + default: false) + end + + def down + remove_column(:projects, :only_allow_merge_if_build_succeeds) + end +end diff --git a/db/schema.rb b/db/schema.rb index b7adf48fdb4..03070f0d593 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -779,6 +779,7 @@ ActiveRecord::Schema.define(version: 20160608155312) do t.boolean "last_repository_check_failed" t.datetime "last_repository_check_at" t.boolean "container_registry_enabled" + t.boolean "only_allow_merge_if_build_succeeds", default: false end add_index "projects", ["builds_enabled", "shared_runners_enabled"], name: "index_projects_on_builds_enabled_and_shared_runners_enabled", using: :btree diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 43221d5622a..5822e19cd44 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -228,7 +228,7 @@ module API # Merge request can not be merged # because user dont have permissions to push into target branch unauthorized! unless merge_request.can_be_merged_by?(current_user) - not_allowed! if !merge_request.open? || merge_request.work_in_progress? + not_allowed! if !merge_request.open? || merge_request.work_in_progress? || merge_request.cannot_be_merged_because_build_failed? merge_request.check_if_can_be_merged diff --git a/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb b/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb new file mode 100644 index 00000000000..1627aa7287a --- /dev/null +++ b/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb @@ -0,0 +1,105 @@ +require 'spec_helper' + +feature 'Only allow merge requests to be merged if the build succeeds', feature: true, js: true do + let(:user) { create(:user) } + + let(:project) { create(:project, :public) } + let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user) } + + before do + login_as user + + project.team << [user, :master] + end + + context "project hasn't ci enabled" do + it "allows MR to be merged" do + visit_merge_request(merge_request) + expect(page).to have_button "Accept Merge Request" + end + end + + context "when project has ci enabled" do + let!(:ci_commit) { create(:ci_commit, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) } + let!(:ci_build) { create(:ci_build, commit: ci_commit) } + + before do + project.enable_ci + end + + context "when merge requests can only be merged if the build succeeds" do + before do + project.update_attribute(:only_allow_merge_if_build_succeeds, true) + end + + context "when ci is running" do + it "doesn't allow to merge immediately" do + ci_commit.statuses.update_all(status: :pending) + visit_merge_request(merge_request) + + expect(page).to have_button "Merge When Build Succeeds" + expect(page).to_not have_button "Select Merge Moment" + end + end + + context "when ci failed" do + it "doesn't allow MR to be merged" do + ci_commit.statuses.update_all(status: :failed) + visit_merge_request(merge_request) + + expect(page).to_not have_button "Accept Merge Request" + expect(page).to have_content("Please retry the build or push code to fix the failure.") + end + end + + context "when ci succeed" do + it "allows MR to be merged" do + ci_commit.statuses.update_all(status: :success) + visit_merge_request(merge_request) + + expect(page).to have_button "Accept Merge Request" + end + end + end + + context "when merge requests can be merged when the build failed" do + before do + project.update_attribute(:only_allow_merge_if_build_succeeds, false) + end + + context "when ci is running" do + it "allows MR to be merged immediately" do + ci_commit.statuses.update_all(status: :pending) + visit_merge_request(merge_request) + + expect(page).to have_button "Merge When Build Succeeds" + + click_button "Select Merge Moment" + expect(page).to have_content "Merge Immediately" + end + end + + context "when ci failed" do + it "allows MR to be merged" do + ci_commit.statuses.update_all(status: :failed) + visit_merge_request(merge_request) + + expect(page).to have_button "Accept Merge Request" + end + end + + context "when ci succeed" do + it "allows MR to be merged" do + ci_commit.statuses.update_all(status: :success) + visit_merge_request(merge_request) + + expect(page).to have_button "Accept Merge Request" + end + end + end + end + + def visit_merge_request(merge_request) + visit namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + end +end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 1b7cbc3efda..76912eed834 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -455,4 +455,121 @@ describe MergeRequest, models: true do expect(user2.assigned_open_merge_request_count).to eq(1) end end + + describe '#check_if_can_be_merged' do + let(:project) { create(:project, only_allow_merge_if_build_succeeds: true) } + + subject { create(:merge_request, source_project: project, merge_status: :unchecked) } + + context 'when it is not broken and has no conflicts' do + it 'is marked as mergeable' do + allow(subject).to receive(:broken?) { false } + allow(project).to receive_message_chain(:repository, :can_be_merged?) { true } + + expect { subject.check_if_can_be_merged }.to change { subject.merge_status }.to('can_be_merged') + end + end + + context 'when broken' do + before { allow(subject).to receive(:broken?) { true } } + + it 'becomes unmergeable' do + expect { subject.check_if_can_be_merged }.to change { subject.merge_status }.to('cannot_be_merged') + end + end + + context 'when it has conflicts' do + before do + allow(subject).to receive(:broken?) { false } + allow(project).to receive_message_chain(:repository, :can_be_merged?) { false } + end + + it 'becomes unmergeable' do + expect { subject.check_if_can_be_merged }.to change { subject.merge_status }.to('cannot_be_merged') + end + end + end + + describe '#mergeable?' do + let(:project) { create(:project, only_allow_merge_if_build_succeeds: true) } + + subject { create(:merge_request, source_project: project) } + + it "checks if merge request can be merged" do + allow(subject).to receive(:cannot_be_merged_because_build_failed?) { false } + expect(subject).to receive(:check_if_can_be_merged) + + subject.mergeable? + end + + context 'when not open' do + before { subject.close } + + it 'returns false' do + expect(subject.mergeable?).to be_falsey + end + end + + context 'when working in progress' do + before { subject.title = 'WIP MR' } + + it 'returns false' do + expect(subject.mergeable?).to be_falsey + end + end + + context 'when broken' do + before { allow(subject).to receive(:broken?) { true } } + + it 'returns false' do + expect(subject.mergeable?).to be_falsey + end + end + + context 'when failed' do + before { allow(subject).to receive(:broken?) { false } } + + context "when project settings restrict to merge only if build succeeds" do + before { allow(subject).to receive(:cannot_be_merged_because_build_failed?) { true } } + it 'returns false if project settings restrict to merge only if build succeeds' do + expect(subject.mergeable?).to be_falsey + end + end + end + end + + describe '#cannot_be_merged_because_build_failed?' do + let(:project) { create(:empty_project, only_allow_merge_if_build_succeeds: true) } + let(:commit_status) { create(:commit_status, status: 'failed', project: project) } + let(:ci_commit) { create(:ci_empty_pipeline) } + + subject { build(:merge_request, target_project: project) } + + before do + ci_commit.statuses << commit_status + allow(subject).to receive(:ci_commit) { ci_commit } + end + + it "returns true if it's only allowed to merge green build and build has been failed" do + expect(subject.cannot_be_merged_because_build_failed?).to be_truthy + end + + context 'when no ci_commit is associated' do + before do + allow(subject).to receive(:ci_commit) { nil } + end + + it 'returns false' do + expect(subject.cannot_be_merged_because_build_failed?).to be_falsey + end + end + + context "when isn't only allowed to merge green build at project settings" do + subject { build(:merge_request, target_project: build(:empty_project, only_allow_merge_if_build_succeeds: false)) } + + it 'returns false' do + expect(subject.cannot_be_merged_because_build_failed?).to be_falsey + end + end + end end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 9da69a913a8..91c25a0948f 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -419,6 +419,14 @@ describe API::API, api: true do expect(json_response['message']).to eq('405 Method Not Allowed') end + it "should return 405 if merge_request build is failed it's restrict to merge only when susccess" do + allow_any_instance_of(MergeRequest).to receive(:cannot_be_merged_because_build_failed?).and_return(true) + + put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge", user) + expect(response.status).to eq(405) + expect(json_response['message']).to eq('405 Method Not Allowed') + end + it "should return 401 if user has no permissions to merge" do user2 = create(:user) project.team << [user2, :reporter] From 6dff7c1771e0cfeb6906244649b3683090bc2929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 7 Jun 2016 13:01:34 +0200 Subject: [PATCH 30/87] Improve initial implementation of the 'only_allow_merge_if_build_succeeds.rb' feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on the feedback from reviewers. Signed-off-by: RĂ©my Coutable --- app/models/merge_request.rb | 19 +++- .../merge_requests/widget/_open.html.haml | 2 +- lib/api/merge_requests.rb | 5 +- .../only_allow_merge_if_build_succeeds.rb | 92 +++++++++---------- spec/models/merge_request_spec.rb | 63 +++++++++---- spec/requests/api/merge_requests_spec.rb | 5 +- 6 files changed, 113 insertions(+), 73 deletions(-) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 43c6bcb8715..949cafc065f 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -260,13 +260,20 @@ class MergeRequest < ActiveRecord::Base end def mergeable? - return false if !open? || work_in_progress? || broken? || cannot_be_merged_because_build_failed? - - check_if_can_be_merged + mergeable_state? && check_if_can_be_merged can_be_merged? end + def mergeable_state? + return false unless open? + return false if work_in_progress? + return false if broken? + return false if cannot_be_merged_because_build_is_not_success? + + true + end + def gitlab_merge_status if work_in_progress? "work_in_progress" @@ -481,8 +488,10 @@ class MergeRequest < ActiveRecord::Base ::Gitlab::GitAccess.new(user, project).can_push_to_branch?(target_branch) end - def cannot_be_merged_because_build_failed? - project.only_allow_merge_if_build_succeeds? && ci_commit && ci_commit.failed? + def cannot_be_merged_because_build_is_not_success? + return false unless project.only_allow_merge_if_build_succeeds? + + ci_commit && !ci_commit.success? end def state_human_name diff --git a/app/views/projects/merge_requests/widget/_open.html.haml b/app/views/projects/merge_requests/widget/_open.html.haml index 8de587009e1..9ea4df4357f 100644 --- a/app/views/projects/merge_requests/widget/_open.html.haml +++ b/app/views/projects/merge_requests/widget/_open.html.haml @@ -17,7 +17,7 @@ = render 'projects/merge_requests/widget/open/merge_when_build_succeeds' - elsif !@merge_request.can_be_merged_by?(current_user) = render 'projects/merge_requests/widget/open/not_allowed' - - elsif @merge_request.cannot_be_merged_because_build_failed? + - elsif @merge_request.cannot_be_merged_because_build_is_not_success? && @ci_commit && @ci_commit.failed? = render 'projects/merge_requests/widget/open/build_failed' - elsif @merge_request.can_be_merged? = render 'projects/merge_requests/widget/open/accept' diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 5822e19cd44..24df3e397e0 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -228,11 +228,10 @@ module API # Merge request can not be merged # because user dont have permissions to push into target branch unauthorized! unless merge_request.can_be_merged_by?(current_user) - not_allowed! if !merge_request.open? || merge_request.work_in_progress? || merge_request.cannot_be_merged_because_build_failed? - merge_request.check_if_can_be_merged + not_allowed! unless merge_request.mergeable_state? - render_api_error!('Branch cannot be merged', 406) unless merge_request.can_be_merged? + render_api_error!('Branch cannot be merged', 406) unless merge_request.mergeable? if params[:sha] && merge_request.source_sha != params[:sha] render_api_error!("SHA does not match HEAD of source branch: #{merge_request.source_sha}", 409) diff --git a/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb b/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb index 1627aa7287a..52612c91824 100644 --- a/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb +++ b/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb @@ -1,99 +1,99 @@ require 'spec_helper' -feature 'Only allow merge requests to be merged if the build succeeds', feature: true, js: true do - let(:user) { create(:user) } - +feature 'Only allow merge requests to be merged if the build succeeds', feature: true do let(:project) { create(:project, :public) } - let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user) } + let(:merge_request) { create(:merge_request_with_diffs, source_project: project) } before do - login_as user + login_as merge_request.author - project.team << [user, :master] + project.team << [merge_request.author, :master] end - context "project hasn't ci enabled" do - it "allows MR to be merged" do + context 'project does not have CI enabled' do + it 'allows MR to be merged' do visit_merge_request(merge_request) - expect(page).to have_button "Accept Merge Request" + + expect(page).to have_button 'Accept Merge Request' end end - context "when project has ci enabled" do - let!(:ci_commit) { create(:ci_commit, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) } - let!(:ci_build) { create(:ci_build, commit: ci_commit) } + context 'when project has CI enabled' do + let(:ci_commit) { create(:ci_empty_pipeline, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) } - before do - project.enable_ci - end - - context "when merge requests can only be merged if the build succeeds" do + context 'when merge requests can only be merged if the build succeeds' do before do project.update_attribute(:only_allow_merge_if_build_succeeds, true) end - context "when ci is running" do - it "doesn't allow to merge immediately" do - ci_commit.statuses.update_all(status: :pending) + context 'when CI is running' do + before { ci_commit.update_column(:status, :running) } + + it 'does not allow to merge immediately' do visit_merge_request(merge_request) - expect(page).to have_button "Merge When Build Succeeds" - expect(page).to_not have_button "Select Merge Moment" + expect(page).to have_button 'Merge When Build Succeeds' + expect(page).not_to have_button 'Select Merge Moment' end end - context "when ci failed" do - it "doesn't allow MR to be merged" do - ci_commit.statuses.update_all(status: :failed) + context 'when CI failed' do + before { ci_commit.update_column(:status, :failed) } + + it 'does not allow MR to be merged' do visit_merge_request(merge_request) - expect(page).to_not have_button "Accept Merge Request" - expect(page).to have_content("Please retry the build or push code to fix the failure.") + expect(page).not_to have_button 'Accept Merge Request' + expect(page).to have_content('Please retry the build or push a new commit to fix the failure.') end end - context "when ci succeed" do - it "allows MR to be merged" do - ci_commit.statuses.update_all(status: :success) + context 'when CI succeeded' do + before { ci_commit.update_column(:status, :success) } + + it 'allows MR to be merged' do visit_merge_request(merge_request) - expect(page).to have_button "Accept Merge Request" + expect(page).to have_button 'Accept Merge Request' end end end - context "when merge requests can be merged when the build failed" do + context 'when merge requests can be merged when the build failed' do before do project.update_attribute(:only_allow_merge_if_build_succeeds, false) end - context "when ci is running" do - it "allows MR to be merged immediately" do - ci_commit.statuses.update_all(status: :pending) + context 'when CI is running' do + before { ci_commit.update_column(:status, :running) } + + it 'allows MR to be merged immediately', js: true do visit_merge_request(merge_request) - expect(page).to have_button "Merge When Build Succeeds" + expect(page).to have_button 'Merge When Build Succeeds' - click_button "Select Merge Moment" - expect(page).to have_content "Merge Immediately" + click_button 'Select Merge Moment' + expect(page).to have_content 'Merge Immediately' end end - context "when ci failed" do - it "allows MR to be merged" do - ci_commit.statuses.update_all(status: :failed) + context 'when CI failed' do + before { ci_commit.update_column(:status, :failed) } + + it 'allows MR to be merged' do visit_merge_request(merge_request) - expect(page).to have_button "Accept Merge Request" + expect(page).to have_button 'Accept Merge Request' end end - context "when ci succeed" do - it "allows MR to be merged" do - ci_commit.statuses.update_all(status: :success) + context 'when CI succeeded' do + before { ci_commit.update_column(:status, :success) } + + it 'allows MR to be merged' do visit_merge_request(merge_request) - expect(page).to have_button "Accept Merge Request" + expect(page).to have_button 'Accept Merge Request' end end end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 76912eed834..f8f1bbf3036 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -491,12 +491,39 @@ describe MergeRequest, models: true do end describe '#mergeable?' do - let(:project) { create(:project, only_allow_merge_if_build_succeeds: true) } + let(:project) { create(:project) } subject { create(:merge_request, source_project: project) } - it "checks if merge request can be merged" do - allow(subject).to receive(:cannot_be_merged_because_build_failed?) { false } + it 'calls mergeable_state?' do + expect(subject).to receive(:mergeable_state?) + + expect(subject.mergeable?).to be_truthy + end + + it 'calls check_if_can_be_merged' do + allow(subject).to receive(:mergeable_state?) { true } + expect(subject).to receive(:check_if_can_be_merged) + + expect(subject.mergeable?).to be_truthy + end + + it 'calls can_be_merged?' do + allow(subject).to receive(:mergeable_state?) { true } + allow(subject).to receive(:can_be_merged?) { true } + expect(subject).to receive(:check_if_can_be_merged) + + expect(subject.mergeable?).to be_truthy + end + end + + describe '#mergeable_state?' do + let(:project) { create(:project) } + + subject { create(:merge_request, source_project: project) } + + it 'checks if merge request can be merged' do + allow(subject).to receive(:cannot_be_merged_because_build_is_not_success?) { false } expect(subject).to receive(:check_if_can_be_merged) subject.mergeable? @@ -506,7 +533,7 @@ describe MergeRequest, models: true do before { subject.close } it 'returns false' do - expect(subject.mergeable?).to be_falsey + expect(subject.mergeable_state?).to be_falsey end end @@ -514,7 +541,7 @@ describe MergeRequest, models: true do before { subject.title = 'WIP MR' } it 'returns false' do - expect(subject.mergeable?).to be_falsey + expect(subject.mergeable_state?).to be_falsey end end @@ -522,23 +549,27 @@ describe MergeRequest, models: true do before { allow(subject).to receive(:broken?) { true } } it 'returns false' do - expect(subject.mergeable?).to be_falsey + expect(subject.mergeable_state?).to be_falsey end end context 'when failed' do before { allow(subject).to receive(:broken?) { false } } - context "when project settings restrict to merge only if build succeeds" do - before { allow(subject).to receive(:cannot_be_merged_because_build_failed?) { true } } - it 'returns false if project settings restrict to merge only if build succeeds' do - expect(subject.mergeable?).to be_falsey + context 'when project settings restrict to merge only if build succeeds and build failed' do + before do + project.only_allow_merge_if_build_succeeds = true + allow(subject).to receive(:cannot_be_merged_because_build_is_not_success?) { true } + end + + it 'returns false' do + expect(subject.mergeable_state?).to be_falsey end end end end - describe '#cannot_be_merged_because_build_failed?' do + describe '#cannot_be_merged_because_build_is_not_success?' do let(:project) { create(:empty_project, only_allow_merge_if_build_succeeds: true) } let(:commit_status) { create(:commit_status, status: 'failed', project: project) } let(:ci_commit) { create(:ci_empty_pipeline) } @@ -550,8 +581,8 @@ describe MergeRequest, models: true do allow(subject).to receive(:ci_commit) { ci_commit } end - it "returns true if it's only allowed to merge green build and build has been failed" do - expect(subject.cannot_be_merged_because_build_failed?).to be_truthy + it 'returns true if it is only allowed to merge green build and build has been failed' do + expect(subject.cannot_be_merged_because_build_is_not_success?).to be_truthy end context 'when no ci_commit is associated' do @@ -560,15 +591,15 @@ describe MergeRequest, models: true do end it 'returns false' do - expect(subject.cannot_be_merged_because_build_failed?).to be_falsey + expect(subject.cannot_be_merged_because_build_is_not_success?).to be_falsey end end - context "when isn't only allowed to merge green build at project settings" do + context 'when is not only allowed to merge green build at project settings' do subject { build(:merge_request, target_project: build(:empty_project, only_allow_merge_if_build_succeeds: false)) } it 'returns false' do - expect(subject.cannot_be_merged_because_build_failed?).to be_falsey + expect(subject.cannot_be_merged_because_build_is_not_success?).to be_falsey end end end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 91c25a0948f..a52148e8b83 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -419,10 +419,11 @@ describe API::API, api: true do expect(json_response['message']).to eq('405 Method Not Allowed') end - it "should return 405 if merge_request build is failed it's restrict to merge only when susccess" do - allow_any_instance_of(MergeRequest).to receive(:cannot_be_merged_because_build_failed?).and_return(true) + it 'returns 405 if the build failed for a merge request that requires success' do + allow_any_instance_of(MergeRequest).to receive(:cannot_be_merged_because_build_is_not_success?).and_return(true) put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge", user) + expect(response.status).to eq(405) expect(json_response['message']).to eq('405 Method Not Allowed') end From 282674c1108bdd761f4027910a32396fe253bc95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 7 Jun 2016 13:02:55 +0200 Subject: [PATCH 31/87] Add documentation for the 'only_allow_merge_if_build_succeeds.rb' feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©my Coutable --- doc/workflow/merge_requests.md | 11 +++++++++++ .../only_allow_merge_if_build_succeeds.png | Bin 0 -> 17552 bytes 2 files changed, 11 insertions(+) create mode 100644 doc/workflow/merge_requests/only_allow_merge_if_build_succeeds.png diff --git a/doc/workflow/merge_requests.md b/doc/workflow/merge_requests.md index 1b5718c91c1..d2ec56e6504 100644 --- a/doc/workflow/merge_requests.md +++ b/doc/workflow/merge_requests.md @@ -2,6 +2,17 @@ Merge requests allow you to exchange changes you made to source code +## Only allow merge requests to be merged if the build succeeds + +You can prevent merge requests from being merged if their build did not succeed +in the project settings page. + +![only_allow_merge_if_build_succeeds](merge_requests/only_allow_merge_if_build_succeeds.png) + +Navigate to project settings page and select the `Only allow merge requests to be merged if the build succeeds` check box. + +Please note that you need to have builds configured to enable this feature. + ## Checkout merge requests locally Locate the section for your GitLab remote in the `.git/config` file. It looks like this: diff --git a/doc/workflow/merge_requests/only_allow_merge_if_build_succeeds.png b/doc/workflow/merge_requests/only_allow_merge_if_build_succeeds.png new file mode 100644 index 0000000000000000000000000000000000000000..18bebf5fe9269fdb393b8c7bd1a548b57a876707 GIT binary patch literal 17552 zcmd_RWn5J4`UVP$qBKZ%BMs7xba%%fpwgX#q;$g&(%nc&3Iixgmvj%JL-){q7O(H# z`@etZ{p~O3t9F^qWdpM{pk1Czh6v%-hV+-0R46QA8q{o;y<#0kd!(lS`OFNOzXd*w(rM{Jn_j%^R4J`iMm(U}8^jI$ zo1~nKt%^^w@?K85gowSldMo+%r8ci#2674i#c!T_i(mx2zvV*2V=MXeQ(>Cl)u~N9 zDb7RdPk${B(i1R&h4|t3XPWKGob5X1jwUKKpmx!nEVq%lMmzn*YYIW_#f5*G@ROnXHUIbu+ zjTNZT+&6yEh!0~Bb5XNsRC)0{`Lp>*NK!Dn>d$fk6@FiDZ?3ez%{M#U1yCVuwe6-q z&b4{fWZ*k3G&x+KA2u)hziWBpu^Fq5ecMe9cX<1!D@lg^)emOX5~Zq{gs5>8BA!bg zGbzsyEHv4?Hd@=$RRLGK0;^qHZ!7mpddkwB9KOys+MRgvz5l`GSNvu$H5e6J+~>HA zs06VBOuo@}N+}nMl(($4wY9psx(PO2Wvm@NDGD@ueKKRl=fBwEGVq!e6Wq=mP!ZcE z;iRgn8hWLQP044Q+*J4#*pQ_LnBmIdi4}VN4`U9qwJYgXIgx04ZTsSw(`4G)D*m1h3r(twnydR;Q&%^YYT1C|Bn1$5~ON(XiYS>lSmGnv=byh5AkQl)af`GkKEEyW2J`52s!mk2JQc z_ib76&<~>$ccN&51t$t-0%zmOoCKy&gx{3Q6_;C_XgwKZTyEFsua#;2YTNG+iAggHxH$nt&#w0Jp-j-bz0dNE&1U`=#c!24 z8xaZm!{Bc%ZWoAE%-I?v^7GHV64wXcK>6P$t{GN+i>Q7v<@(}vNPYG_+gsx7IJc0{ zp^I*LwK|Zp(#P*GUp8NfT) za1R+ls}XWcJ@&0cI(Z$d%OBF%vX9nt13J*7re4i}EAfVQe#zcETg1_;a;0;5WeV!6 zyqe|>-nbY_=Q+_dz^HV53J3tJdt~LP`OW3Y8SLHuG6r}_={D+6hVzZW z_~TJ%LNi9il*1Q)g1}ZmBlpjSSe?+xa6l5L6IrBUaq@%~$b&-c>aZ zH?^#-j(WPLk{MNrOGs;9a@MFq3j>*_gPS?nxn0lxG4ZfUR&I@T!&Elkr^qhd7 z_n+knl*0n2tTOB9w&~9FjAZb!#$1r^77r@8t%g9&-&D>N-q!jnYx!p2?{4Lm4=j!q z%FAD{V1SJ$qaQ>$igk?N2*W)-Lo zp6V0)TP=PV(A0c_vKu$a5H_?;{VV{!{Vc<19UJU_%i@V~VZ_r}b`Mvr9&ThP>4Gi= zVHcO2Zi03k`NP=Yo9ajCge|Xx>?gMm0SUn*@jaQ7AV;*Ge#Wq^*)c5}lNtLx{{BcB zq>a6*E^)(~^&MUNkqgEjeax$q0?mwv)h(?JXGVuX5r9DY6baK~P>QxV$pOfhwZ0Yt z1&xdBL!YG_tb|jwhJTA8;pvJV!yh?imm9rFxlYiZX=6b5-ut{RT0hcTg~77qG^_Co z0F-gj3z{0~1%x#0ph9@_M}F`;=kf5yT>W~9YNi%*6`}KCH<3u$Ns3Fkml$9Ni?v*D zEbei;oP?wOcpMH9{u{1haS)e|bvxN_Wu-w9$xoj#eis@*2d6Z^+$U5yMjG8l#hL@| zZsY8hK>XHW8bMjJlMaOA4h$@dHR~?N>0A9Gulo}0`zpOB7bNbkkCGPWs0eoZuhuf1 zE>{49@mpzQTf0Yj!VK*-&op?MN7838X(tLohf0^+rL1^^F(*R zaLnIygY*%8=_Ot9l*H}1B_mwbtfsRLZBU)gWW|+Mu13#rg$y7$m^(o2xK>H)xqYA zd@sc}tBY5`+ccCQVDD4;K-cuZgXLTBlIYh*MV37=io$AT8@lN=guhK13lan}N4Fr& zk9TI?G=cK*j-)|vN%Ad|@%ChS5+%Sp3YEf>+PCS=-tF?S zfHP74OaKQFg*Q(4h@~{P*u9TcNoXl$ihH^J43_CApGk%=0>B@?C+&MUOopDdgt)iTwT6$uP@ucqkZKP%NMP%H?%yxw~C`|fWglnmiOnyf zg<23Ja`z?WLGRt)vKE*yb5g;Mmg9?142Lq0SS2M6oOj_&r2hnTFbRWe6=K@z{#2xO zOHUxch!@kO)4x3vyXbB719h>JWc|u6SSq`*PnzG+us{YohbsFM{7lB+l%cS?@_o4p zd01oAz4?|l_rs6Vk&fA%D7BIX2}HNtUT%Lo*Z_*Vs21qL{PI?O!wE@FVY~z_M?B?v;Lo9OfP0zxMUEKDn7? zO}n8&qS=1#SM{SeT8AH%?E)@0nHqhkWUcDa8C5fiV7Q5|x8kyAx7u5a9ZZ96=Za1% zPbMcPpYvB$SL>;5HDSyp%-DSFu@lJv_r_5WWaoqOF^tUgImkcc(HrqFed7)ATm^-B zmO2~CSLk(aeaURSQZt*8w+~&{e0B?! zhOJ@!87&e`&6ekq+jKUeiI%X#d_x%w;NwL@9}@m}I7mn|PS0KdDpLjnSl?W=sfcN2 z)9Zdb-Sdu{(*@N_Pfn>n{tgmS2ox}(pMj@^CQ9D&0BJ&}`OA+2`jLV$rXA_&>NY-K z$#m+NyO!|W!K(|RM#|f;QTBAwPDf8p?}}vQ;hC-N*U}?WxeyZ(MM#Lr21tqLQc+T3 zy?oJ6mmi z*CsvUtP@z4Kr>=6S!@pi;VPahAtdxUYVI>Sti_xw=C|3Tm*rdhxWk7SB7m2-7OAH3 zR&JTtb#7O4Y<1e>;_g|4-Hlu|5z|27nU;}}rl#gnMG4hZ6|YLLZh=&adXzs*hs6U> zjlrtp*xQgu{-ozo93ZIo=U|`WUTO%^m%Yr|nXOC#r?)TCk;Q{QS#+aKup}x#1MWJ! zJjO;+k1cra zc;Y1K!iuREiKbf}{90a;KJPQ~nWe>qpJR9dX}v7Z5&L=rHn;cSuSnWR%V(sQKo z{_D>vm*iEAbIui&l@flJ$DdPL7o?i!;%@e&1MM0?B$IU6lZvxul53Pdev`9ua8L#( zc(FMdKjbXzEjdWzdC$&xFZoh1R{d%nU0vqtlP9V=!0v2Q!!V)YSQIZFj+e@x(7uv_ zJ;nO*bm#PjnHe26w&sbChrqLM2Osqa@;ffhg6X0Q0N+`*eV?)a^|;ZtOPp$Zg4fSC zSt>M~@BR`%ni`W<_kN@88w(VI3KP^rWpBWXunS}44e{$KdAX{L-Xa{g&k&V3IzKdtgeT=*fJpnh{W^iNbiyZ)@WU3PRo6rSy{p<{>fYx z1KmRdA&CA$E|ppiv@AI*f4c|?oQNL<8rIAI033tni$g7crtB_p7ic_tbl7f#cBI~$JM|RVC#4)0FLzA z>m~?rkPAa80ABFUD%*pww9KjV=G50=z#{_zbESJ=O`q}W+8q}GxI?iIoZ3%Psc;`v zx9zn`V~e>1Q4l)|$$$WWXbvhM3YBEZ=0olDta zSKI50_1w{8P2!5sS?BRUh4dM-0Mp0aUxcpPJyfrj1Md8+@$8@`IU>U$5 zXd%5SVplu$TEyAk*TPm&xj_roF(h5quNDZK8TzqGCj5zO|8#8SA|O*g!+C zK3p^u@);6-x`mw}RLTg3kgxRiDhi;--DS+ugBR?MwEcskpA6EXx%OB5GiPyPNN?zD zHYb?cevHXeEjWYJFJ$w|p7OCQgaLH{d4Ea=6UxD>)YZ{l_?>IQrF8ZpRe#aw(g zL^Aze-}GKB{?ZNu4|-0fYPM{6abh_E;MfbTI3NB9;pv_tAv9=qq*!V+_MUX1sCnG5 z{A=oWqK_>>n7cQwQ9|@LZ2xet!)=T?Cad1`{9;AWBBBq>(gN@yS$i8MBVt&WM2yiv zy-PL-r-bTl4S4Y3uLSJO*QOJV7!f?}NeqnvFDa z!)OC$7+A<962R!eZc6Wc+N!a~C_#eoH0=WP4A~$*#nfO%X$=zEXVnp<(pZ)_vfVrA zm|t6sdFAh}mhbWqg>*p%)G__EVmqG(IjDROUe>&}#+vx_o&WSoGKS(UShT-wC5(*2 zHoO_#=HY3f^sa_C&9?(#HiD$p<`#_yHH(Bc-YsP-aW+Cdp@_NV%VFf{Nanccw}g1} zINE2iWRD*A9Z(WE*gYlFhJ3ijzR4LS{LqA>jv&P;B7e)}A$+kw?$YHcqc1DK(wA5&Y)InE`TWXxpqHZ%O(L@-+ONz8*?%xfKFoWAF^77s zzE;LZTbKGh%eAgXike1$h-lb`8iSN_KAxtx+vdy{wVWQeCII|X5hSG{Mn{gXC`A_X zT5U(_v;F>VIEJg~_avHLO=XY-{cLO(3dUt2?%AT-=v@;0O*KGk-LzxcTAx0zUpo%u z9%MhN?oNV&c=n-3Y9oO`B&Jy3NwG0q({!6q$<1ml{h>q5xP=LWU0#`nX?d|B<>>Zk zk2o%;UHR9d`=#m4X>1?@FeV0mltQ^Xg#q>44msWPrv%(S{lo8m-M)Fvx;dx&VBN+R zSetJ~#O43JHVor3n_QtU;$5yYm}Y$TX0WHG_cU2ekNg&vIrkl;Pae0U>_F?Q0hru9XB!s4-<$8}O&I1Jhg%PsAEJDfoQ zIF7je(LSM`MIyL?k8Su%F^Sj9O(m&a-^eP$1Zjp97|i=RxJ2pZ9{N1(9y-77%(cVm z?7vEkgP&Y0TL;z^DS%>gWt*QqR7-;9NMggLtqp#;-FVaarm2rHc=E9+`K-ux>o^!_ zk0wFuWf2x?w<(}5sd0MFz~tO;xM|O(v`~);c#T#v1AdPn^3a1H^~h3q`HoDx={z4p zH7i*EZ9I7L6hKf_3)yxm>+7jo;h#LtkSr;SQT^mFA@gqRa04et(MSk`YpSBWCJ^IpgFg(i z3igZGMu#Vi75b_N zC1M5=_F*gcm}7Lj!Jt-1C3;xIoAMQb2$P{@pW$B(PewVK`h=Xo6cR9CmxJ_v%yKl% zIWhG@8J)PP2>%sL!X=Val4j;aGoTQrp8U!2vHc#i=^@DP;$HAdYpF#l#gWh~a<1u= z5EMcL$nkp~)CsJ~!rq0l zOZ9ljG3Mmco5M`h+>aSZ%{08o+hNt3wZEdHEfL{Y~1)`Wa{P+i-UzOO*sDL`>USUJkWwzM0XTDJ!v- z2Tvbef@70n=zFBZPw<&#fGY=xzC3PQO!{6hZ0#hvXORs zM+%Z2kzYV$+)-&6GDO6ILyS96loIxIxUO5l(18vwn??p+l~kfHqMxZsR3eP7fVuv4 zns^;K7BouILlxVCr}>MUEZDH(WupR~t>$|ga3O9Hs}-R80A`@)clFv=|nI;5R zT1N@cL2f_NucTTpLA~4K82w}!Gm}%G_KZjdE|1YHbM_dGrOS|iTOEx}QWfssAA!Z~ z5TokZl*Ci?uAzBCJC1s{yH98c(H9%~S*wDR{zI#_PJuXM&LW!q#}HTAlj)vtD9MS> zN-PznDp*E)W0*3sq%K@z7cjfX??cTT6gVED1p8Tb?JD z_Sq|d=2(B`|EiWz#k2ar_%p^lLdSJRC3XM(g%a@recY$qJw^JOuDMQ9WB2b+3=(ix z0m&2YE?NT%Au??<2}PKUnQ{Y8O_XeI)sQrTW9Im)lN_TVvZD7a_c(pcosNP`3Xaj& zNinz7MlLCjqr88Sp6B@eWVsnW7Kz@32J{|NdO*VVdpTx1TbFsBpF`Yy;Mxhg+Uqw8 zAl0AVK;Y;MR9&6h)6~sqYU|bmTg4RSF7~6PEVVFU^QxnfvWe~rt z`>o>rd{ER425m$E)=x;&JeXPiQi6GE`aQ=?JQz1p2KlA&gyrNfLS6bdyKM9|VK#1} zlUO1sx>^3JWW{MS+&TTQjjU582Wq``f!i3#A3fBCDFZQeYI|Kt-PL zmQw|W!Y>c3@rAgldY_)z7%G5-%!<`{Hz_2_TYkrhV7;Rcx7nCZfYL@rRu#TnnFK;t z#<^o%F;8qCKQO{7f~c+2faxmpus`H{r}%k}IMd94U|$s%Jp&*p)~f;3|Ip zkeOM7f|?Muos!b>bY!94t5qI=WFj)VX_F zb2D5-#zk*}zJ@$|@@OeQG4jP1kpDBaDJh8JIg*5hA}Eo5WK%0#yG2SePA7Tv)uCo= zgC9OfBNlgEIlkRW@L~S~t1pn8fpQVEq&^^?ReU*p zv|GgnQe=@FwEZPA4$a?^BTfr$xYt4ybXF+(Z?E>3wd;nnHe{vD(m&Fe;oxR)Yo}qp z2q}Agosdc=)&OnFAJ8EC{-T%7E%f-u?W168#$Uq{Kxp0C8Pf?bGk>PM^T${jJN%mi zM8O$)P@0jkaRlDtjVha0Xe4e$A{FPo73CG?R7O00$Ph!ex_Zu+yD%b;==pq_RpRg> zivv>Rb(+vgVc#9Zr49 zln4#QS9Z`W4Hq7RSXoi7h>hlGwT>4%wbnm?J)7_I%-8gO;G{^!DwC_-t2GMAfL3Rc!7qX1>E_g!#kPLxb<^{+a4t?iDsGW9}9dBY^; zIjI0DD+Av1`hgPC0}Oi3nUydZ;^g?^Z1-`+=SrTM^{|RIF~swlGTo#{T+CYfbn&S1os6(B17>=YmtG zA9R03g3AI#ho&M(m}h$b`geSJ9unR}>@*PHBMNL|7k` z6~?`AyaT55%H3b%`viB?VIou}*mW>C$g;I63a+~MGFU}54zB7>qs`cGTVOd|>ME?F z8uG)ZHKZGMZt_svUf!SXX%DrNJ04gw0#vGk{a_;l#+CA2hZHhHjw3J?XhjX?TM4wV ze|$hg%NdUBPVDpoZ~nKcINN5^a%bBN+MI?NlpF|#YykpuaOJ1z%M}~xX4ao6y+9ruZYz99kokS z9B)jG0Sve)dl~g!I5Av3+!vv5o@lmvjY8?I3(v@c*oPT}6o!soeiLm#8~Y^CKY zJ9Cegr2hvkS-!p;cx0jO*s>B|cd)e-=}~^! z`5BC<2y0>ZTIKsAO1|(FEtVvb-G>NjFFfjNFi$*dO z`w4ICQ%W#Au`~YRw8+Q%prQPr>X8agV$AC=D%Nxf+wVtLB1y?Iz6J$ILj6_}jW5!y zC%f_Op@%&;MiE9cCT^G(*sKpCFtk`PW+++@m$<7goo8z-pe)GDHD6zeW%4u;|_xnO)B665Q&V*c=PvDPNzd8)rUYshT9XGr3 zza8|(qD{ycR1cCnn0@w-GkMb5VL04}+P9UQW zP>~#`!SQ4i0=$>O(vRZlpkcliks<<(Zv-C@bBBy7;%TN@BN4_=pI5ZjoC7i4E&8#xy$~7NzjGr&bj=^>YiOxbF-SVUQp$JLz zR4YM{e;TROc!sVDUQSX(0%|!I3yp)@GnAw8fmc23R(rGzTs`GJa`SJmuQByZJs}A^ zKBLGEG9teZA~wdhoHP*qTnpp+uYqkDvdJ zkO@1k$;iX#CM+T3e$CWDObzT2yK&1s75SfsrKh1ir({m{Cc-bv#oWRgxpX}`>%E9t zHDxrB!pz(mbC$v-3tM`Q8O}HHeu**dhuo9=vK~<`V{Et%?G?c`sSO-h8#_BHAHw1{EynVD953%P z$}+Gw_=mJh2_l|ghLa0%Alt*>a9mYY)!yEIc)Pc^XWZ=A{dnA+Y8C&H89db8Rdn=- z_-CwHdSYVY?d@$EwrRVMN2)?oGzTis7!H^@>epyL`zCz;=g(KNraT+G1qQm75m2tT zdR}k&onTo*7k|GPX^?uuiltfp+fl?~ymrq1t@gmtH82HTObQ`adSy}H^I9Vn;@IUn z%ie}gRS~Z}6}3{6`y2{20T57+$+)eb&jL_w6_A53Ay+sSflVN* zx!ga1PQ=l0?F{6-;LfMr??=ca>?PC>sOSiDzMBmSIKgzH?~_9~;C!~hT&o{cL+zaRc%p7QU9|Jcv} zs{<}0-Q2<3g_;g>+nd_b)eG2mjhd&wt)IT{E)}915DH27D%m@$uk->~Rb#owX@3`s zrho7Xeg-6V!iGag7>D3qEY+6-qs{9bsqcgh&((n9!`3&(9gwW834I7jL^w88jwl#$ zygBiK!_)`y`n^LmHznKJ=8^5x7^{Sk%{tTVCgS`kJ>WAU9w?x5-5fa@AhwL*?g1_g z`>dB=B!q>1_7*=^e7!u`HhcFqUpl-Z%ek*yyR;%6sK*n%cjSQLv{-;Civ`?5eLP}f zVl-lb)Wl6sEZJ0V{BWi~=X742^v*05iM8Y2;coMCN5Gx`8&WzKplo$CN38PlCr~Zw z;bhqAzKIIX8V`!65RsF{_Ndiie1v7zdUJBup{XQraZ$Ya&QZ);i{$UI)ximxfjXGw zXdvyWmbW4s2R(hyXE(j!aa(P+*z9DM0wG7ZXed9&bG*p*f`KoOZBDk*ggtC2uD54u z^r?7G_m+&8+wzo`+usRz?qE|n?jaHlSinT=M#n)8EwN+*O5LzFFDHdy2KBW^Ja(fO z>UYs8PZq@kIxfwosi59%FYZ_9ewq4>>s?m|W*)pR;wo9x3w{}wrq<%T(xqi-*RKo$ z<=Sp`g`z*Xq+u9V&E&7b>KM7>4no;dOk$imQzKkI{M`#oqZOz*ovo9Q!sl)7cuuQ9 z87ch%dZEBcRSM}sbbTXc(|vtDc8+s6AC{!~+kZTlbEQx>)hJ6&N9!ClTjj(sXt{C?Z zwqr}I&p-sIHkW!gTRpau`v=p*c@1d4#rK4V4Kwu?e7TupZu89QsD5!qC9&jdu@er1 z!B|dL?;0F;V88z@F12veMq7dl4J(i{ybt%|cRP!pe9rwRBB$?>W2+dPBp7T&lwmY{ zL2t8r<8EA1prk3^_K8#fOtgZ@FAX70!Irop|6BS?$^v%h#{NvhBzt7LSp6?53BOy^ zBdi9rdgV+svVRM}ZrzokTmKkP6RZ0ymcc2`=qu!Gs^CipkioNkk1df3O@-F@*BT&h zhd&jv+guST$LTN!d^*tB#)0^<{@n_9Dm0ScwA0^jltJEUxno$zWSsb&WBs&`@@jtH ztSba4w5~TmdDjRO!(KtVmVZ-pmApruLz$_Z3y@x6M+4%@2Fx3n8c z7MZ+qTi*9v|KWUdFc;&HQuwn>{ZjHBw75I3dJcnA1QVOecfQ_Y3fRgA{h=5aJ z9G&U!WX-}-Yd1|7*R`)Zira;)!YuWEJ5VB`C(d-9 z{!5|Qzyc2QI-PC47l@LNV>z4bPF<*$pctpRhw)Hpf16!c;R)?`z~ePmPW67`4{tLW7?e|Sa2#3W3O7%-x(cR_ zEPGS4ri{hLXci-kSi(3uiZ8X*A5>#a7!i4QM-d!GL1!oEdZ{OOGZkR;g51=C+Dbj* zT*AUetN5n{SacbX!Blqb^rBjNPWI>w_*Rwl+DLY#OR_R-oS%hsleCl$YpRmJ1wLkZ)Ia9>0&d#Cf!%Qt^O zp1TL)B|0JeW+3^}bbPqrbHp>(H+jc;Sue9pg-rzTur>W?TP^(e5iXj?c~yltB-o#3 zg^7BY=|fRJK;aWMhp|s~Q`qy$Vuo*~B=YpM8G6>pu3$)dtI5X& zra``PRUCHyR4ArmXk-y!@ZR*ODr|r?1>3P!~?4y3i%CdkSX2)4c~!Nn9uB*VoJ{ilu)#t7maq&GzkM&TQ9x3wV}_C)=jo*o0Uf|P}{ z#kT5h(`^IOveIrz9IkKeIT|XD+`}A0Kffe+48c(xe@%kS@M{%9B%v&}KAc&~tMchU zAz)r>Vhyc z;N7>lRx590JPlTviZ^XY-&Jm=SB*bX0M8gjDRWI_D{o(4Cw;+#6B`X@03~Z(eZM@XO^$w|HThM`G*B zt*aZ==EV-k`;eCwb$l8?RxGi#YqZhoAHNsi$+=@fieUW~7fP40&TaY_QmL14PP2}o z2)+JRB{1*g>%&x!ctu`!_MDywQ-ADRmFVj)#tW})l5+RY_lM;LD793l>8;8ddz7RM zcVzc@DdD9I_x5;|tn8|8qEe%T7LjgvFKP1wVk>92kEf6VL^{)W6hl6<$Bfd`kgp6i z_OHmrkF)fs5}JPJvOkO_stkc}X!nz$Mw7}me>B|PdKiWGH9oSq!23r^yfr&|-uGR> z=e!&E;6{bY7dq;D>Q3E+Y&M06L`r&2&llCjNf{e|q3y=>gs6&gmvI>AG;{R+LP(jlj0$W|Hn+4s2Y8iRrkb{>%y z_^LsBPL`^d{LOaT52I%<>lvFFKSAnlA#44#7`bNVvXH}%WGGW*g5L?* z916!1tJflyRF)&)kmhaa#-E*mf^Zwd0`|L{ydQ~lS(5<;^qc`+JF$L8Bmtja2tb`2 zE+t~mkHIGr+v>+`7lU-~{*P%7+%yIl$9-)`qo?j*kwXxH!i z&ZbuXyNw_DCWS~mZkepO5;l2n%o|@wzBCuYD*mcg22Tl6b@g~!qUAoOQp}-VMV)O# z8uUb{mYYvdYTRUKDs(n`V`134!eUd*^8=KH{4x_EfSLjoqm#aKa>P3+LS{F{w$-w} zDD|bS_5997&xwvpk7r2mWNx*fh$tm~Bj>|6N=Q|?-+EE$QBI*|>b)u0Vgvss6^T+W zhfhg2X2Nxy6}qOB(9i9bUIef#@FNa1oGhl zK6-hwk15Pqqo2&lP;u^Qg=D?{tGO^5@aM+YxReEt{wM`4>&W%Aj^g!SfU%J<)J#u-imF2A^p` z8(eq9-W)~vofScJk9Krr2as>^#G34}dtMJv0anwDBn%Gl(dGIp56c?j9Jua{CCuf; zEJ4tUBIv~UrHVCk<0}9eEL@@1E@bU!{R=nw88V8Tj2j8lkRPOczQ4E1k2 zX&7&Nx#(-E zWycw`chrx60q1tAK-?((mAmJyRtUlqz-(5T&P;N!X?$VGXbUG$1hLQLX%cc8&CAv3 zA=a>`M$)0g&Z($EW6?lTq;bvd3vfI^sC4>ufCr@ciih3&?!q{-`6jCq6uNLT$NnjA~fOfX<(TzOqG0;(ci$3b3oW^W6lMTcvvY+dznVO9Puf z;R5!-Byuri>na7Wf3UUK#fk;DxF|J+I1Ii799g`%?CVotu*e;w?S2?j=m^n&p{dNz z+E)xA+9%OBiXdXQ2JllHqu=;gLvR(g{Zh#nQm0Ri$cSb-9o@_9JPb?5GGf3LN4v&;ED(8b)@_+gP@d)i= z6%%uZO%OG>F+ejWVDSNZ<^2Hy#*s1)h_xw!Lvd)T9CiHD;bbE19<%Kwz(v)fS|#e_ z?Qiow{3VQUV3cY{E%=(VLXvmKwsCernW09D!VSB4fa%!~ZXQ57(rY1;+yRF7)NZDc zME~Lkv9(O)THOOh#u`28xaCmmP*lGY0#2hvxm7wpZ-@Z6j8Jv$=j;etW{vGHMToWa zH-Vq%`4z}tBUQ8H==Nim(mVINythuRN{$)861$vwCLK4m|8Za!KD~PIp|^Kuy2oxj zZk}44B~Yus4LIwPHjU<;RPiU$U}#CY#67`MAFVZy7sw4*e`NzZ33#v z(hTD$_GbU?_A*~!IecBFc7&9gcA3FJ^sCkqcEHiPWV42QB69f?5M*h--P{VEoyE^Q zCGg6oiqR|~w~EK2C>Dzd>$1p`&dAo>@maV2g(`uqT>Q#ix7+9E-J9aIQB28%BPi zzO_#a#+q^h6s=L1pCo`-Qkd%iwK)%>1z#*FP;!4xUzOS4RMlQyrdOFw_l z-1fPNgWJ=ro0PwTPryYPRLr<~&~F%-z>ZG+y3v{NGKA_48v2W#i}^1_MkzDXTTdbQ zg5^cTGgCH6?`Gx-vd858*mY@8@$=_VDq3niFVr;@w2L%o;@Wrjr4sFH9!g+BJc$IsNG3;IH8zK-dI z`_{UU)+^az86SVdM;yUM7A;uxfV{hX`SB^iMY0|qM|%PIiF(s7eio|DI`uV(fLzI6 zA}IR)_~xY~!Ssg+k_uZ&Oy-|Y%pM$erep|4%Jss^E=WkRn0u=iFDe2+@eS;k7v+i~ zRHAGAv41at0mAmNW1u~oxJ}ZBqQxOXxMmYpey#YNt+~=}z|^7_h~(>d98|aTmf74E zz@@6A!k5g_-N)&MT4|f#Y99S~ULozjKX4pVDfj(aZ)>_Wt0-`Mj&si z(eU%4rzUFt^lz2$oYe@(GRWI2u#=s`Cnt1Yt0d5+Jdc#bx(%fyc!ar()4=$7G*dwR zQ8L|Jb;@a=)>@thBKtkz_}LF*trf-IktKJxr1lo^K*&sk!9W1C0Lk72BuAiR&0y zoqRg|xl_9`E7jc&Q43|hMZMz8#G7@D?ntt4zubEk4fNa|(b+*VYio*dhm*8lBJ>&5 zF%fK}N+VMQQ{S_qWbFA|C}SPlH819kdPUcJZh9qn!1}p9XGwSN7o9Z}ekDl%Czcd8 zL|X1lUvtQuVc4q6}|Ld)f!PgSrDffZuok&i06sE+^PRWfc^DQr%B}0>iW^0=ZRN))9NT8h5sEQ`#%)3 zhWl-q^~;zX!*mso84N!>Y=Dj{y1lD`fxnN~-z~uW@TqYgYTzF`g<_TNVp&iVx<(=U z82?lVCn4cntpOtSKi?!0SudP6sC%5?T8)6Yh_k}-tCzj*PgwzhcPFpLH3`z#sDjxc zUd+eAw=6nJHYY*A|A0I|&;s9G<(s<+l)LczV80~%kwuK@3_D@;rkW-`O~}NjyTbbu z7XRPl_V?ZWkMl+UD?jj$iGlx-fcRhi{Qq|%ACdbe2=}bcWNGiWLQz&trdsON`~L^9 CFyu!7 literal 0 HcmV?d00001 From 5324c9364346f74ea73c6be27785704e8e2281f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 9 Jun 2016 16:08:38 +0200 Subject: [PATCH 32/87] Rename MergeRequest#cannot_be_merged_because_build_is_not_success? to #mergeable_ci_state? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The logic of the method was obviously inverted. Signed-off-by: RĂ©my Coutable --- app/models/merge_request.rb | 12 ++-- .../merge_requests/widget/_open.html.haml | 2 +- db/schema.rb | 36 +++++----- spec/models/merge_request_spec.rb | 69 ++++++++++--------- spec/requests/api/merge_requests_spec.rb | 2 +- 5 files changed, 64 insertions(+), 57 deletions(-) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 949cafc065f..f919cfe697e 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -260,7 +260,9 @@ class MergeRequest < ActiveRecord::Base end def mergeable? - mergeable_state? && check_if_can_be_merged + return false unless mergeable_state? + + check_if_can_be_merged can_be_merged? end @@ -269,7 +271,7 @@ class MergeRequest < ActiveRecord::Base return false unless open? return false if work_in_progress? return false if broken? - return false if cannot_be_merged_because_build_is_not_success? + return false unless mergeable_ci_state? true end @@ -488,10 +490,10 @@ class MergeRequest < ActiveRecord::Base ::Gitlab::GitAccess.new(user, project).can_push_to_branch?(target_branch) end - def cannot_be_merged_because_build_is_not_success? - return false unless project.only_allow_merge_if_build_succeeds? + def mergeable_ci_state? + return true unless project.only_allow_merge_if_build_succeeds? - ci_commit && !ci_commit.success? + !ci_commit || ci_commit.success? end def state_human_name diff --git a/app/views/projects/merge_requests/widget/_open.html.haml b/app/views/projects/merge_requests/widget/_open.html.haml index 9ea4df4357f..84fbf618ec6 100644 --- a/app/views/projects/merge_requests/widget/_open.html.haml +++ b/app/views/projects/merge_requests/widget/_open.html.haml @@ -17,7 +17,7 @@ = render 'projects/merge_requests/widget/open/merge_when_build_succeeds' - elsif !@merge_request.can_be_merged_by?(current_user) = render 'projects/merge_requests/widget/open/not_allowed' - - elsif @merge_request.cannot_be_merged_because_build_is_not_success? && @ci_commit && @ci_commit.failed? + - elsif !@merge_request.mergeable_ci_state? && @ci_commit && @ci_commit.failed? = render 'projects/merge_requests/widget/open/build_failed' - elsif @merge_request.can_be_merged? = render 'projects/merge_requests/widget/open/accept' diff --git a/db/schema.rb b/db/schema.rb index 03070f0d593..09ff52ccc8e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -747,39 +747,39 @@ ActiveRecord::Schema.define(version: 20160608155312) do t.datetime "created_at" t.datetime "updated_at" t.integer "creator_id" - t.boolean "issues_enabled", default: true, null: false - t.boolean "merge_requests_enabled", default: true, null: false - t.boolean "wiki_enabled", default: true, null: false + t.boolean "issues_enabled", default: true, null: false + t.boolean "merge_requests_enabled", default: true, null: false + t.boolean "wiki_enabled", default: true, null: false t.integer "namespace_id" - t.string "issues_tracker", default: "gitlab", null: false + t.string "issues_tracker", default: "gitlab", null: false t.string "issues_tracker_id" - t.boolean "snippets_enabled", default: true, null: false + t.boolean "snippets_enabled", default: true, null: false t.datetime "last_activity_at" t.string "import_url" - t.integer "visibility_level", default: 0, null: false - t.boolean "archived", default: false, null: false + t.integer "visibility_level", default: 0, null: false + t.boolean "archived", default: false, null: false t.string "avatar" t.string "import_status" - t.float "repository_size", default: 0.0 - t.integer "star_count", default: 0, null: false + t.float "repository_size", default: 0.0 + t.integer "star_count", default: 0, null: false t.string "import_type" t.string "import_source" - t.integer "commit_count", default: 0 + t.integer "commit_count", default: 0 t.text "import_error" t.integer "ci_id" - t.boolean "builds_enabled", default: true, null: false - t.boolean "shared_runners_enabled", default: true, null: false + t.boolean "builds_enabled", default: true, null: false + t.boolean "shared_runners_enabled", default: true, null: false t.string "runners_token" t.string "build_coverage_regex" - t.boolean "build_allow_git_fetch", default: true, null: false - t.integer "build_timeout", default: 3600, null: false - t.boolean "pending_delete", default: false - t.boolean "public_builds", default: true, null: false - t.integer "pushes_since_gc", default: 0 + t.boolean "build_allow_git_fetch", default: true, null: false + t.integer "build_timeout", default: 3600, null: false + t.boolean "pending_delete", default: false + t.boolean "public_builds", default: true, null: false + t.integer "pushes_since_gc", default: 0 t.boolean "last_repository_check_failed" t.datetime "last_repository_check_at" t.boolean "container_registry_enabled" - t.boolean "only_allow_merge_if_build_succeeds", default: false + t.boolean "only_allow_merge_if_build_succeeds", default: false, null: false end add_index "projects", ["builds_enabled", "shared_runners_enabled"], name: "index_projects_on_builds_enabled_and_shared_runners_enabled", using: :btree diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index f8f1bbf3036..c543cbcfabd 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -495,23 +495,16 @@ describe MergeRequest, models: true do subject { create(:merge_request, source_project: project) } - it 'calls mergeable_state?' do - expect(subject).to receive(:mergeable_state?) + it 'returns false if #mergeable_state? is false' do + expect(subject).to receive(:mergeable_state?) { false } - expect(subject.mergeable?).to be_truthy + expect(subject.mergeable?).to be_falsey end - it 'calls check_if_can_be_merged' do + it 'return true if #mergeable_state? is true and the MR #can_be_merged? is true' do allow(subject).to receive(:mergeable_state?) { true } expect(subject).to receive(:check_if_can_be_merged) - - expect(subject.mergeable?).to be_truthy - end - - it 'calls can_be_merged?' do - allow(subject).to receive(:mergeable_state?) { true } - allow(subject).to receive(:can_be_merged?) { true } - expect(subject).to receive(:check_if_can_be_merged) + expect(subject).to receive(:can_be_merged?) { true } expect(subject.mergeable?).to be_truthy end @@ -523,7 +516,7 @@ describe MergeRequest, models: true do subject { create(:merge_request, source_project: project) } it 'checks if merge request can be merged' do - allow(subject).to receive(:cannot_be_merged_because_build_is_not_success?) { false } + allow(subject).to receive(:mergeable_ci_state?) { true } expect(subject).to receive(:check_if_can_be_merged) subject.mergeable? @@ -559,7 +552,7 @@ describe MergeRequest, models: true do context 'when project settings restrict to merge only if build succeeds and build failed' do before do project.only_allow_merge_if_build_succeeds = true - allow(subject).to receive(:cannot_be_merged_because_build_is_not_success?) { true } + allow(subject).to receive(:mergeable_ci_state?) { false } end it 'returns false' do @@ -569,37 +562,49 @@ describe MergeRequest, models: true do end end - describe '#cannot_be_merged_because_build_is_not_success?' do + describe '#mergeable_ci_state?' do let(:project) { create(:empty_project, only_allow_merge_if_build_succeeds: true) } - let(:commit_status) { create(:commit_status, status: 'failed', project: project) } let(:ci_commit) { create(:ci_empty_pipeline) } subject { build(:merge_request, target_project: project) } - before do - ci_commit.statuses << commit_status - allow(subject).to receive(:ci_commit) { ci_commit } - end + context 'when it is only allowed to merge when build is green' do + context 'and a failed ci_commit is associated' do + before do + ci_commit.statuses << create(:commit_status, status: 'failed', project: project) + allow(subject).to receive(:ci_commit) { ci_commit } + end - it 'returns true if it is only allowed to merge green build and build has been failed' do - expect(subject.cannot_be_merged_because_build_is_not_success?).to be_truthy - end - - context 'when no ci_commit is associated' do - before do - allow(subject).to receive(:ci_commit) { nil } + it { expect(subject.mergeable_ci_state?).to be_falsey } end - it 'returns false' do - expect(subject.cannot_be_merged_because_build_is_not_success?).to be_falsey + context 'when no ci_commit is associated' do + before do + allow(subject).to receive(:ci_commit) { nil } + end + + it { expect(subject.mergeable_ci_state?).to be_truthy } end end - context 'when is not only allowed to merge green build at project settings' do + context 'when merges are not restricted to green builds' do subject { build(:merge_request, target_project: build(:empty_project, only_allow_merge_if_build_succeeds: false)) } - it 'returns false' do - expect(subject.cannot_be_merged_because_build_is_not_success?).to be_falsey + context 'and a failed ci_commit is associated' do + before do + ci_commit.statuses << create(:commit_status, status: 'failed', project: project) + allow(subject).to receive(:ci_commit) { ci_commit } + end + + it { expect(subject.mergeable_ci_state?).to be_truthy } + end + + context 'when no ci_commit is associated' do + before do + allow(subject).to receive(:ci_commit) { nil } + end + + it { expect(subject.mergeable_ci_state?).to be_truthy } end end end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index a52148e8b83..1356f87b0e9 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -420,7 +420,7 @@ describe API::API, api: true do end it 'returns 405 if the build failed for a merge request that requires success' do - allow_any_instance_of(MergeRequest).to receive(:cannot_be_merged_because_build_is_not_success?).and_return(true) + allow_any_instance_of(MergeRequest).to receive(:mergeable_ci_state?).and_return(false) put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge", user) From 34bef254644b4ecda4ac61a82447a23f081aeca0 Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Wed, 8 Jun 2016 20:03:19 +0200 Subject: [PATCH 33/87] Update CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index b00c149a753..c0918cfb9f9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -70,6 +70,7 @@ v 8.8.5 (unreleased) - Import GitHub repositories respecting the API rate limit - Fix importer for GitHub comments on diff - Disable Webhooks before proceeding with the GitHub import + - Fix incremental trace upload API when using multi-byte UTF-8 chars in trace v 8.8.4 - Fix LDAP-based login for users with 2FA enabled. !4493 From 3579edba1f0d27095502775c64bdd73a3927dca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 10 Jun 2016 14:41:38 +0200 Subject: [PATCH 34/87] Rename ci_commit -> pipeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©my Coutable --- app/models/merge_request.rb | 2 +- .../merge_requests/widget/_open.html.haml | 2 +- .../only_allow_merge_if_build_succeeds.rb | 14 ++++++------ spec/models/merge_request_spec.rb | 22 +++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index f919cfe697e..29f36570912 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -493,7 +493,7 @@ class MergeRequest < ActiveRecord::Base def mergeable_ci_state? return true unless project.only_allow_merge_if_build_succeeds? - !ci_commit || ci_commit.success? + !pipeline || pipeline.success? end def state_human_name diff --git a/app/views/projects/merge_requests/widget/_open.html.haml b/app/views/projects/merge_requests/widget/_open.html.haml index 84fbf618ec6..0e0af57d76e 100644 --- a/app/views/projects/merge_requests/widget/_open.html.haml +++ b/app/views/projects/merge_requests/widget/_open.html.haml @@ -17,7 +17,7 @@ = render 'projects/merge_requests/widget/open/merge_when_build_succeeds' - elsif !@merge_request.can_be_merged_by?(current_user) = render 'projects/merge_requests/widget/open/not_allowed' - - elsif !@merge_request.mergeable_ci_state? && @ci_commit && @ci_commit.failed? + - elsif !@merge_request.mergeable_ci_state? && @pipeline && @pipeline.failed? = render 'projects/merge_requests/widget/open/build_failed' - elsif @merge_request.can_be_merged? = render 'projects/merge_requests/widget/open/accept' diff --git a/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb b/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb index 52612c91824..65e9185ec24 100644 --- a/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb +++ b/spec/features/merge_requests/only_allow_merge_if_build_succeeds.rb @@ -19,7 +19,7 @@ feature 'Only allow merge requests to be merged if the build succeeds', feature: end context 'when project has CI enabled' do - let(:ci_commit) { create(:ci_empty_pipeline, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) } + let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) } context 'when merge requests can only be merged if the build succeeds' do before do @@ -27,7 +27,7 @@ feature 'Only allow merge requests to be merged if the build succeeds', feature: end context 'when CI is running' do - before { ci_commit.update_column(:status, :running) } + before { pipeline.update_column(:status, :running) } it 'does not allow to merge immediately' do visit_merge_request(merge_request) @@ -38,7 +38,7 @@ feature 'Only allow merge requests to be merged if the build succeeds', feature: end context 'when CI failed' do - before { ci_commit.update_column(:status, :failed) } + before { pipeline.update_column(:status, :failed) } it 'does not allow MR to be merged' do visit_merge_request(merge_request) @@ -49,7 +49,7 @@ feature 'Only allow merge requests to be merged if the build succeeds', feature: end context 'when CI succeeded' do - before { ci_commit.update_column(:status, :success) } + before { pipeline.update_column(:status, :success) } it 'allows MR to be merged' do visit_merge_request(merge_request) @@ -65,7 +65,7 @@ feature 'Only allow merge requests to be merged if the build succeeds', feature: end context 'when CI is running' do - before { ci_commit.update_column(:status, :running) } + before { pipeline.update_column(:status, :running) } it 'allows MR to be merged immediately', js: true do visit_merge_request(merge_request) @@ -78,7 +78,7 @@ feature 'Only allow merge requests to be merged if the build succeeds', feature: end context 'when CI failed' do - before { ci_commit.update_column(:status, :failed) } + before { pipeline.update_column(:status, :failed) } it 'allows MR to be merged' do visit_merge_request(merge_request) @@ -88,7 +88,7 @@ feature 'Only allow merge requests to be merged if the build succeeds', feature: end context 'when CI succeeded' do - before { ci_commit.update_column(:status, :success) } + before { pipeline.update_column(:status, :success) } it 'allows MR to be merged' do visit_merge_request(merge_request) diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index c543cbcfabd..3b199f4d98d 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -564,23 +564,23 @@ describe MergeRequest, models: true do describe '#mergeable_ci_state?' do let(:project) { create(:empty_project, only_allow_merge_if_build_succeeds: true) } - let(:ci_commit) { create(:ci_empty_pipeline) } + let(:pipeline) { create(:ci_empty_pipeline) } subject { build(:merge_request, target_project: project) } context 'when it is only allowed to merge when build is green' do - context 'and a failed ci_commit is associated' do + context 'and a failed pipeline is associated' do before do - ci_commit.statuses << create(:commit_status, status: 'failed', project: project) - allow(subject).to receive(:ci_commit) { ci_commit } + pipeline.statuses << create(:commit_status, status: 'failed', project: project) + allow(subject).to receive(:pipeline) { pipeline } end it { expect(subject.mergeable_ci_state?).to be_falsey } end - context 'when no ci_commit is associated' do + context 'when no pipeline is associated' do before do - allow(subject).to receive(:ci_commit) { nil } + allow(subject).to receive(:pipeline) { nil } end it { expect(subject.mergeable_ci_state?).to be_truthy } @@ -590,18 +590,18 @@ describe MergeRequest, models: true do context 'when merges are not restricted to green builds' do subject { build(:merge_request, target_project: build(:empty_project, only_allow_merge_if_build_succeeds: false)) } - context 'and a failed ci_commit is associated' do + context 'and a failed pipeline is associated' do before do - ci_commit.statuses << create(:commit_status, status: 'failed', project: project) - allow(subject).to receive(:ci_commit) { ci_commit } + pipeline.statuses << create(:commit_status, status: 'failed', project: project) + allow(subject).to receive(:pipeline) { pipeline } end it { expect(subject.mergeable_ci_state?).to be_truthy } end - context 'when no ci_commit is associated' do + context 'when no pipeline is associated' do before do - allow(subject).to receive(:ci_commit) { nil } + allow(subject).to receive(:pipeline) { nil } end it { expect(subject.mergeable_ci_state?).to be_truthy } From 0e896ffe4eebb8bcf04bc1327d498bb041faed56 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 10 Jun 2016 14:51:16 +0200 Subject: [PATCH 35/87] Improve Gitlab::Auth method names Auth.find was a very generic name for a very specific method. Auth.find_in_gitlab_or_ldap was inaccurate in GitLab EE where it also looks in Kerberos. --- app/controllers/jwt_controller.rb | 2 +- app/controllers/projects/git_http_controller.rb | 2 +- config/initializers/doorkeeper.rb | 2 +- lib/api/session.rb | 2 +- lib/gitlab/auth.rb | 6 +++--- lib/gitlab/backend/grack_auth.rb | 2 +- spec/lib/gitlab/auth_spec.rb | 16 ++++++++-------- spec/requests/jwt_controller_spec.rb | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/controllers/jwt_controller.rb b/app/controllers/jwt_controller.rb index 131a16dad9b..014b9b43ff2 100644 --- a/app/controllers/jwt_controller.rb +++ b/app/controllers/jwt_controller.rb @@ -42,7 +42,7 @@ class JwtController < ApplicationController end def authenticate_user(login, password) - user = Gitlab::Auth.find_in_gitlab_or_ldap(login, password) + user = Gitlab::Auth.find_with_user_password(login, password) Gitlab::Auth.rate_limit!(request.ip, success: user.present?, login: login) user end diff --git a/app/controllers/projects/git_http_controller.rb b/app/controllers/projects/git_http_controller.rb index 348d6cf4d96..f907d63258b 100644 --- a/app/controllers/projects/git_http_controller.rb +++ b/app/controllers/projects/git_http_controller.rb @@ -43,7 +43,7 @@ class Projects::GitHttpController < Projects::ApplicationController return if project && project.public? && upload_pack? authenticate_or_request_with_http_basic do |login, password| - auth_result = Gitlab::Auth.find(login, password, project: project, ip: request.ip) + auth_result = Gitlab::Auth.find_for_git_client(login, password, project: project, ip: request.ip) if auth_result.type == :ci && upload_pack? @ci = true diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 8dc8e270afc..618dba74151 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -12,7 +12,7 @@ Doorkeeper.configure do end resource_owner_from_credentials do |routes| - Gitlab::Auth.find_in_gitlab_or_ldap(params[:username], params[:password]) + Gitlab::Auth.find_with_user_password(params[:username], params[:password]) end # If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below. diff --git a/lib/api/session.rb b/lib/api/session.rb index 56e69b2366f..56c202f1294 100644 --- a/lib/api/session.rb +++ b/lib/api/session.rb @@ -11,7 +11,7 @@ module API # Example Request: # POST /session post "/session" do - user = Gitlab::Auth.find_in_gitlab_or_ldap(params[:email] || params[:login], params[:password]) + user = Gitlab::Auth.find_with_user_password(params[:email] || params[:login], params[:password]) return unauthorized! unless user present user, with: Entities::UserLogin diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 076e2af7d38..db1704af75e 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -3,14 +3,14 @@ module Gitlab Result = Struct.new(:user, :type) class << self - def find(login, password, project:, ip:) + def find_for_git_client(login, password, project:, ip:) raise "Must provide an IP for rate limiting" if ip.nil? result = Result.new if valid_ci_request?(login, password, project) result.type = :ci - elsif result.user = find_in_gitlab_or_ldap(login, password) + elsif result.user = find_with_user_password(login, password) result.type = :gitlab_or_ldap elsif result.user = oauth_access_token_check(login, password) result.type = :oauth @@ -20,7 +20,7 @@ module Gitlab result end - def find_in_gitlab_or_ldap(login, password) + def find_with_user_password(login, password) user = User.by_login(login) # If no user is found, or it's an LDAP server, try LDAP. diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb index 9e09d2e118d..adbf5941a96 100644 --- a/lib/gitlab/backend/grack_auth.rb +++ b/lib/gitlab/backend/grack_auth.rb @@ -95,7 +95,7 @@ module Grack end def authenticate_user(login, password) - user = Gitlab::Auth.find_in_gitlab_or_ldap(login, password) + user = Gitlab::Auth.find_with_user_password(login, password) unless user user = oauth_access_token_check(login, password) diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb index a814ad2a4e7..f081d550ec8 100644 --- a/spec/lib/gitlab/auth_spec.rb +++ b/spec/lib/gitlab/auth_spec.rb @@ -41,7 +41,7 @@ describe Gitlab::Auth, lib: true do end end - describe 'find_in_gitlab_or_ldap' do + describe 'find_with_user_password' do let!(:user) do create(:user, username: username, @@ -52,25 +52,25 @@ describe Gitlab::Auth, lib: true do let(:password) { 'my-secret' } it "should find user by valid login/password" do - expect( gl_auth.find_in_gitlab_or_ldap(username, password) ).to eql user + expect( gl_auth.find_with_user_password(username, password) ).to eql user end it 'should find user by valid email/password with case-insensitive email' do - expect(gl_auth.find_in_gitlab_or_ldap(user.email.upcase, password)).to eql user + expect(gl_auth.find_with_user_password(user.email.upcase, password)).to eql user end it 'should find user by valid username/password with case-insensitive username' do - expect(gl_auth.find_in_gitlab_or_ldap(username.upcase, password)).to eql user + expect(gl_auth.find_with_user_password(username.upcase, password)).to eql user end it "should not find user with invalid password" do password = 'wrong' - expect( gl_auth.find_in_gitlab_or_ldap(username, password) ).not_to eql user + expect( gl_auth.find_with_user_password(username, password) ).not_to eql user end it "should not find user with invalid login" do user = 'wrong' - expect( gl_auth.find_in_gitlab_or_ldap(username, password) ).not_to eql user + expect( gl_auth.find_with_user_password(username, password) ).not_to eql user end context "with ldap enabled" do @@ -81,13 +81,13 @@ describe Gitlab::Auth, lib: true do it "tries to autheticate with db before ldap" do expect(Gitlab::LDAP::Authentication).not_to receive(:login) - gl_auth.find_in_gitlab_or_ldap(username, password) + gl_auth.find_with_user_password(username, password) end it "uses ldap as fallback to for authentication" do expect(Gitlab::LDAP::Authentication).to receive(:login) - gl_auth.find_in_gitlab_or_ldap('ldap_user', 'password') + gl_auth.find_with_user_password('ldap_user', 'password') end end end diff --git a/spec/requests/jwt_controller_spec.rb b/spec/requests/jwt_controller_spec.rb index c995993a853..d2d4a9eca18 100644 --- a/spec/requests/jwt_controller_spec.rb +++ b/spec/requests/jwt_controller_spec.rb @@ -44,7 +44,7 @@ describe JwtController do let(:user) { create(:user) } let(:headers) { { authorization: credentials('user', 'password') } } - before { expect(Gitlab::Auth).to receive(:find_in_gitlab_or_ldap).with('user', 'password').and_return(user) } + before { expect(Gitlab::Auth).to receive(:find_with_user_password).with('user', 'password').and_return(user) } subject! { get '/jwt/auth', parameters, headers } From 16927e3fadfb5b9b2c3b12ffdf7ab217971b8cca Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 30 May 2016 11:05:17 +0200 Subject: [PATCH 36/87] Enable Style/MultilineBlockChain rubocop style cop See #17478 --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 678f7db025b..72db0342543 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -348,7 +348,7 @@ Style/MultilineArrayBraceLayout: # Avoid multi-line chains of blocks. Style/MultilineBlockChain: - Enabled: false + Enabled: true # Ensures newlines after multiline block do statements. Style/MultilineBlockLayout: From 49c06ba39133ea3f3468729d661264f77219d251 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 10 Jun 2016 14:17:10 +0100 Subject: [PATCH 37/87] Only show issues closing MR when present --- app/views/projects/issues/_merge_requests.html.haml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/projects/issues/_merge_requests.html.haml b/app/views/projects/issues/_merge_requests.html.haml index 75f36579b11..d8075371853 100644 --- a/app/views/projects/issues/_merge_requests.html.haml +++ b/app/views/projects/issues/_merge_requests.html.haml @@ -24,8 +24,6 @@ MERGED - elsif merge_request.closed? CLOSED - %li - = render partial: 'projects/issues/closed_by_box', locals: {merge_request_count: @merge_requests.count} - if @closed_by_merge_requests.present? %li = render partial: 'projects/issues/closed_by_box', locals: {merge_request_count: @merge_requests.count} From 998c688699db68a6dd1fb5e6459b1a787deabcef Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 10 Jun 2016 12:07:37 +0100 Subject: [PATCH 38/87] Updated tests --- spec/features/builds_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/builds_spec.rb b/spec/features/builds_spec.rb index 0c865e915cb..b8ecc356b4d 100644 --- a/spec/features/builds_spec.rb +++ b/spec/features/builds_spec.rb @@ -184,7 +184,7 @@ describe "Builds" do @build.run! @build.trace = 'BUILD TRACE' visit namespace_project_build_path(@project.namespace, @project, @build) - page.within('.build-controls') { click_link 'Raw' } + page.within('.js-build-sidebar') { click_link 'Raw' } end it 'sends the right headers' do From c7941acd1e410fedb431efe13dc3b74dfa7f9f8a Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 10 Jun 2016 14:22:50 +0100 Subject: [PATCH 39/87] Don't try to count a relation with aliases 98f147e84d2bd8f2278452ac0852118452c76d4a fixed this for issues in HTML, but not MRs or Atom feeds. --- app/views/dashboard/issues.atom.builder | 4 ++-- app/views/groups/issues.atom.builder | 4 ++-- app/views/projects/issues/index.atom.builder | 4 ++-- app/views/shared/_merge_requests.html.haml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/dashboard/issues.atom.builder b/app/views/dashboard/issues.atom.builder index 83c0c6da21b..0404d0728ea 100644 --- a/app/views/dashboard/issues.atom.builder +++ b/app/views/dashboard/issues.atom.builder @@ -4,7 +4,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear xml.link href: issues_dashboard_url(format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml" xml.link href: issues_dashboard_url, rel: "alternate", type: "text/html" xml.id issues_dashboard_url - xml.updated @issues.first.created_at.xmlschema if @issues.any? + xml.updated @issues.first.created_at.xmlschema if @issues.reorder(nil).any? - xml << render(partial: 'issues/issue', collection: @issues) if @issues.any? + xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any? end diff --git a/app/views/groups/issues.atom.builder b/app/views/groups/issues.atom.builder index c19671295af..b1628040325 100644 --- a/app/views/groups/issues.atom.builder +++ b/app/views/groups/issues.atom.builder @@ -4,7 +4,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear xml.link href: issues_group_url(format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml" xml.link href: issues_group_url, rel: "alternate", type: "text/html" xml.id issues_group_url - xml.updated @issues.first.created_at.xmlschema if @issues.any? + xml.updated @issues.first.created_at.xmlschema if @issues.reorder(nil).any? - xml << render(partial: 'issues/issue', collection: @issues) if @issues.any? + xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any? end diff --git a/app/views/projects/issues/index.atom.builder b/app/views/projects/issues/index.atom.builder index 7ad7c9c87e8..36957560de0 100644 --- a/app/views/projects/issues/index.atom.builder +++ b/app/views/projects/issues/index.atom.builder @@ -4,7 +4,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear xml.link href: namespace_project_issues_url(@project.namespace, @project, format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml" xml.link href: namespace_project_issues_url(@project.namespace, @project), rel: "alternate", type: "text/html" xml.id namespace_project_issues_url(@project.namespace, @project) - xml.updated @issues.first.created_at.xmlschema if @issues.any? + xml.updated @issues.first.created_at.xmlschema if @issues.reorder(nil).any? - xml << render(partial: 'issues/issue', collection: @issues) if @issues.any? + xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any? end diff --git a/app/views/shared/_merge_requests.html.haml b/app/views/shared/_merge_requests.html.haml index e74fc36c797..ca3178395c1 100644 --- a/app/views/shared/_merge_requests.html.haml +++ b/app/views/shared/_merge_requests.html.haml @@ -1,4 +1,4 @@ -- if @merge_requests.any? +- if @merge_requests.reorder(nil).any? - @merge_requests.group_by(&:target_project).each do |group| .panel.panel-default.panel-small - project = group[0] From 24920bc52a5658dd1d16d38ba3dc46f92dfe7675 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 8 Jun 2016 17:03:51 +0200 Subject: [PATCH 40/87] Add Project.where_paths_in This method can be used to find multiple projects for multiple paths. For example, take this snippet: Project.where_paths_in(%w{gitlab-org/gitlab-ce gitlab-org/gitlab-ee}) This will return an ActiveRecord::Relation containing the GitLab CE and GitLab EE projects. This method takes care of matching rows both case-sensitively and case-insensitively where needed. Project.find_with_namespace in turn has been modified to use Project.where_paths_in without nuking any scoping (instead it uses reorder(nil)). This means that any default scopes (e.g. those used for "pending_delete" stay intact). The method Project.where_paths_in was added so the various Markdown filters can use a single query to grab all the projects referenced in a set of documents, something Project.find_with_namespace didn't allow. --- app/models/project.rb | 71 +++++++++++++++++++++++++++++++------ spec/models/project_spec.rb | 33 +++++++++++++++++ 2 files changed, 93 insertions(+), 11 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index f47ef8a81de..7bee7550d6c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -253,20 +253,69 @@ class Project < ActiveRecord::Base non_archived.where(table[:name].matches(pattern)) end - def find_with_namespace(id) - namespace_path, project_path = id.split('/', 2) + # Finds a single project for the given path. + # + # path - The full project path (including namespace path). + # + # Returns a Project, or nil if no project could be found. + def find_with_namespace(path) + where_paths_in([path]).reorder(nil).take + end - return nil if !namespace_path || !project_path + # Builds a relation to find multiple projects by their full paths. + # + # Each path must be in the following format: + # + # namespace_path/project_path + # + # For example: + # + # gitlab-org/gitlab-ce + # + # Usage: + # + # Project.where_paths_in(%w{gitlab-org/gitlab-ce gitlab-org/gitlab-ee}) + # + # This would return the projects with the full paths matching the values + # given. + # + # paths - An Array of full paths (namespace path + project path) for which + # to find the projects. + # + # Returns an ActiveRecord::Relation. + def where_paths_in(paths) + wheres = [] + cast_lower = Gitlab::Database.postgresql? - # Use of unscoped ensures we're not secretly adding any ORDER BYs, which - # have a negative impact on performance (and aren't needed for this - # query). - projects = unscoped. - joins(:namespace). - iwhere('namespaces.path' => namespace_path) + paths.each do |path| + namespace_path, project_path = path.split('/', 2) - projects.find_by('projects.path' => project_path) || - projects.iwhere('projects.path' => project_path).take + next unless namespace_path && project_path + + namespace_path = connection.quote(namespace_path) + project_path = connection.quote(project_path) + + where = "(namespaces.path = #{namespace_path} + AND projects.path = #{project_path})" + + if cast_lower + where = "( + #{where} + OR ( + LOWER(namespaces.path) = LOWER(#{namespace_path}) + AND LOWER(projects.path) = LOWER(#{project_path}) + ) + )" + end + + wheres << where + end + + if wheres.empty? + none + else + joins(:namespace).where(wheres.join(' OR ')) + end end def visibility_levels diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 553556ed326..f687e3171a7 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -859,4 +859,37 @@ describe Project, models: true do it { is_expected.to be_falsey } end end + + describe '.where_paths_in' do + context 'without any paths' do + it 'returns an empty relation' do + expect(Project.where_paths_in([])).to eq([]) + end + end + + context 'without any valid paths' do + it 'returns an empty relation' do + expect(Project.where_paths_in(%w[foo])).to eq([]) + end + end + + context 'with valid paths' do + let!(:project1) { create(:project) } + let!(:project2) { create(:project) } + + it 'returns the projects matching the paths' do + projects = Project.where_paths_in([project1.path_with_namespace, + project2.path_with_namespace]) + + expect(projects).to contain_exactly(project1, project2) + end + + it 'returns projects regardless of the casing of paths' do + projects = Project.where_paths_in([project1.path_with_namespace.upcase, + project2.path_with_namespace.upcase]) + + expect(projects).to contain_exactly(project1, project2) + end + end + end end From 136a4ea39bb82d7e88b79a3bb7b2f3b4a5ec42ab Mon Sep 17 00:00:00 2001 From: Paco Guzman Date: Fri, 3 Jun 2016 10:21:18 +0200 Subject: [PATCH 41/87] Cache the presence of an issue_tracker at project level Using update_column to store the boolean flag to avoid any side effects with the current state of the project instance --- CHANGELOG | 1 + app/models/project.rb | 18 +++++- app/models/service.rb | 10 +++ ..._has_external_issue_tracker_to_projects.rb | 10 +++ db/schema.rb | 1 + spec/models/project_spec.rb | 63 +++++++++++++++++++ spec/models/service_spec.rb | 33 ++++++++++ 7 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20160603075128_add_has_external_issue_tracker_to_projects.rb diff --git a/CHANGELOG b/CHANGELOG index 1c64739f701..0c712b445a4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -62,6 +62,7 @@ v 8.9.0 (unreleased) - Markdown editor now correctly resets the input value on edit cancellation !4175 - Toggling a task list item in a issue/mr description does not creates a Todo for mentions - Improved UX of date pickers on issue & milestone forms + - Cache on the database if a project has an active external issue tracker. v 8.8.5 (unreleased) - Ensure branch cleanup regardless of whether the GitHub import process succeeds diff --git a/app/models/project.rb b/app/models/project.rb index f47ef8a81de..472e79cfcf8 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -523,9 +523,21 @@ class Project < ActiveRecord::Base end def external_issue_tracker - return @external_issue_tracker if defined?(@external_issue_tracker) - @external_issue_tracker ||= - services.issue_trackers.active.without_defaults.first + if has_external_issue_tracker.nil? # To populate existing projects + cache_has_external_issue_tracker + end + + if has_external_issue_tracker? + return @external_issue_tracker if defined?(@external_issue_tracker) + + @external_issue_tracker = services.external_issue_trackers.first + else + nil + end + end + + def cache_has_external_issue_tracker + update_column(:has_external_issue_tracker, services.external_issue_trackers.any?) end def can_have_issues_tracker_id? diff --git a/app/models/service.rb b/app/models/service.rb index de3fd24584a..bf352397509 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -16,6 +16,7 @@ class Service < ActiveRecord::Base after_initialize :initialize_properties after_commit :reset_updated_properties + after_commit :cache_project_has_external_issue_tracker belongs_to :project has_one :service_hook @@ -34,6 +35,7 @@ class Service < ActiveRecord::Base scope :note_hooks, -> { where(note_events: true, active: true) } scope :build_hooks, -> { where(build_events: true, active: true) } scope :wiki_page_hooks, -> { where(wiki_page_events: true, active: true) } + scope :external_issue_trackers, -> { issue_trackers.active.without_defaults } default_value_for :category, 'common' @@ -192,4 +194,12 @@ class Service < ActiveRecord::Base service.project_id = project_id service if service.save end + + private + + def cache_project_has_external_issue_tracker + if project && !project.destroyed? + project.cache_has_external_issue_tracker + end + end end diff --git a/db/migrate/20160603075128_add_has_external_issue_tracker_to_projects.rb b/db/migrate/20160603075128_add_has_external_issue_tracker_to_projects.rb new file mode 100644 index 00000000000..be295f0181d --- /dev/null +++ b/db/migrate/20160603075128_add_has_external_issue_tracker_to_projects.rb @@ -0,0 +1,10 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddHasExternalIssueTrackerToProjects < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + def change + add_column(:projects, :has_external_issue_tracker, :boolean) + end +end diff --git a/db/schema.rb b/db/schema.rb index 09ff52ccc8e..aac327797e7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -780,6 +780,7 @@ ActiveRecord::Schema.define(version: 20160608155312) do t.datetime "last_repository_check_at" t.boolean "container_registry_enabled" t.boolean "only_allow_merge_if_build_succeeds", default: false, null: false + t.boolean "has_external_issue_tracker" end add_index "projects", ["builds_enabled", "shared_runners_enabled"], name: "index_projects_on_builds_enabled_and_shared_runners_enabled", using: :btree diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 553556ed326..b6f36d3481e 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -258,6 +258,69 @@ describe Project, models: true do end end + describe :external_issue_tracker do + let(:project) { create(:project) } + let(:ext_project) { create(:redmine_project) } + + context 'on existing projects with no value for has_external_issue_tracker' do + before(:each) do + project.update_column(:has_external_issue_tracker, nil) + ext_project.update_column(:has_external_issue_tracker, nil) + end + + it 'updates the has_external_issue_tracker boolean' do + expect do + project.external_issue_tracker + end.to change { project.reload.has_external_issue_tracker }.to(false) + + expect do + ext_project.external_issue_tracker + end.to change { ext_project.reload.has_external_issue_tracker }.to(true) + end + end + + it 'returns nil and does not query services when there is no external issue tracker' do + project.build_missing_services + project.reload + + expect(project).not_to receive(:services) + + expect(project.external_issue_tracker).to eq(nil) + end + + it 'retrieves external_issue_tracker querying services and cache it when there is external issue tracker' do + ext_project.reload # Factory returns a project with changed attributes + ext_project.build_missing_services + ext_project.reload + + expect(ext_project).to receive(:services).once.and_call_original + + 2.times { expect(ext_project.external_issue_tracker).to be_a_kind_of(RedmineService) } + end + end + + describe :cache_has_external_issue_tracker do + let(:project) { create(:project) } + + it 'stores true if there is any external_issue_tracker' do + services = double(:service, external_issue_trackers: [RedmineService.new]) + expect(project).to receive(:services).and_return(services) + + expect do + project.cache_has_external_issue_tracker + end.to change { project.has_external_issue_tracker}.to(true) + end + + it 'stores false if there is no external_issue_tracker' do + services = double(:service, external_issue_trackers: []) + expect(project).to receive(:services).and_return(services) + + expect do + project.cache_has_external_issue_tracker + end.to change { project.has_external_issue_tracker}.to(false) + end + end + describe :can_have_issues_tracker_id? do let(:project) { create(:project) } let(:ext_project) { create(:redmine_project) } diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb index 8592e112c50..2f000dbc01a 100644 --- a/spec/models/service_spec.rb +++ b/spec/models/service_spec.rb @@ -204,4 +204,37 @@ describe Service, models: true do expect(service.bamboo_url_was).to be_nil end end + + describe "callbacks" do + let(:project) { create(:project) } + let!(:service) do + RedmineService.new( + project: project, + active: true, + properties: { + project_url: 'http://redmine/projects/project_name_in_redmine', + issues_url: "http://redmine/#{project.id}/project_name_in_redmine/:id", + new_issue_url: 'http://redmine/projects/project_name_in_redmine/issues/new' + } + ) + end + + describe "on create" do + it "updates the has_external_issue_tracker boolean" do + expect do + service.save! + end.to change { service.project.has_external_issue_tracker }.from(nil).to(true) + end + end + + describe "on update" do + it "updates the has_external_issue_tracker boolean" do + service.save! + + expect do + service.update_attributes(active: false) + end.to change { service.project.has_external_issue_tracker }.from(true).to(false) + end + end + end end From be98ee2586466b8f9f4e96e4b54490c412f6b43b Mon Sep 17 00:00:00 2001 From: Paco Guzman Date: Mon, 6 Jun 2016 10:06:37 +0200 Subject: [PATCH 42/87] Fixing specs stubbed objects cannot access database --- spec/lib/banzai/pipeline/wiki_pipeline_spec.rb | 4 ++-- spec/models/project_services/bamboo_service_spec.rb | 2 +- spec/models/project_services/teamcity_service_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb b/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb index ea4ab2c852e..72bc6a0b704 100644 --- a/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb +++ b/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb @@ -52,8 +52,8 @@ describe Banzai::Pipeline::WikiPipeline do end describe "Links" do - let(:namespace) { build_stubbed(:namespace, name: "wiki_link_ns") } - let(:project) { build_stubbed(:empty_project, :public, name: "wiki_link_project", namespace: namespace) } + let(:namespace) { create(:namespace, name: "wiki_link_ns") } + let(:project) { create(:empty_project, :public, name: "wiki_link_project", namespace: namespace) } let(:project_wiki) { ProjectWiki.new(project, double(:user)) } let(:page) { build(:wiki_page, wiki: project_wiki, page: OpenStruct.new(url_path: 'nested/twice/start-page')) } diff --git a/spec/models/project_services/bamboo_service_spec.rb b/spec/models/project_services/bamboo_service_spec.rb index e771f35811e..ec81f05fc7a 100644 --- a/spec/models/project_services/bamboo_service_spec.rb +++ b/spec/models/project_services/bamboo_service_spec.rb @@ -194,7 +194,7 @@ describe BambooService, models: true do def service(bamboo_url: 'http://gitlab.com') described_class.create( - project: build_stubbed(:empty_project), + project: create(:empty_project), properties: { bamboo_url: bamboo_url, username: 'mic', diff --git a/spec/models/project_services/teamcity_service_spec.rb b/spec/models/project_services/teamcity_service_spec.rb index ad24b895170..24a708ca849 100644 --- a/spec/models/project_services/teamcity_service_spec.rb +++ b/spec/models/project_services/teamcity_service_spec.rb @@ -182,7 +182,7 @@ describe TeamcityService, models: true do def service(teamcity_url: 'http://gitlab.com') described_class.create( - project: build_stubbed(:empty_project), + project: create(:empty_project), properties: { teamcity_url: teamcity_url, username: 'mic', From 0e7abb4c2851131ccc5a81e1923824ac845bbe3f Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Fri, 10 Jun 2016 15:53:38 +0200 Subject: [PATCH 43/87] Fix incorrect registry key value Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/18441 --- config/gitlab.yml.example | 2 +- doc/administration/container_registry.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 0510e7df597..1048ef6e243 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -181,7 +181,7 @@ production: &base # host: registry.example.com # port: 5005 # api_url: http://localhost:5000/ # internal address to the registry, will be used by GitLab to directly communicate with API - # key_path: config/registry.key + # key: config/registry.key # path: shared/registry # issuer: gitlab-issuer diff --git a/doc/administration/container_registry.md b/doc/administration/container_registry.md index caf9a5bef2c..7870669fa77 100644 --- a/doc/administration/container_registry.md +++ b/doc/administration/container_registry.md @@ -62,7 +62,7 @@ registry: host: registry.gitlab.example.com port: 5005 api_url: http://localhost:5000/ - key_path: config/registry.key + key: config/registry.key path: shared/registry issuer: gitlab-issuer ``` @@ -75,7 +75,7 @@ where: | `host` | The host URL under which the Registry will run and the users will be able to use. | | `port` | The port under which the external Registry domain will listen on. | | `api_url` | The internal API URL under which the Registry is exposed to. It defaults to `http://localhost:5000`. | -| `key_path`| The private key location that is a pair of Registry's `rootcertbundle`. Read the [token auth configuration documentation][token-config]. | +| `key` | The private key location that is a pair of Registry's `rootcertbundle`. Read the [token auth configuration documentation][token-config]. | | `path` | This should be the same directory like specified in Registry's `rootdirectory`. Read the [storage configuration documentation][storage-config]. This path needs to be readable by the GitLab user, the web-server user and the Registry user. Read more in [#container-registry-storage-path](#container-registry-storage-path). | | `issuer` | This should be the same value as configured in Registry's `issuer`. Read the [token auth configuration documentation][token-config]. | From 8f6d43e0fea3ce62ec2e8e211755e557f19c51fd Mon Sep 17 00:00:00 2001 From: Felipe Artur Date: Mon, 6 Jun 2016 12:50:54 -0300 Subject: [PATCH 44/87] Remove notification level from user model --- CHANGELOG | 1 + .../profiles/notifications_controller.rb | 24 +- app/helpers/notifications_helper.rb | 32 ++ app/models/notification_setting.rb | 1 - app/models/user.rb | 18 +- app/services/notification_service.rb | 16 +- .../notifications/_group_settings.html.haml | 2 +- .../notifications/_project_settings.html.haml | 2 +- .../profiles/notifications/show.html.haml | 28 +- ...tification_setting_not_null_constraints.rb | 7 + ...201627_migrate_users_notification_level.rb | 24 ++ spec/models/notification_setting_spec.rb | 1 - spec/services/notification_service_spec.rb | 296 +++++++++++++++++- 13 files changed, 391 insertions(+), 61 deletions(-) create mode 100644 db/migrate/20160606192159_remove_notification_setting_not_null_constraints.rb create mode 100644 db/migrate/20160607201627_migrate_users_notification_level.rb diff --git a/CHANGELOG b/CHANGELOG index 1c64739f701..bf437e267a4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -54,6 +54,7 @@ v 8.9.0 (unreleased) - Improve error handling importing projects - Remove duplicated notification settings - Put project Files and Commits tabs under Code tab + - Decouple global notification level from user model - Replace Colorize with Rainbow for coloring console output in Rake tasks. - An indicator is now displayed at the top of the comment field for confidential issues. - RepositoryCheck::SingleRepositoryWorker public and private methods are now instrumented diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb index 18ee55c839a..1e9ceb87857 100644 --- a/app/controllers/profiles/notifications_controller.rb +++ b/app/controllers/profiles/notifications_controller.rb @@ -1,12 +1,13 @@ class Profiles::NotificationsController < Profiles::ApplicationController def show - @user = current_user - @group_notifications = current_user.notification_settings.for_groups - @project_notifications = current_user.notification_settings.for_projects + @user = current_user + @group_notifications = current_user.notification_settings.for_groups + @project_notifications = current_user.notification_settings.for_projects + @global_notification_setting = current_user.global_notification_setting end def update - if current_user.update_attributes(user_params) + if current_user.update_attributes(user_params) && update_notification_settings flash[:notice] = "Notification settings saved" else flash[:alert] = "Failed to save new settings" @@ -18,4 +19,19 @@ class Profiles::NotificationsController < Profiles::ApplicationController def user_params params.require(:user).permit(:notification_email, :notification_level) end + + def notification_params + params.require(:notification_level) + end + + private + + def update_notification_settings + return true unless notification_params + + notification_setting = current_user.global_notification_setting + notification_setting.level = notification_params + + notification_setting.save + end end diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index b8e64b3890a..9769458f79e 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -61,4 +61,36 @@ module NotificationsHelper end end end + + def notification_level_radio_buttons + html = "" + + NotificationSetting.levels.each_key do |level| + level = level.to_sym + next if level == :global + + html << content_tag(:div, class: "radio") do + content_tag(:label, { value: level }) do + radio_button_tag(:notification_level, level, @global_notification_setting.level.to_sym == level) + + content_tag(:div, level.to_s.capitalize, class: "level-title") + + content_tag(:p, notification_level_description(level)) + end + end + end + + html.html_safe + end + + def notification_level_description(level) + case level + when :disabled + "You will not get any notifications via email" + when :mention + "You will receive notifications only for comments in which you were @mentioned" + when :participating + "You will only receive notifications from related resources (e.g. from your commits or assigned issues)" + when :watch + "You will receive notifications for any activity" + end + end end diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb index 17fb15b08df..0ce87968e46 100644 --- a/app/models/notification_setting.rb +++ b/app/models/notification_setting.rb @@ -7,7 +7,6 @@ class NotificationSetting < ActiveRecord::Base belongs_to :source, polymorphic: true validates :user, presence: true - validates :source, presence: true validates :level, presence: true validates :user_id, uniqueness: { scope: [:source_type, :source_id], message: "already exists in source", diff --git a/app/models/user.rb b/app/models/user.rb index e0987e07e1f..d2da83ab4b3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -10,6 +10,8 @@ class User < ActiveRecord::Base include CaseSensitivity include TokenAuthenticatable + DEFAULT_NOTIFICATION_LEVEL = :participating + add_authentication_token_field :authentication_token default_value_for :admin, false @@ -99,7 +101,6 @@ class User < ActiveRecord::Base presence: true, uniqueness: { case_sensitive: false } - validates :notification_level, presence: true validate :namespace_uniq, if: ->(user) { user.username_changed? } validate :avatar_type, if: ->(user) { user.avatar.present? && user.avatar_changed? } validate :unique_email, if: ->(user) { user.email_changed? } @@ -133,13 +134,6 @@ class User < ActiveRecord::Base # Note: When adding an option, it MUST go on the end of the array. enum project_view: [:readme, :activity, :files] - # Notification level - # Note: When adding an option, it MUST go on the end of the array. - # - # TODO: Add '_prefix: :notification' to enum when update to Rails 5. https://github.com/rails/rails/pull/19813 - # Because user.notification_disabled? is much better than user.disabled? - enum notification_level: [:disabled, :participating, :watch, :global, :mention] - alias_attribute :private_token, :authentication_token delegate :path, to: :namespace, allow_nil: true, prefix: true @@ -800,6 +794,14 @@ class User < ActiveRecord::Base notification_settings.find_or_initialize_by(source: source) end + # Lazy load global notification setting + # Initializes User setting with Participating level if setting not persisted + def global_notification_setting + setting = notification_settings.find_or_initialize_by(source: nil) + setting.level = NotificationSetting.levels[DEFAULT_NOTIFICATION_LEVEL] unless setting.persisted? + setting + end + def assigned_open_merge_request_count(force: false) Rails.cache.fetch(['users', id, 'assigned_open_merge_request_count'], force: force) do assigned_merge_requests.opened.count diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index 91ca82ed3b7..af7bbe37439 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -279,10 +279,11 @@ class NotificationService end def users_with_global_level_watch(ids) - User.where( - id: ids, - notification_level: NotificationSetting.levels[:watch] - ).pluck(:id) + NotificationSetting.where( + user_id: ids, + source_type: nil, + level: NotificationSetting.levels[:watch] + ).pluck(:user_id) end # Build a list of users based on project notifcation settings @@ -352,7 +353,7 @@ class NotificationService users = users.reject(&:blocked?) users.reject do |user| - next user.notification_level == level unless project + next user.global_notification_setting.level == level unless project setting = user.notification_settings_for(project) @@ -361,13 +362,13 @@ class NotificationService end # reject users who globally set mention notification and has no setting per project/group - next user.notification_level == level unless setting + next user.global_notification_setting.level == level unless setting # reject users who set mention notification in project next true if setting.level == level # reject users who have mention level in project and disabled in global settings - setting.global? && user.notification_level == level + setting.global? && user.global_notification_setting.level == level end end @@ -456,7 +457,6 @@ class NotificationService def build_recipients(target, project, current_user, action: nil, previous_assignee: nil) recipients = target.participants(current_user) - recipients = add_project_watchers(recipients, project) recipients = reject_mention_users(recipients, project) diff --git a/app/views/profiles/notifications/_group_settings.html.haml b/app/views/profiles/notifications/_group_settings.html.haml index 89ae7ffda2b..f0cf82afe83 100644 --- a/app/views/profiles/notifications/_group_settings.html.haml +++ b/app/views/profiles/notifications/_group_settings.html.haml @@ -1,7 +1,7 @@ %li.notification-list-item %span.notification.fa.fa-holder.append-right-5 - if setting.global? - = notification_icon(current_user.notification_level) + = notification_icon(current_user.global_notification_setting.level) - else = notification_icon(setting.level) diff --git a/app/views/profiles/notifications/_project_settings.html.haml b/app/views/profiles/notifications/_project_settings.html.haml index 17c097154da..e0fad555c09 100644 --- a/app/views/profiles/notifications/_project_settings.html.haml +++ b/app/views/profiles/notifications/_project_settings.html.haml @@ -1,7 +1,7 @@ %li.notification-list-item %span.notification.fa.fa-holder.append-right-5 - if setting.global? - = notification_icon(current_user.notification_level) + = notification_icon(current_user.global_notification_setting.level) - else = notification_icon(setting.level) diff --git a/app/views/profiles/notifications/show.html.haml b/app/views/profiles/notifications/show.html.haml index 7696f112bb3..f2659ac14b5 100644 --- a/app/views/profiles/notifications/show.html.haml +++ b/app/views/profiles/notifications/show.html.haml @@ -26,33 +26,7 @@ = f.select :notification_email, @user.all_emails, { include_blank: false }, class: "select2" .form-group = f.label :notification_level, class: 'label-light' - .radio - = f.label :notification_level, value: :disabled do - = f.radio_button :notification_level, :disabled - .level-title - Disabled - %p You will not get any notifications via email - - .radio - = f.label :notification_level, value: :mention do - = f.radio_button :notification_level, :mention - .level-title - On Mention - %p You will receive notifications only for comments in which you were @mentioned - - .radio - = f.label :notification_level, value: :participating do - = f.radio_button :notification_level, :participating - .level-title - Participating - %p You will only receive notifications from related resources (e.g. from your commits or assigned issues) - - .radio - = f.label :notification_level, value: :watch do - = f.radio_button :notification_level, :watch - .level-title - Watch - %p You will receive notifications for any activity + = notification_level_radio_buttons .prepend-top-default = f.submit 'Update settings', class: "btn btn-create" diff --git a/db/migrate/20160606192159_remove_notification_setting_not_null_constraints.rb b/db/migrate/20160606192159_remove_notification_setting_not_null_constraints.rb new file mode 100644 index 00000000000..c20ac9acdc2 --- /dev/null +++ b/db/migrate/20160606192159_remove_notification_setting_not_null_constraints.rb @@ -0,0 +1,7 @@ +class RemoveNotificationSettingNotNullConstraints < ActiveRecord::Migration + def up + change_column :notification_settings, :source_type, :string, null: true + change_column :notification_settings, :source_id, :integer, null: true + change_column :users, :notification_level, :integer, null: true + end +end diff --git a/db/migrate/20160607201627_migrate_users_notification_level.rb b/db/migrate/20160607201627_migrate_users_notification_level.rb new file mode 100644 index 00000000000..7417d66fef7 --- /dev/null +++ b/db/migrate/20160607201627_migrate_users_notification_level.rb @@ -0,0 +1,24 @@ +class MigrateUsersNotificationLevel < ActiveRecord::Migration + # Migrates only users which changes theier default notification level :participating + # creating a new record on notification settins table + + def up + changed_users = exec_query(%Q{ + SELECT id, notification_level + FROM users + WHERE notification_level != 1 + }) + + changed_users.each do |row| + uid = row['id'] + u_notification_level = row['notification_level'] + + execute(%Q{ + INSERT INTO notification_settings + (user_id, level, created_at, updated_at) + VALUES + (#{uid}, #{u_notification_level}, now(), now()) + }) + end + end +end diff --git a/spec/models/notification_setting_spec.rb b/spec/models/notification_setting_spec.rb index 295081e9da1..4e24e89b008 100644 --- a/spec/models/notification_setting_spec.rb +++ b/spec/models/notification_setting_spec.rb @@ -10,7 +10,6 @@ RSpec.describe NotificationSetting, type: :model do subject { NotificationSetting.new(source_id: 1, source_type: 'Project') } it { is_expected.to validate_presence_of(:user) } - it { is_expected.to validate_presence_of(:source) } it { is_expected.to validate_presence_of(:level) } it { is_expected.to validate_uniqueness_of(:user_id).scoped_to([:source_id, :source_type]).with_message(/already exists in source/) } end diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index cef5e0d8659..5a9a9d62a15 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -72,6 +72,7 @@ describe NotificationService, services: true do should_not_email(@u_disabled) should_not_email(@unsubscriber) should_not_email(@u_outsider_mentioned) + should_not_email(@u_lazy_participant) end it 'filters out "mentioned in" notes' do @@ -80,6 +81,19 @@ describe NotificationService, services: true do expect(Notify).not_to receive(:note_issue_email) notification.new_note(mentioned_note) end + + context 'participating' do + context 'by note' do + before do + note.author = @u_lazy_participant + note.save + notification.new_note(note) + end + + + it { should_email(@u_lazy_participant) } + end + end end describe 'new note on issue in project that belongs to a group' do @@ -106,6 +120,7 @@ describe NotificationService, services: true do should_not_email(note.author) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) end end end @@ -235,6 +250,7 @@ describe NotificationService, services: true do should_not_email(note.author) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) end it do @@ -248,10 +264,11 @@ describe NotificationService, services: true do should_not_email(note.author) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) end it do - @u_committer.update_attributes(notification_level: :mention) + @u_committer = create_global_setting_for(@u_committer, :mention) notification.new_note(note) should_not_email(@u_committer) end @@ -280,10 +297,11 @@ describe NotificationService, services: true do should_not_email(@u_mentioned) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) end it do - issue.assignee.update_attributes(notification_level: :mention) + create_global_setting_for(issue.assignee, :mention) notification.new_issue(issue, @u_disabled) should_not_email(issue.assignee) @@ -341,6 +359,7 @@ describe NotificationService, services: true do should_not_email(@unsubscriber) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) end it 'emails previous assignee even if he has the "on mention" notif level' do @@ -356,6 +375,7 @@ describe NotificationService, services: true do should_not_email(@unsubscriber) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) end it 'emails new assignee even if he has the "on mention" notif level' do @@ -371,6 +391,7 @@ describe NotificationService, services: true do should_not_email(@unsubscriber) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) end it 'emails new assignee' do @@ -386,6 +407,7 @@ describe NotificationService, services: true do should_not_email(@unsubscriber) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) end it 'does not email new assignee if they are the current user' do @@ -401,6 +423,35 @@ describe NotificationService, services: true do should_not_email(@unsubscriber) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) + end + + context 'participating' do + context 'by assignee' do + before do + issue.update_attribute(:assignee, @u_lazy_participant) + notification.reassigned_issue(issue, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end + + context 'by note' do + let!(:note) { create(:note_on_issue, noteable: issue, project_id: issue.project_id, note: 'anything', author: @u_lazy_participant) } + + before { notification.reassigned_issue(issue, @u_disabled) } + + it { should_email(@u_lazy_participant) } + end + + context 'by author' do + before do + issue.author = @u_lazy_participant + notification.reassigned_issue(issue, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end end end @@ -479,6 +530,35 @@ describe NotificationService, services: true do should_not_email(@unsubscriber) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) + end + + context 'participating' do + context 'by assignee' do + before do + issue.update_attribute(:assignee, @u_lazy_participant) + notification.close_issue(issue, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end + + context 'by note' do + let!(:note) { create(:note_on_issue, noteable: issue, project_id: issue.project_id, note: 'anything', author: @u_lazy_participant) } + + before { notification.close_issue(issue, @u_disabled) } + + it { should_email(@u_lazy_participant) } + end + + context 'by author' do + before do + issue.author = @u_lazy_participant + notification.close_issue(issue, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end end end @@ -495,6 +575,35 @@ describe NotificationService, services: true do should_email(@watcher_and_subscriber) should_not_email(@unsubscriber) should_not_email(@u_participating) + should_not_email(@u_lazy_participant) + end + + context 'participating' do + context 'by assignee' do + before do + issue.update_attribute(:assignee, @u_lazy_participant) + notification.reopen_issue(issue, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end + + context 'by note' do + let!(:note) { create(:note_on_issue, noteable: issue, project_id: issue.project_id, note: 'anything', author: @u_lazy_participant) } + + before { notification.reopen_issue(issue, @u_disabled) } + + it { should_email(@u_lazy_participant) } + end + + context 'by author' do + before do + issue.author = @u_lazy_participant + notification.reopen_issue(issue, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end end end end @@ -520,6 +629,7 @@ describe NotificationService, services: true do should_email(@u_guest_watcher) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) end it "emails subscribers of the merge request's labels" do @@ -530,6 +640,36 @@ describe NotificationService, services: true do should_email(subscriber) end + + + context 'participating' do + context 'by assignee' do + before do + merge_request.update_attribute(:assignee, @u_lazy_participant) + notification.new_merge_request(merge_request, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end + + context 'by note' do + let!(:note) { create(:note_on_issue, noteable: merge_request, project_id: project.id, note: 'anything', author: @u_lazy_participant) } + + before { notification.new_merge_request(merge_request, @u_disabled) } + + it { should_email(@u_lazy_participant) } + end + + context 'by author' do + before do + merge_request.author = @u_lazy_participant + merge_request.save + notification.new_merge_request(merge_request, @u_disabled) + end + + it { should_not_email(@u_lazy_participant) } + end + end end describe '#reassigned_merge_request' do @@ -545,6 +685,36 @@ describe NotificationService, services: true do should_not_email(@unsubscriber) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) + end + + context 'participating' do + context 'by assignee' do + before do + merge_request.update_attribute(:assignee, @u_lazy_participant) + notification.reassigned_merge_request(merge_request, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end + + context 'by note' do + let!(:note) { create(:note_on_issue, noteable: merge_request, project_id: project.id, note: 'anything', author: @u_lazy_participant) } + + before { notification.reassigned_merge_request(merge_request, @u_disabled) } + + it { should_email(@u_lazy_participant) } + end + + context 'by author' do + before do + merge_request.author = @u_lazy_participant + merge_request.save + notification.reassigned_merge_request(merge_request, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end end end @@ -572,6 +742,7 @@ describe NotificationService, services: true do should_not_email(@watcher_and_subscriber) should_not_email(@unsubscriber) should_not_email(@u_participating) + should_not_email(@u_lazy_participant) should_not_email(subscriber_to_label) should_email(subscriber_to_label2) end @@ -590,6 +761,36 @@ describe NotificationService, services: true do should_not_email(@unsubscriber) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) + end + + context 'participating' do + context 'by assignee' do + before do + merge_request.update_attribute(:assignee, @u_lazy_participant) + notification.close_mr(merge_request, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end + + context 'by note' do + let!(:note) { create(:note_on_issue, noteable: merge_request, project_id: project.id, note: 'anything', author: @u_lazy_participant) } + + before { notification.close_mr(merge_request, @u_disabled) } + + it { should_email(@u_lazy_participant) } + end + + context 'by author' do + before do + merge_request.author = @u_lazy_participant + merge_request.save + notification.close_mr(merge_request, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end end end @@ -606,6 +807,36 @@ describe NotificationService, services: true do should_not_email(@unsubscriber) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) + end + + context 'participating' do + context 'by assignee' do + before do + merge_request.update_attribute(:assignee, @u_lazy_participant) + notification.merge_mr(merge_request, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end + + context 'by note' do + let!(:note) { create(:note_on_issue, noteable: merge_request, project_id: project.id, note: 'anything', author: @u_lazy_participant) } + + before { notification.merge_mr(merge_request, @u_disabled) } + + it { should_email(@u_lazy_participant) } + end + + context 'by author' do + before do + merge_request.author = @u_lazy_participant + merge_request.save + notification.merge_mr(merge_request, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end end end @@ -622,6 +853,36 @@ describe NotificationService, services: true do should_not_email(@unsubscriber) should_not_email(@u_participating) should_not_email(@u_disabled) + should_not_email(@u_lazy_participant) + end + + context 'participating' do + context 'by assignee' do + before do + merge_request.update_attribute(:assignee, @u_lazy_participant) + notification.reopen_mr(merge_request, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end + + context 'by note' do + let!(:note) { create(:note_on_issue, noteable: merge_request, project_id: project.id, note: 'anything', author: @u_lazy_participant) } + + before { notification.reopen_mr(merge_request, @u_disabled) } + + it { should_email(@u_lazy_participant) } + end + + context 'by author' do + before do + merge_request.author = @u_lazy_participant + merge_request.save + notification.reopen_mr(merge_request, @u_disabled) + end + + it { should_email(@u_lazy_participant) } + end end end end @@ -640,6 +901,7 @@ describe NotificationService, services: true do should_email(@u_watcher) should_email(@u_participating) + should_email(@u_lazy_participant) should_not_email(@u_guest_watcher) should_not_email(@u_disabled) end @@ -647,14 +909,19 @@ describe NotificationService, services: true do end def build_team(project) - @u_watcher = create(:user, notification_level: :watch) - @u_participating = create(:user, notification_level: :participating) - @u_participant_mentioned = create(:user, username: 'participant', notification_level: :participating) - @u_disabled = create(:user, notification_level: :disabled) - @u_mentioned = create(:user, username: 'mention', notification_level: :mention) - @u_committer = create(:user, username: 'committer') - @u_not_mentioned = create(:user, username: 'regular', notification_level: :participating) - @u_outsider_mentioned = create(:user, username: 'outsider') + @u_watcher = create_global_setting_for(create(:user), :watch) + @u_participating = create_global_setting_for(create(:user), :participating) + @u_participant_mentioned = create_global_setting_for(create(:user, username: 'participant'), :participating) + @u_disabled = create_global_setting_for(create(:user), :disabled) + @u_mentioned = create_global_setting_for(create(:user, username: 'mention'), :mention) + @u_committer = create(:user, username: 'committer') + @u_not_mentioned = create_global_setting_for(create(:user, username: 'regular'), :participating) + @u_outsider_mentioned = create(:user, username: 'outsider') + + # User to be participant by default + # This user does not contain any record in notification settings table + # It should be treated with a :participating notification_level + @u_lazy_participant = create(:user, username: 'lazy-participant') create_guest_watcher @@ -665,6 +932,15 @@ describe NotificationService, services: true do project.team << [@u_mentioned, :master] project.team << [@u_committer, :master] project.team << [@u_not_mentioned, :master] + project.team << [@u_lazy_participant, :master] + end + + def create_global_setting_for(user, level) + setting = user.global_notification_setting + setting.level = level + setting.save + + user end def create_guest_watcher From 39ead205de72461e86db07525922f2fab5fff2a9 Mon Sep 17 00:00:00 2001 From: Felipe Artur Date: Thu, 9 Jun 2016 16:33:31 -0300 Subject: [PATCH 45/87] Remove notification level fild from users, improve migrations and specs --- .../profiles/notifications_controller.rb | 13 ++++------ app/helpers/notifications_helper.rb | 17 ++----------- app/models/user.rb | 9 ++++--- app/services/notification_service.rb | 8 ++++--- ...201627_migrate_users_notification_level.rb | 24 ------------------- ...ification_setting_not_null_constraints.rb} | 6 ++++- ...201627_migrate_users_notification_level.rb | 21 ++++++++++++++++ ...27_remove_notification_level_from_users.rb | 7 ++++++ spec/services/notification_service_spec.rb | 7 +++--- 9 files changed, 55 insertions(+), 57 deletions(-) delete mode 100644 db/migrate/20160607201627_migrate_users_notification_level.rb rename db/migrate/{20160606192159_remove_notification_setting_not_null_constraints.rb => 20160610140403_remove_notification_setting_not_null_constraints.rb} (58%) create mode 100644 db/migrate/20160610201627_migrate_users_notification_level.rb create mode 100644 db/migrate/20160610301627_remove_notification_level_from_users.rb diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb index 1e9ceb87857..40d1906a53f 100644 --- a/app/controllers/profiles/notifications_controller.rb +++ b/app/controllers/profiles/notifications_controller.rb @@ -17,21 +17,18 @@ class Profiles::NotificationsController < Profiles::ApplicationController end def user_params - params.require(:user).permit(:notification_email, :notification_level) + params.require(:user).permit(:notification_email) end - def notification_params - params.require(:notification_level) + def global_notification_setting_params + params.require(:global_notification_setting).permit(:level) end private def update_notification_settings - return true unless notification_params + return true unless global_notification_setting_params - notification_setting = current_user.global_notification_setting - notification_setting.level = notification_params - - notification_setting.save + current_user.global_notification_setting.update_attributes(global_notification_setting_params) end end diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 9769458f79e..50c21fc0d49 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -71,26 +71,13 @@ module NotificationsHelper html << content_tag(:div, class: "radio") do content_tag(:label, { value: level }) do - radio_button_tag(:notification_level, level, @global_notification_setting.level.to_sym == level) + + radio_button_tag(:"global_notification_setting[level]", level, @global_notification_setting.level.to_sym == level) + content_tag(:div, level.to_s.capitalize, class: "level-title") + - content_tag(:p, notification_level_description(level)) + content_tag(:p, notification_description(level)) end end end html.html_safe end - - def notification_level_description(level) - case level - when :disabled - "You will not get any notifications via email" - when :mention - "You will receive notifications only for comments in which you were @mentioned" - when :participating - "You will only receive notifications from related resources (e.g. from your commits or assigned issues)" - when :watch - "You will receive notifications for any activity" - end - end end diff --git a/app/models/user.rb b/app/models/user.rb index d2da83ab4b3..7afbfbf112a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -797,9 +797,12 @@ class User < ActiveRecord::Base # Lazy load global notification setting # Initializes User setting with Participating level if setting not persisted def global_notification_setting - setting = notification_settings.find_or_initialize_by(source: nil) - setting.level = NotificationSetting.levels[DEFAULT_NOTIFICATION_LEVEL] unless setting.persisted? - setting + return @global_notification_setting if defined?(@global_notification_setting) + + @global_notification_setting = notification_settings.find_or_initialize_by(source: nil) + @global_notification_setting.update_attributes(level: NotificationSetting.levels[DEFAULT_NOTIFICATION_LEVEL]) unless @global_notification_setting.persisted? + + @global_notification_setting end def assigned_open_merge_request_count(force: false) diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index af7bbe37439..875a3f4fab6 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -353,7 +353,9 @@ class NotificationService users = users.reject(&:blocked?) users.reject do |user| - next user.global_notification_setting.level == level unless project + global_notification_setting = user.global_notification_setting + + next global_notification_setting.level == level unless project setting = user.notification_settings_for(project) @@ -362,13 +364,13 @@ class NotificationService end # reject users who globally set mention notification and has no setting per project/group - next user.global_notification_setting.level == level unless setting + next global_notification_setting.level == level unless setting # reject users who set mention notification in project next true if setting.level == level # reject users who have mention level in project and disabled in global settings - setting.global? && user.global_notification_setting.level == level + setting.global? && global_notification_setting.level == level end end diff --git a/db/migrate/20160607201627_migrate_users_notification_level.rb b/db/migrate/20160607201627_migrate_users_notification_level.rb deleted file mode 100644 index 7417d66fef7..00000000000 --- a/db/migrate/20160607201627_migrate_users_notification_level.rb +++ /dev/null @@ -1,24 +0,0 @@ -class MigrateUsersNotificationLevel < ActiveRecord::Migration - # Migrates only users which changes theier default notification level :participating - # creating a new record on notification settins table - - def up - changed_users = exec_query(%Q{ - SELECT id, notification_level - FROM users - WHERE notification_level != 1 - }) - - changed_users.each do |row| - uid = row['id'] - u_notification_level = row['notification_level'] - - execute(%Q{ - INSERT INTO notification_settings - (user_id, level, created_at, updated_at) - VALUES - (#{uid}, #{u_notification_level}, now(), now()) - }) - end - end -end diff --git a/db/migrate/20160606192159_remove_notification_setting_not_null_constraints.rb b/db/migrate/20160610140403_remove_notification_setting_not_null_constraints.rb similarity index 58% rename from db/migrate/20160606192159_remove_notification_setting_not_null_constraints.rb rename to db/migrate/20160610140403_remove_notification_setting_not_null_constraints.rb index c20ac9acdc2..259abb08e47 100644 --- a/db/migrate/20160606192159_remove_notification_setting_not_null_constraints.rb +++ b/db/migrate/20160610140403_remove_notification_setting_not_null_constraints.rb @@ -2,6 +2,10 @@ class RemoveNotificationSettingNotNullConstraints < ActiveRecord::Migration def up change_column :notification_settings, :source_type, :string, null: true change_column :notification_settings, :source_id, :integer, null: true - change_column :users, :notification_level, :integer, null: true + end + + def down + change_column :notification_settings, :source_type, :string, null: false + change_column :notification_settings, :source_id, :integer, null: false end end diff --git a/db/migrate/20160610201627_migrate_users_notification_level.rb b/db/migrate/20160610201627_migrate_users_notification_level.rb new file mode 100644 index 00000000000..760b766828e --- /dev/null +++ b/db/migrate/20160610201627_migrate_users_notification_level.rb @@ -0,0 +1,21 @@ +class MigrateUsersNotificationLevel < ActiveRecord::Migration + # Migrates only users who changed their default notification level :participating + # creating a new record on notification settings table + + def up + execute(%Q{ + INSERT INTO notification_settings + (user_id, level, created_at, updated_at) + (SELECT id, notification_level, created_at, updated_at FROM users WHERE notification_level != 1) + }) + end + + # Migrates from notification settings back to user notification_level + # If no value is found the default level of 1 will be used + def down + execute(%Q{ + UPDATE users u SET + notification_level = COALESCE((SELECT level FROM notification_settings WHERE user_id = u.id AND source_type IS NULL), 1) + }) + end +end diff --git a/db/migrate/20160610301627_remove_notification_level_from_users.rb b/db/migrate/20160610301627_remove_notification_level_from_users.rb new file mode 100644 index 00000000000..8afb14df2cf --- /dev/null +++ b/db/migrate/20160610301627_remove_notification_level_from_users.rb @@ -0,0 +1,7 @@ +class RemoveNotificationLevelFromUsers < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + def change + remove_column :users, :notification_level, :integer + end +end diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index 5a9a9d62a15..b99e02ba678 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -85,13 +85,14 @@ describe NotificationService, services: true do context 'participating' do context 'by note' do before do + ActionMailer::Base.deliveries.clear note.author = @u_lazy_participant note.save notification.new_note(note) end - it { should_email(@u_lazy_participant) } + it { should_not_email(@u_lazy_participant) } end end end @@ -953,8 +954,8 @@ describe NotificationService, services: true do def add_users_with_subscription(project, issuable) @subscriber = create :user @unsubscriber = create :user - @subscribed_participant = create(:user, username: 'subscribed_participant', notification_level: :participating) - @watcher_and_subscriber = create(:user, notification_level: :watch) + @subscribed_participant = create_global_setting_for(create(:user, username: 'subscribed_participant'), :participating) + @watcher_and_subscriber = create_global_setting_for(create(:user), :watch) project.team << [@subscribed_participant, :master] project.team << [@subscriber, :master] From 483e4571a638a62e5e69163f6a8a4303167cd115 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Fri, 10 Jun 2016 14:04:39 +0100 Subject: [PATCH 46/87] Fixed search form padding Updated CHANGELOG Removed CHANGELOG entry --- app/assets/stylesheets/framework/nav.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index a036799e15a..47af3ab9acb 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -171,7 +171,6 @@ > form { display: inline-block; margin-top: -1px; - margin-bottom: 12px; } .icon-label { From 1976a44649edcac40058cf39600e134ec6112408 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Jun 2016 16:17:28 +0300 Subject: [PATCH 47/87] Move Labels and Milestones as sub tab to Issues/MR Signed-off-by: Dmitriy Zaporozhets --- app/views/layouts/nav/_project.html.haml | 16 +---- app/views/projects/issues/_head.html.haml | 25 ++++++++ app/views/projects/issues/index.html.haml | 33 +++++----- app/views/projects/labels/index.html.haml | 63 ++++++++++--------- .../projects/merge_requests/_head.html.haml | 5 -- .../projects/merge_requests/index.html.haml | 26 ++++---- app/views/projects/milestones/index.html.haml | 29 +++++---- 7 files changed, 107 insertions(+), 90 deletions(-) create mode 100644 app/views/projects/issues/_head.html.haml delete mode 100644 app/views/projects/merge_requests/_head.html.haml diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index ca99ba8def3..9dc76fce9e1 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -33,7 +33,7 @@ = navbar_icon('activity') %span Activity - + - if project_nav_tab? :files = nav_link(controller: %w(tree blob blame edit_tree new_tree find_file commit commits compare repositories tags branches releases network)) do = link_to project_files_path(@project), title: 'Code', class: 'shortcuts-tree' do @@ -62,13 +62,6 @@ %span Graphs - - if project_nav_tab? :milestones - = nav_link(controller: :milestones) do - = link_to namespace_project_milestones_path(@project.namespace, @project), title: 'Milestones' do - = navbar_icon('milestones') - %span - Milestones - - if project_nav_tab? :issues = nav_link(controller: :issues) do = link_to url_for_project_issues(@project, only_path: true), title: 'Issues', class: 'shortcuts-issues' do @@ -86,13 +79,6 @@ Merge Requests %span.badge.count.merge_counter= number_with_delimiter(@project.merge_requests.opened.count) - - if project_nav_tab? :labels - = nav_link(controller: :labels) do - = link_to namespace_project_labels_path(@project.namespace, @project), title: 'Labels' do - = icon('tags fw') - %span - Labels - - if project_nav_tab? :wiki = nav_link(controller: :wikis) do = link_to get_project_wiki_path(@project), title: 'Wiki', class: 'shortcuts-wiki' do diff --git a/app/views/projects/issues/_head.html.haml b/app/views/projects/issues/_head.html.haml new file mode 100644 index 00000000000..d0481be9932 --- /dev/null +++ b/app/views/projects/issues/_head.html.haml @@ -0,0 +1,25 @@ +%ul.nav-links.sub-nav + %div{ class: (container_class) } + - if project_nav_tab?(:issues) + = nav_link(controller: :issues) do + = link_to url_for_project_issues(@project, only_path: true), title: 'Issues' do + %span + Issues + + - if project_nav_tab?(:merge_requests) + = nav_link(controller: :merge_requests) do + = link_to namespace_project_merge_requests_path(@project.namespace, @project), title: 'Merge Requests' do + %span + Merge Requests + + - if project_nav_tab? :labels + = nav_link(controller: :labels) do + = link_to namespace_project_labels_path(@project.namespace, @project), title: 'Labels' do + %span + Labels + + - if project_nav_tab? :milestones + = nav_link(controller: :milestones) do + = link_to namespace_project_milestones_path(@project.namespace, @project), title: 'Milestones' do + %span + Milestones diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml index 7c1457553d9..cd876b5ea62 100644 --- a/app/views/projects/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -1,23 +1,26 @@ +- @no_container = true - page_title "Issues" += render "projects/issues/head" = content_for :meta_tags do - if current_user = auto_discovery_link_tag(:atom, namespace_project_issues_url(@project.namespace, @project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues") -.top-area - = render 'shared/issuable/nav', type: :issues - .nav-controls - - if current_user - = link_to namespace_project_issues_path(@project.namespace, @project, :atom, { private_token: current_user.private_token }), class: 'btn append-right-10' do - = icon('rss') - %span.icon-label - Subscribe - = render 'shared/issuable/search_form', path: namespace_project_issues_path(@project.namespace, @project) - - if can? current_user, :create_issue, @project - = link_to new_namespace_project_issue_path(@project.namespace, @project, issue: { assignee_id: @issuable_finder.assignee.try(:id), milestone_id: @issuable_finder.milestones.try(:first).try(:id) }), class: "btn btn-new", title: "New Issue", id: "new_issue_link" do - New Issue +%div{ class: (container_class) } + .top-area + = render 'shared/issuable/nav', type: :issues + .nav-controls + - if current_user + = link_to namespace_project_issues_path(@project.namespace, @project, :atom, { private_token: current_user.private_token }), class: 'btn append-right-10' do + = icon('rss') + %span.icon-label + Subscribe + = render 'shared/issuable/search_form', path: namespace_project_issues_path(@project.namespace, @project) + - if can? current_user, :create_issue, @project + = link_to new_namespace_project_issue_path(@project.namespace, @project, issue: { assignee_id: @issuable_finder.assignee.try(:id), milestone_id: @issuable_finder.milestones.try(:first).try(:id) }), class: "btn btn-new", title: "New Issue", id: "new_issue_link" do + New Issue -= render 'shared/issuable/filter', type: :issues + = render 'shared/issuable/filter', type: :issues -.issues-holder - = render "issues" + .issues-holder + = render "issues" diff --git a/app/views/projects/labels/index.html.haml b/app/views/projects/labels/index.html.haml index 93583c92609..6e1baa46b05 100644 --- a/app/views/projects/labels/index.html.haml +++ b/app/views/projects/labels/index.html.haml @@ -1,35 +1,38 @@ +- @no_container = true - page_title "Labels" - hide_class = '' += render "projects/issues/head" -.top-area - .nav-text - Labels can be applied to issues and merge requests. - .nav-controls - - if can?(current_user, :admin_label, @project) - = link_to new_namespace_project_label_path(@project.namespace, @project), class: "btn btn-new" do - New label +%div{ class: (container_class) } + .top-area + .nav-text + Labels can be applied to issues and merge requests. + .nav-controls + - if can?(current_user, :admin_label, @project) + = link_to new_namespace_project_label_path(@project.namespace, @project), class: "btn btn-new" do + New label -.labels - - if can?(current_user, :admin_label, @project) - -# Only show it in the first page - - hide = @project.labels.empty? || (params[:page].present? && params[:page] != '1') - .prioritized-labels{ class: ('hide' if hide) } - %h5 Prioritized Labels - %ul.content-list.manage-labels-list.js-prioritized-labels{ "data-url" => set_priorities_namespace_project_labels_path(@project.namespace, @project) } - - if @prioritized_labels.present? - = render @prioritized_labels - - else - %p.empty-message No prioritized labels yet - .other-labels + .labels - if can?(current_user, :admin_label, @project) - %h5{ class: ('hide' if hide) } Other Labels - - if @labels.present? - %ul.content-list.manage-labels-list.js-other-labels - = render @labels - = paginate @labels, theme: 'gitlab' - - else - .nothing-here-block - - if can?(current_user, :admin_label, @project) - Create a label or #{link_to 'generate a default set of labels', generate_namespace_project_labels_path(@project.namespace, @project), method: :post}. - - else - No labels created + -# Only show it in the first page + - hide = @project.labels.empty? || (params[:page].present? && params[:page] != '1') + .prioritized-labels{ class: ('hide' if hide) } + %h5 Prioritized Labels + %ul.content-list.manage-labels-list.js-prioritized-labels{ "data-url" => set_priorities_namespace_project_labels_path(@project.namespace, @project) } + - if @prioritized_labels.present? + = render @prioritized_labels + - else + %p.empty-message No prioritized labels yet + .other-labels + - if can?(current_user, :admin_label, @project) + %h5{ class: ('hide' if hide) } Other Labels + - if @labels.present? + %ul.content-list.manage-labels-list.js-other-labels + = render @labels + = paginate @labels, theme: 'gitlab' + - else + .nothing-here-block + - if can?(current_user, :admin_label, @project) + Create a label or #{link_to 'generate a default set of labels', generate_namespace_project_labels_path(@project.namespace, @project), method: :post}. + - else + No labels created diff --git a/app/views/projects/merge_requests/_head.html.haml b/app/views/projects/merge_requests/_head.html.haml deleted file mode 100644 index 19e4dab874b..00000000000 --- a/app/views/projects/merge_requests/_head.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -.top-tabs - = link_to namespace_project_merge_requests_path(@project.namespace, @project), class: "tab #{'active' if current_page?(namespace_project_merge_requests_path(@project.namespace, @project)) }" do - %span - Merge Requests - diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml index c8653cb0c30..9f948d41dda 100644 --- a/app/views/projects/merge_requests/index.html.haml +++ b/app/views/projects/merge_requests/index.html.haml @@ -1,18 +1,20 @@ +- @no_container = true - page_title "Merge Requests" - += render "projects/issues/head" = render 'projects/last_push' -.top-area - = render 'shared/issuable/nav', type: :merge_requests - .nav-controls - = render 'shared/issuable/search_form', path: namespace_project_merge_requests_path(@project.namespace, @project) +%div{ class: (container_class) } + .top-area + = render 'shared/issuable/nav', type: :merge_requests + .nav-controls + = render 'shared/issuable/search_form', path: namespace_project_merge_requests_path(@project.namespace, @project) - - merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project)) - - if merge_project - = link_to new_namespace_project_merge_request_path(merge_project.namespace, merge_project), class: "btn btn-new", title: "New Merge Request" do - New Merge Request + - merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project)) + - if merge_project + = link_to new_namespace_project_merge_request_path(merge_project.namespace, merge_project), class: "btn btn-new", title: "New Merge Request" do + New Merge Request -= render 'shared/issuable/filter', type: :merge_requests + = render 'shared/issuable/filter', type: :merge_requests -.merge-requests-holder - = render 'merge_requests' + .merge-requests-holder + = render 'merge_requests' diff --git a/app/views/projects/milestones/index.html.haml b/app/views/projects/milestones/index.html.haml index 60a5b83434e..b0e0bdfff5a 100644 --- a/app/views/projects/milestones/index.html.haml +++ b/app/views/projects/milestones/index.html.haml @@ -1,19 +1,22 @@ +- @no_container = true - page_title "Milestones" += render "projects/issues/head" -.top-area - = render 'shared/milestones_filter' +%div{ class: (container_class) } + .top-area + = render 'shared/milestones_filter' - .nav-controls - - if can?(current_user, :admin_milestone, @project) - = link_to new_namespace_project_milestone_path(@project.namespace, @project), class: "btn btn-new", title: "New Milestone" do - New Milestone + .nav-controls + - if can?(current_user, :admin_milestone, @project) + = link_to new_namespace_project_milestone_path(@project.namespace, @project), class: "btn btn-new", title: "New Milestone" do + New Milestone -.milestones - %ul.content-list - = render @milestones + .milestones + %ul.content-list + = render @milestones - - if @milestones.blank? - %li - .nothing-here-block No milestones to show + - if @milestones.blank? + %li + .nothing-here-block No milestones to show - = paginate @milestones, theme: "gitlab" + = paginate @milestones, theme: "gitlab" From d4b2f5d0f3baf4e3644c0e0f71ffb2995fb72a57 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Jun 2016 18:33:44 +0300 Subject: [PATCH 48/87] Render only issues/mr in subnav depends on context Signed-off-by: Dmitriy Zaporozhets --- app/views/layouts/nav/_project.html.haml | 2 +- app/views/projects/issues/_head.html.haml | 4 ++-- features/project/active_tab.feature | 12 ++++++++---- features/steps/project/active_tab.rb | 16 ++++++++-------- features/steps/shared/active_tab.rb | 4 ++-- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index 9dc76fce9e1..79cc5c02888 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -63,7 +63,7 @@ Graphs - if project_nav_tab? :issues - = nav_link(controller: :issues) do + = nav_link(controller: [:issues, :labels, :milestones]) do = link_to url_for_project_issues(@project, only_path: true), title: 'Issues', class: 'shortcuts-issues' do = navbar_icon('issues') %span diff --git a/app/views/projects/issues/_head.html.haml b/app/views/projects/issues/_head.html.haml index d0481be9932..583cc1b975b 100644 --- a/app/views/projects/issues/_head.html.haml +++ b/app/views/projects/issues/_head.html.haml @@ -1,12 +1,12 @@ %ul.nav-links.sub-nav %div{ class: (container_class) } - - if project_nav_tab?(:issues) + - if project_nav_tab?(:issues) && current_controller?(:issues) = nav_link(controller: :issues) do = link_to url_for_project_issues(@project, only_path: true), title: 'Issues' do %span Issues - - if project_nav_tab?(:merge_requests) + - if project_nav_tab?(:merge_requests) && current_controller?(:merge_requests) = nav_link(controller: :merge_requests) do = link_to namespace_project_merge_requests_path(@project.namespace, @project), title: 'Merge Requests' do %span diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature index 26e67503021..c4f987a7923 100644 --- a/features/project/active_tab.feature +++ b/features/project/active_tab.feature @@ -107,12 +107,16 @@ Feature: Project Active Tab Scenario: On Project Issues/Milestones Given I visit my project's issues page - And I click the "Milestones" tab - Then the active main tab should be Milestones + And I click the "Milestones" sub tab + Then the active main tab should be Issues + Then the active sub tab should be Milestones And no other main tabs should be active + And no other sub tabs should be active Scenario: On Project Issues/Labels Given I visit my project's issues page - And I click the "Labels" tab - Then the active main tab should be Labels + And I click the "Labels" sub tab + Then the active main tab should be Issues + Then the active sub tab should be Labels And no other main tabs should be active + And no other sub tabs should be active diff --git a/features/steps/project/active_tab.rb b/features/steps/project/active_tab.rb index 745fd3471c4..80043463188 100644 --- a/features/steps/project/active_tab.rb +++ b/features/steps/project/active_tab.rb @@ -77,14 +77,14 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps # Sub Tabs: Issues - step 'I click the "Milestones" tab' do - page.within('.layout-nav') do + step 'I click the "Milestones" sub tab' do + page.within('.sub-nav') do click_link('Milestones') end end - step 'I click the "Labels" tab' do - page.within('.layout-nav') do + step 'I click the "Labels" sub tab' do + page.within('.sub-nav') do click_link('Labels') end end @@ -93,11 +93,11 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps ensure_active_sub_tab('Issues') end - step 'the active main tab should be Milestones' do - ensure_active_main_tab('Milestones') + step 'the active sub tab should be Milestones' do + ensure_active_sub_tab('Milestones') end - step 'the active main tab should be Labels' do - ensure_active_main_tab('Labels') + step 'the active sub tab should be Labels' do + ensure_active_sub_tab('Labels') end end diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb index ace717b9909..4eef7aff213 100644 --- a/features/steps/shared/active_tab.rb +++ b/features/steps/shared/active_tab.rb @@ -6,7 +6,7 @@ module SharedActiveTab end def ensure_active_sub_tab(content) - expect(find('div.content ul.nav-links li.active')).to have_content(content) + expect(find('.sub-nav li.active')).to have_content(content) end def ensure_active_sub_nav(content) @@ -18,7 +18,7 @@ module SharedActiveTab end step 'no other sub tabs should be active' do - expect(page).to have_selector('div.content ul.nav-links li.active', count: 1) + expect(page).to have_selector('.sub-nav li.active', count: 1) end step 'no other sub navs should be active' do From 95f15b14d19203e99cb1e25c8c40edb61bf914e5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Jun 2016 19:05:55 +0300 Subject: [PATCH 49/87] Render issues link on issues subnav unless you visit merge request controller Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/issues/_head.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/issues/_head.html.haml b/app/views/projects/issues/_head.html.haml index 583cc1b975b..166dae248b6 100644 --- a/app/views/projects/issues/_head.html.haml +++ b/app/views/projects/issues/_head.html.haml @@ -1,6 +1,6 @@ %ul.nav-links.sub-nav %div{ class: (container_class) } - - if project_nav_tab?(:issues) && current_controller?(:issues) + - if project_nav_tab?(:issues) && !current_controller?(:merge_requests) = nav_link(controller: :issues) do = link_to url_for_project_issues(@project, only_path: true), title: 'Issues' do %span From 308bb56781554b9d6436de674ae0291505fd2686 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 10 Jun 2016 19:12:24 +0300 Subject: [PATCH 50/87] Add CHANGELOG item for labels/milestones navigation change Signed-off-by: Dmitriy Zaporozhets --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 0c712b445a4..6487d33d5e8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -63,6 +63,7 @@ v 8.9.0 (unreleased) - Toggling a task list item in a issue/mr description does not creates a Todo for mentions - Improved UX of date pickers on issue & milestone forms - Cache on the database if a project has an active external issue tracker. + - Put project Labels and Milestones pages links under Issues and Merge Requests tabs as subnav v 8.8.5 (unreleased) - Ensure branch cleanup regardless of whether the GitHub import process succeeds From a1db70770ef16b60075ff9ca650eb34f0e002b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 10 Jun 2016 15:21:02 +0200 Subject: [PATCH 51/87] Remove unused MergeRequest#gitlab_merge_status method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©my Coutable --- app/models/merge_request.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 29f36570912..7b8858b24d6 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -276,14 +276,6 @@ class MergeRequest < ActiveRecord::Base true end - def gitlab_merge_status - if work_in_progress? - "work_in_progress" - else - merge_status_name - end - end - def can_cancel_merge_when_build_succeeds?(current_user) can_be_merged_by?(current_user) || self.author == current_user end From a1fbdbb6b106bcf6a959eb8f9a2a89dec6a15c9c Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Thu, 9 Jun 2016 12:37:47 -0500 Subject: [PATCH 52/87] Move tanuki icon to center of nav bar; keep nav closed by default; remove collapsed nav cookie --- app/assets/javascripts/application.js.coffee | 7 +---- app/assets/javascripts/sidebar.js.coffee | 9 ------- app/assets/stylesheets/framework/header.scss | 18 +++++++++++++ app/assets/stylesheets/framework/nav.scss | 1 + app/assets/stylesheets/framework/sidebar.scss | 27 ++++++++++--------- app/views/layouts/_collapse_button.html.haml | 5 +--- app/views/layouts/_page.html.haml | 7 +++-- app/views/layouts/header/_default.html.haml | 6 ++++- 8 files changed, 44 insertions(+), 36 deletions(-) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index e0ca546350b..35b7d4a044a 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -241,7 +241,6 @@ $ -> $this.attr 'value', $this.val() $sidebarGutterToggle = $('.js-sidebar-toggle') - $navIconToggle = $('.toggle-nav-collapse') $(document) .off 'breakpoint:change' @@ -251,10 +250,6 @@ $ -> if $gutterIcon.hasClass('fa-angle-double-right') $sidebarGutterToggle.trigger('click') - $navIcon = $navIconToggle.find('.fa') - if $navIcon.hasClass('fa-angle-left') - $navIconToggle.trigger('click') - fitSidebarForSize = -> oldBootstrapBreakpoint = bootstrapBreakpoint bootstrapBreakpoint = bp.getBreakpointSize() @@ -263,7 +258,7 @@ $ -> checkInitialSidebarSize = -> bootstrapBreakpoint = bp.getBreakpointSize() - if bootstrapBreakpoint is "xs" or "sm" + if bootstrapBreakpoint is "xs" $(document).trigger('breakpoint:change', [bootstrapBreakpoint]) $(window) diff --git a/app/assets/javascripts/sidebar.js.coffee b/app/assets/javascripts/sidebar.js.coffee index ea4ac52da31..2ce63c16428 100644 --- a/app/assets/javascripts/sidebar.js.coffee +++ b/app/assets/javascripts/sidebar.js.coffee @@ -4,8 +4,6 @@ expanded = 'page-sidebar-expanded' toggleSidebar = -> $('.page-with-sidebar').toggleClass("#{collapsed} #{expanded}") $('header').toggleClass("header-collapsed header-expanded") - $('.toggle-nav-collapse i').toggleClass("fa-angle-right fa-angle-left") - $.cookie("collapsed_nav", $('.page-with-sidebar').hasClass(collapsed), { path: '/' }) setTimeout ( -> niceScrollBars = $('.nicescroll').niceScroll(); @@ -17,10 +15,3 @@ $(document).on("click", '.toggle-nav-collapse, .side-nav-toggle', (e) -> toggleSidebar() ) - -$ -> - size = bp.getBreakpointSize() - - if size is "xs" or size is "sm" - if $('.page-with-sidebar').hasClass(expanded) - toggleSidebar() diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index b8d4233537b..f883ad1b8db 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -122,9 +122,18 @@ header { margin-top: -5px; } + .header-logo { + position: absolute; + left: 50%; + margin-left: -18px; + top: 7px; + } + .title { margin: 0; font-size: 19px; + max-width: 250px; + display: inline-block; line-height: $header-height; font-weight: normal; color: $gl-text-color; @@ -190,6 +199,15 @@ header { } } +.tanuki-shape { + transition: all 0.8s; + + &:hover, &.highlight { + fill: rgb(255, 255, 255); + transition: all 0.1s; + } +} + @media (max-width: $screen-xs-max) { header .container-fluid { font-size: 18px; diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index a036799e15a..8982eaa6833 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -1,6 +1,7 @@ @mixin fade($gradient-direction, $rgba, $gradient-color) { visibility: visible; opacity: 1; + z-index: 2; position: absolute; bottom: 12px; width: 43px; diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index 06a688690f8..05c87cf0d49 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -66,19 +66,8 @@ } } - -.tanuki-shape { - transition: all 0.8s; - - &:hover, &.highlight { - fill: rgb(255, 255, 255); - transition: all 0.1s; - } -} - - .nav-sidebar { - margin-top: 22 + $header-height; + margin-top: 22px; margin-bottom: 116px; transition-duration: .3s; list-style: none; @@ -217,6 +206,20 @@ } } +.gitlab-text-container { + height: 50px; + padding: 5px; + text-align: center; + + h3 { + color: white; + margin: 0; + font-size: 19px; + line-height: 41px; + font-weight: normal; + } +} + .page-sidebar-expanded { padding-left: $sidebar_width; diff --git a/app/views/layouts/_collapse_button.html.haml b/app/views/layouts/_collapse_button.html.haml index 2ed51d87ca1..61c0e71f031 100644 --- a/app/views/layouts/_collapse_button.html.haml +++ b/app/views/layouts/_collapse_button.html.haml @@ -1,4 +1 @@ -- if nav_menu_collapsed? - = link_to icon('angle-right'), '#', class: 'toggle-nav-collapse', title: "Open/Close" -- else - = link_to icon('angle-left'), '#', class: 'toggle-nav-collapse', title: "Open/Close" += link_to icon('angle-left'), '#', class: 'toggle-nav-collapse', title: "Open/Close" diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index 261038ef940..def874008f4 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -1,9 +1,8 @@ -.page-with-sidebar{ class: "#{page_sidebar_class} #{page_gutter_class}" } +.page-with-sidebar.page-sidebar-collapsed{ class: "#{page_gutter_class}" } .sidebar-wrapper.nicescroll{ class: nav_sidebar_class } = link_to root_path, class: 'gitlab-text-container-link', title: 'Dashboard', id: 'js-shortcuts-home' do - .header-logo - #logo - = brand_header_logo + .gitlab-text-container + %h3 GitLab - if defined?(sidebar) && sidebar = render "layouts/nav/#{sidebar}" diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index c33740e23fa..184dac32e5a 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -1,4 +1,4 @@ -%header.navbar.navbar-fixed-top.navbar-gitlab{ class: nav_header_class } +%header.navbar.navbar-fixed-top.navbar-gitlab.header-collapsed %div{ class: fluid_layout ? "container-fluid" : "container-fluid" } .header-content %button.side-nav-toggle{type: 'button'} @@ -50,6 +50,10 @@ %h1.title= title + .header-logo + #logo + = brand_header_logo + = yield :header_content = render 'shared/outdated_browser' From ade0a4af8b85c16f6b36bee7216a3d29c4b4be0c Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Thu, 9 Jun 2016 17:23:27 -0500 Subject: [PATCH 53/87] Fix logo at all screen widths, update sidebar text --- app/assets/javascripts/application.js.coffee | 3 +- .../stylesheets/framework/gitlab-theme.scss | 3 +- app/assets/stylesheets/framework/header.scss | 39 +++++++---- app/assets/stylesheets/framework/nav.scss | 19 ++++++ app/assets/stylesheets/framework/sidebar.scss | 64 ++++++++----------- .../stylesheets/framework/variables.scss | 2 +- app/views/layouts/_page.html.haml | 4 +- 7 files changed, 78 insertions(+), 56 deletions(-) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 35b7d4a044a..03bb7fc1f7b 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -207,6 +207,7 @@ $ -> $('.navbar-toggle').on 'click', -> $('.header-content .title').toggle() + $('.header-content .header-logo').toggle() $('.header-content .navbar-collapse').toggle() $('.navbar-toggle').toggleClass('active') $('.navbar-toggle i').toggleClass("fa-angle-right fa-angle-left") @@ -258,7 +259,7 @@ $ -> checkInitialSidebarSize = -> bootstrapBreakpoint = bp.getBreakpointSize() - if bootstrapBreakpoint is "xs" + if bootstrapBreakpoint is "xs" or "sm" $(document).trigger('breakpoint:change', [bootstrapBreakpoint]) $(window) diff --git a/app/assets/stylesheets/framework/gitlab-theme.scss b/app/assets/stylesheets/framework/gitlab-theme.scss index 2540ff497f2..bec0e514963 100644 --- a/app/assets/stylesheets/framework/gitlab-theme.scss +++ b/app/assets/stylesheets/framework/gitlab-theme.scss @@ -8,7 +8,7 @@ */ @mixin gitlab-theme($color-light, $color, $color-darker, $color-dark) { .page-with-sidebar { - .header-logo { + .gitlab-text-container { background: $color-darker; a { @@ -23,6 +23,7 @@ background-color: $color-dark; a { color: $white-light; + text-decoration: none; h3 { color: $white-light; diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index f883ad1b8db..7897e544af5 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -109,15 +109,17 @@ header { position: relative; height: $header-height; padding-right: 40px; - - @media (max-width: $screen-xs-min) { - padding-left: 40px; - } + padding-left: 30px; + transition-duration: .3s; @media (min-width: $screen-sm-min) { padding-right: 0; } + @media (max-width: $screen-sm-max) { + padding-right: 30px; + } + .dropdown-menu { margin-top: -5px; } @@ -127,6 +129,13 @@ header { left: 50%; margin-left: -18px; top: 7px; + transition-duration: .3s; + z-index: 999; + + @media (max-width: $screen-sm-min) { + right: 25px; + left: auto; + } } .title { @@ -142,6 +151,10 @@ header { vertical-align: top; white-space: nowrap; + @media (max-width: $screen-sm-min) { + max-width: 220px; + } + a { color: $gl-text-color; &:hover { @@ -169,6 +182,10 @@ header { .navbar-collapse { float: right; border-top: none; + + @media (max-width: $screen-sm-min) { + float: none; + } } } @@ -185,17 +202,11 @@ header { margin-left: 0; .header-content { - padding-left: 30px; - transition-duration: .3s; - } -} -.header-expanded { - margin-left: 0; - - .header-content { - margin-left: $sidebar_width; - transition-duration: .3s; + @media (min-width: $screen-sm-max) { + padding-left: 30px; + transition-duration: .3s; + } } } diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index 8982eaa6833..75f44d81614 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -350,6 +350,8 @@ } .nav-control { + padding-left: 0; + transition-duration: .3s; .fade-right { @media (min-width: $screen-xs-max) { @@ -362,6 +364,23 @@ } } +.page-sidebar-collapsed { + + .nav-control { + @media (min-width: $screen-md-min) { + padding-left: 32px; + transition-duration: .3s; + } + } + + .layout-nav { + + @media (max-width: $screen-sm-min) { + padding-left: 0; + } + } +} + .scrolling-tabs-container { position: relative; diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index 05c87cf0d49..e461550984a 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -35,9 +35,9 @@ } .sidebar-wrapper { - .header-logo { + .gitlab-text-container { height: $header-height; - padding: 8px 26px; + padding: 0 19px; width: $sidebar_width; position: fixed; z-index: 999; @@ -47,6 +47,13 @@ &:hover { background-color: #eee; } + + h3 { + font-size: 19px; + line-height: 50px; + font-weight: normal; + margin: 0; + } } .sidebar-user { @@ -66,8 +73,19 @@ } } + +.tanuki-shape { + transition: all 0.8s; + + &:hover, &.highlight { + fill: rgb(255, 255, 255); + transition: all 0.1s; + } +} + + .nav-sidebar { - margin-top: 22px; + margin-top: 22 + $header-height; margin-bottom: 116px; transition-duration: .3s; list-style: none; @@ -159,23 +177,15 @@ .sidebar-wrapper { width: 0; - .header-logo { + .gitlab-text-container { width: 0; - padding: 8px 0; + padding: 0; - a { - padding-left: ($sidebar_collapsed_width - 36) / 2; - - .gitlab-text-container { - display: none; - } + h3 { + display: none; } } - #logo { - display: none; - } - .nav-sidebar { width: $sidebar_collapsed_width; @@ -206,24 +216,10 @@ } } -.gitlab-text-container { - height: 50px; - padding: 5px; - text-align: center; - - h3 { - color: white; - margin: 0; - font-size: 19px; - line-height: 41px; - font-weight: normal; - } -} - .page-sidebar-expanded { padding-left: $sidebar_width; - @media (max-width: $screen-xs-min) { + @media (max-width: $screen-sm-max) { padding-left: 0; } @@ -246,13 +242,7 @@ } .layout-nav { - @media (max-width: $screen-xs-min) { - padding-right: 0; - } - - @media (min-width: $screen-xs-min) and (max-width: $screen-md-min) { - padding-right: 90px; - } + padding-right: 0; @media (min-width: $screen-md-min) { padding-right: $sidebar_width; diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 847b2f80bdf..6f724afa9df 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -1,7 +1,7 @@ /* * Layout */ -$sidebar_collapsed_width: 62px; +$sidebar_collapsed_width: 0; $sidebar_width: 90px; $gutter_collapsed_width: 62px; $gutter_width: 290px; diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index def874008f4..6030613c8cf 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -1,7 +1,7 @@ .page-with-sidebar.page-sidebar-collapsed{ class: "#{page_gutter_class}" } .sidebar-wrapper.nicescroll{ class: nav_sidebar_class } - = link_to root_path, class: 'gitlab-text-container-link', title: 'Dashboard', id: 'js-shortcuts-home' do - .gitlab-text-container + .gitlab-text-container + = link_to root_path, class: 'gitlab-text-container-link', title: 'Dashboard', id: 'js-shortcuts-home' do %h3 GitLab - if defined?(sidebar) && sidebar From 5957fdc493af72579571368d584145acf10861a1 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Thu, 9 Jun 2016 21:35:25 -0500 Subject: [PATCH 54/87] Fix profile test --- app/assets/stylesheets/framework/variables.scss | 2 +- features/steps/profile/profile.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 6f724afa9df..847b2f80bdf 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -1,7 +1,7 @@ /* * Layout */ -$sidebar_collapsed_width: 0; +$sidebar_collapsed_width: 62px; $sidebar_width: 90px; $gutter_collapsed_width: 62px; $gutter_width: 290px; diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index b1a87b96efd..9e5602dacf1 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -155,6 +155,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps end step 'I click on my profile picture' do + find(:css, '.side-nav-toggle').click find(:css, '.sidebar-user').click end From 9662a5e3df59216d7a3cc18b16bbf467b2233ece Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Thu, 9 Jun 2016 22:39:54 -0500 Subject: [PATCH 55/87] Update media queries --- app/assets/stylesheets/framework/header.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 7897e544af5..7ccd25bc1ba 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -132,7 +132,7 @@ header { transition-duration: .3s; z-index: 999; - @media (max-width: $screen-sm-min) { + @media (max-width: $screen-xs-max) { right: 25px; left: auto; } @@ -151,7 +151,7 @@ header { vertical-align: top; white-space: nowrap; - @media (max-width: $screen-sm-min) { + @media (max-width: $screen-xs-max) { max-width: 220px; } @@ -183,7 +183,7 @@ header { float: right; border-top: none; - @media (max-width: $screen-sm-min) { + @media (max-width: $screen-xs-max) { float: none; } } From cb126995aa57cc9e169f875fbd4f9b5b82575a27 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Fri, 10 Jun 2016 10:41:00 -0500 Subject: [PATCH 56/87] Revert side nav to full width; remove border under nav; remove tooltips on nav links; stop page content shifting with side nav; put project nav in container --- app/assets/javascripts/application.js.coffee | 6 -- .../stylesheets/framework/gitlab-theme.scss | 23 -------- app/assets/stylesheets/framework/header.scss | 11 ++-- app/assets/stylesheets/framework/nav.scss | 21 +------ app/assets/stylesheets/framework/sidebar.scss | 55 +++---------------- .../stylesheets/framework/variables.scss | 2 +- app/views/layouts/_collapse_button.html.haml | 2 +- app/views/layouts/_page.html.haml | 5 +- app/views/layouts/ci/_page.html.haml | 6 -- app/views/layouts/nav/_admin.html.haml | 38 ++++++------- app/views/layouts/nav/_dashboard.html.haml | 20 +++---- app/views/layouts/nav/_explore.html.haml | 8 +-- 12 files changed, 52 insertions(+), 145 deletions(-) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 03bb7fc1f7b..e5531c02836 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -169,12 +169,6 @@ $ -> container: 'body' ) - $('.page-with-sidebar').tooltip( - selector: '.sidebar-collapsed .nav-sidebar a, .sidebar-collapsed a.sidebar-user' - placement: 'right' - container: 'body' - ) - # Form submitter $('.trigger-submit').on 'change', -> $(@).parents('form').submit() diff --git a/app/assets/stylesheets/framework/gitlab-theme.scss b/app/assets/stylesheets/framework/gitlab-theme.scss index bec0e514963..245e8b285e9 100644 --- a/app/assets/stylesheets/framework/gitlab-theme.scss +++ b/app/assets/stylesheets/framework/gitlab-theme.scss @@ -8,29 +8,6 @@ */ @mixin gitlab-theme($color-light, $color, $color-darker, $color-dark) { .page-with-sidebar { - .gitlab-text-container { - background: $color-darker; - - a { - color: $color-light; - - h3 { - color: $color-light; - } - } - - &:hover { - background-color: $color-dark; - a { - color: $white-light; - text-decoration: none; - - h3 { - color: $white-light; - } - } - } - } .collapse-nav a { color: $white-light; diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 7ccd25bc1ba..824f5cd21b4 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -28,7 +28,6 @@ header { height: $header-height; background-color: $background-color; border: none; - border-bottom: 1px solid $border-color; @media (max-width: $screen-xs-min) { padding: 0 16px; @@ -132,6 +131,10 @@ header { transition-duration: .3s; z-index: 999; + &:hover { + cursor: pointer; + } + @media (max-width: $screen-xs-max) { right: 25px; left: auto; @@ -141,7 +144,7 @@ header { .title { margin: 0; font-size: 19px; - max-width: 250px; + max-width: 400px; display: inline-block; line-height: $header-height; font-weight: normal; @@ -151,8 +154,8 @@ header { vertical-align: top; white-space: nowrap; - @media (max-width: $screen-xs-max) { - max-width: 220px; + @media (max-width: $screen-sm-max) { + max-width: 190px; } a { diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index 75f44d81614..793d4e0479f 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -350,12 +350,10 @@ } .nav-control { - padding-left: 0; - transition-duration: .3s; .fade-right { @media (min-width: $screen-xs-max) { - right: 67px; + right: 68px; } @media (max-width: $screen-xs-min) { right: 0; @@ -364,23 +362,6 @@ } } -.page-sidebar-collapsed { - - .nav-control { - @media (min-width: $screen-md-min) { - padding-left: 32px; - transition-duration: .3s; - } - } - - .layout-nav { - - @media (max-width: $screen-sm-min) { - padding-left: 0; - } - } -} - .scrolling-tabs-container { position: relative; diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index e461550984a..a96ce022309 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -35,31 +35,11 @@ } .sidebar-wrapper { - .gitlab-text-container { - height: $header-height; - padding: 0 19px; - width: $sidebar_width; - position: fixed; - z-index: 999; - overflow: hidden; - transition-duration: .3s; - - &:hover { - background-color: #eee; - } - - h3 { - font-size: 19px; - line-height: 50px; - font-weight: normal; - margin: 0; - } - } .sidebar-user { padding: 15px 22px; position: fixed; - bottom: 40px; + bottom: 0; width: $sidebar_width; overflow: hidden; transition-duration: .3s; @@ -104,10 +84,10 @@ } a { - text-align: center; - padding: 8px; + width: $sidebar_width; + padding: 7px 15px 7px 23px; font-size: $gl-font-size; - color: $gray; + line-height: 24px; display: block; text-decoration: none; font-weight: normal; @@ -125,10 +105,9 @@ font-size: 16px; } - .nav-link-text { - margin-top: 3px; - font-size: 13px; - line-height: 18px; + i, + svg { + margin-right: 13px; } &.back-link i { @@ -150,7 +129,7 @@ .collapse-nav a { width: $sidebar_width; position: fixed; - bottom: 0; + top: 0; left: 0; font-size: 13px; background: transparent; @@ -177,15 +156,6 @@ .sidebar-wrapper { width: 0; - .gitlab-text-container { - width: 0; - padding: 0; - - h3 { - display: none; - } - } - .nav-sidebar { width: $sidebar_collapsed_width; @@ -217,7 +187,6 @@ } .page-sidebar-expanded { - padding-left: $sidebar_width; @media (max-width: $screen-sm-max) { padding-left: 0; @@ -240,14 +209,6 @@ } } } - - .layout-nav { - padding-right: 0; - - @media (min-width: $screen-md-min) { - padding-right: $sidebar_width; - } - } } .right-sidebar-collapsed { diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 847b2f80bdf..752d8ec8788 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -2,7 +2,7 @@ * Layout */ $sidebar_collapsed_width: 62px; -$sidebar_width: 90px; +$sidebar_width: 220px; $gutter_collapsed_width: 62px; $gutter_width: 290px; $gutter_inner_width: 258px; diff --git a/app/views/layouts/_collapse_button.html.haml b/app/views/layouts/_collapse_button.html.haml index 61c0e71f031..e4fab897377 100644 --- a/app/views/layouts/_collapse_button.html.haml +++ b/app/views/layouts/_collapse_button.html.haml @@ -1 +1 @@ -= link_to icon('angle-left'), '#', class: 'toggle-nav-collapse', title: "Open/Close" += link_to icon('bars'), '#', class: 'toggle-nav-collapse', title: "Open/Close" diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index 6030613c8cf..c08aec959fc 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -1,8 +1,5 @@ .page-with-sidebar.page-sidebar-collapsed{ class: "#{page_gutter_class}" } .sidebar-wrapper.nicescroll{ class: nav_sidebar_class } - .gitlab-text-container - = link_to root_path, class: 'gitlab-text-container-link', title: 'Dashboard', id: 'js-shortcuts-home' do - %h3 GitLab - if defined?(sidebar) && sidebar = render "layouts/nav/#{sidebar}" @@ -18,7 +15,7 @@ = image_tag avatar_icon(current_user, 60), alt: 'Profile', class: 'avatar avatar s46' - if defined?(nav) && nav .layout-nav - .container-fluid + %div{ class: (container_class) } = render "layouts/nav/#{nav}" .content-wrapper{ class: "#{layout_nav_class}" } = render "layouts/broadcast" diff --git a/app/views/layouts/ci/_page.html.haml b/app/views/layouts/ci/_page.html.haml index a13241bebee..2e56d0ac6a3 100644 --- a/app/views/layouts/ci/_page.html.haml +++ b/app/views/layouts/ci/_page.html.haml @@ -1,12 +1,6 @@ .page-with-sidebar{ class: page_sidebar_class } = render "layouts/broadcast" .sidebar-wrapper.nicescroll{ class: nav_sidebar_class } - .header-logo - %a#logo - = brand_header_logo - = link_to root_path, class: 'gitlab-text-container-link', title: 'Dashboard', id: 'js-shortcuts-home' do - .gitlab-text-container - %h3 GitLab - if defined?(sidebar) && sidebar = render "layouts/ci/#{sidebar}" diff --git a/app/views/layouts/nav/_admin.html.haml b/app/views/layouts/nav/_admin.html.haml index de2276e75e4..40c47487fa8 100644 --- a/app/views/layouts/nav/_admin.html.haml +++ b/app/views/layouts/nav/_admin.html.haml @@ -2,102 +2,102 @@ = nav_link(controller: :dashboard, html_options: {class: 'home'}) do = link_to admin_root_path, title: 'Overview' do = icon('dashboard fw') - .nav-link-text + %span Overview = nav_link(controller: [:admin, :projects]) do = link_to admin_namespaces_projects_path, title: 'Projects' do = icon('cube fw') - .nav-link-text + %span Projects = nav_link(controller: :users) do = link_to admin_users_path, title: 'Users' do = icon('user fw') - .nav-link-text + %span Users = nav_link(controller: :groups) do = link_to admin_groups_path, title: 'Groups' do = icon('group fw') - .nav-link-text + %span Groups = nav_link(controller: :deploy_keys) do = link_to admin_deploy_keys_path, title: 'Deploy Keys' do = icon('key fw') - .nav-link-text + %span Deploy Keys = nav_link path: ['runners#index', 'runners#show'] do = link_to admin_runners_path, title: 'Runners' do = icon('cog fw') - .nav-link-text + %span Runners = nav_link path: 'builds#index' do = link_to admin_builds_path, title: 'Builds' do = icon('link fw') - .nav-link-text + %span Builds = nav_link(controller: :logs) do = link_to admin_logs_path, title: 'Logs' do = icon('file-text fw') - .nav-link-text + %span Logs = nav_link(controller: :health_check) do = link_to admin_health_check_path, title: 'Health Check' do = icon('medkit fw') - .nav-link-text + %span Health Check = nav_link(controller: :broadcast_messages) do = link_to admin_broadcast_messages_path, title: 'Messages' do = icon('bullhorn fw') - .nav-link-text + %span Messages = nav_link(controller: :hooks) do = link_to admin_hooks_path, title: 'Hooks' do = icon('external-link fw') - .nav-link-text + %span Hooks = nav_link(controller: :background_jobs) do = link_to admin_background_jobs_path, title: 'Background Jobs' do = icon('cog fw') - .nav-link-text + %span Background Jobs = nav_link(controller: :appearances) do = link_to admin_appearances_path, title: 'Appearances' do = icon('image') - .nav-link-text + %span Appearance = nav_link(controller: :applications) do = link_to admin_applications_path, title: 'Applications' do = icon('cloud fw') - .nav-link-text + %span Applications = nav_link(controller: :services) do = link_to admin_application_settings_services_path, title: 'Service Templates' do = icon('copy fw') - .nav-link-text + %span Service Templates = nav_link(controller: :labels) do = link_to admin_labels_path, title: 'Labels' do = icon('tags fw') - .nav-link-text + %span Labels = nav_link(controller: :abuse_reports) do = link_to admin_abuse_reports_path, title: "Abuse Reports" do = icon('exclamation-circle fw') - .nav-link-text + %span Abuse Reports - if askimet_enabled? = nav_link(controller: :spam_logs) do = link_to admin_spam_logs_path, title: "Spam Logs" do = icon('exclamation-triangle fw') - .nav-link-text + %span Spam Logs = nav_link(controller: :application_settings, html_options: { class: 'separate-item'}) do = link_to admin_application_settings_path, title: 'Settings' do = icon('cogs fw') - .nav-link-text + %span Settings diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index b73fde7797f..5dc85ef0d96 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -2,50 +2,50 @@ = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: {class: "#{project_tab_class} home"}) do = link_to dashboard_projects_path, title: 'Projects', class: 'dashboard-shortcuts-projects' do = navbar_icon('project') - .nav-link-text + %span Projects = nav_link(controller: :todos) do = link_to dashboard_todos_path, title: 'Todos' do = icon('bell fw') - .nav-link-text + %span Todos = nav_link(path: 'dashboard#activity') do = link_to activity_dashboard_path, class: 'dashboard-shortcuts-activity', title: 'Activity' do = navbar_icon('activity') - .nav-link-text + %span Activity = nav_link(controller: [:groups, 'groups/milestones', 'groups/group_members']) do = link_to dashboard_groups_path, title: 'Groups' do = navbar_icon('group') - .nav-link-text + %span Groups = nav_link(controller: 'dashboard/milestones') do = link_to dashboard_milestones_path, title: 'Milestones' do = navbar_icon('milestones') - .nav-link-text + %span Milestones = nav_link(path: 'dashboard#issues') do = link_to assigned_issues_dashboard_path, title: 'Issues', class: 'dashboard-shortcuts-issues' do = navbar_icon('issues') - .nav-link-text + %span Issues = nav_link(path: 'dashboard#merge_requests') do = link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'dashboard-shortcuts-merge_requests' do = navbar_icon('mr') - .nav-link-text + %span Merge Requests = nav_link(controller: :snippets) do = link_to dashboard_snippets_path, title: 'Snippets' do = icon('clipboard fw') - .nav-link-text + %span Snippets = nav_link(controller: :help) do = link_to help_path, title: 'Help' do = icon('question-circle fw') - .nav-link-text + %span Help = nav_link(html_options: {class: profile_tab_class}) do = link_to profile_path, title: 'Profile Settings', data: {placement: 'bottom'} do = icon('user fw') - .nav-link-text + %span Profile Settings diff --git a/app/views/layouts/nav/_explore.html.haml b/app/views/layouts/nav/_explore.html.haml index 46fcf1545f2..3b40006a0cc 100644 --- a/app/views/layouts/nav/_explore.html.haml +++ b/app/views/layouts/nav/_explore.html.haml @@ -2,20 +2,20 @@ = nav_link(path: ['dashboard#show', 'root#show', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do = link_to explore_root_path, title: 'Projects' do = icon('bookmark fw') - .nav-link-text + %span Projects = nav_link(controller: [:groups, 'groups/milestones', 'groups/group_members']) do = link_to explore_groups_path, title: 'Groups' do = icon('group fw') - .nav-link-text + %span Groups = nav_link(controller: :snippets) do = link_to explore_snippets_path, title: 'Snippets' do = icon('clipboard fw') - .nav-link-text + %span Snippets = nav_link(controller: :help) do = link_to help_path, title: 'Help' do = icon('question-circle fw') - .nav-link-text + %span Help From 67a18f34e93ce8aa990794558371096f8f3a4e4c Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Fri, 10 Jun 2016 12:01:16 -0500 Subject: [PATCH 57/87] Fix safari logo loading animation safari bug --- app/assets/javascripts/application.js.coffee | 7 ------- app/assets/javascripts/logo.js.coffee | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index e5531c02836..69d4c4f5dd3 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -162,13 +162,6 @@ $ -> $el.data('placement') || 'bottom' ) - $('.header-logo .home').tooltip( - placement: (_, el) -> - $el = $(el) - if $('.page-with-sidebar').hasClass('page-sidebar-collapsed') then 'right' else 'bottom' - container: 'body' - ) - # Form submitter $('.trigger-submit').on 'change', -> $(@).parents('form').submit() diff --git a/app/assets/javascripts/logo.js.coffee b/app/assets/javascripts/logo.js.coffee index d14b7139237..9fdc27a9787 100644 --- a/app/assets/javascripts/logo.js.coffee +++ b/app/assets/javascripts/logo.js.coffee @@ -47,4 +47,4 @@ $ -> # Make logo clickable as part of a workaround for Safari visited # link behaviour (See !2690). $('#logo').on 'click', -> - $('#js-shortcuts-home').get(0).click() + Turbolinks.visit('/') From f03df228155ae2d8dd779bd1a8e4078698b23c06 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 8 Jun 2016 18:04:31 -0700 Subject: [PATCH 58/87] Only create the backup directory if it is local Closes #12710 --- lib/backup/manager.rb | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index 9dd665441a0..2ff3e3bdfb0 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -38,7 +38,6 @@ module Backup end def upload(tar_file) - remote_directory = Gitlab.config.backup.upload.remote_directory $progress.print "Uploading backup archive to remote storage #{remote_directory} ... " connection_settings = Gitlab.config.backup.upload.connection @@ -47,8 +46,7 @@ module Backup return end - connection = ::Fog::Storage.new(connection_settings) - directory = connection.directories.create(key: remote_directory) + directory = connect_to_remote_directory(connection_settings) if directory.files.create(key: tar_file, body: File.open(tar_file), public: false, multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size, @@ -155,6 +153,23 @@ module Backup private + def connect_to_remote_directory(connection_settings) + connection = ::Fog::Storage.new(connection_settings) + + # We only attempt to create the directory for local backups. For AWS + # and other cloud providers, we cannot guarantee the user will have + # permission to create the bucket. + if connection.service == ::Fog::Storage::Local + connection.directories.create(key: remote_directory) + else + connection.directories.get(remote_directory) + end + end + + def remote_directory + Gitlab.config.backup.upload.remote_directory + end + def backup_contents folders_to_backup + archives_to_backup + ["backup_information.yml"] end From 630aeb31eb7728789d1f7659ec0e12ea5a5fd59c Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Fri, 10 Jun 2016 12:27:05 -0500 Subject: [PATCH 59/87] Add back sidebar counters and username --- .../stylesheets/framework/gitlab-theme.scss | 6 +++++- app/assets/stylesheets/framework/header.scss | 1 + app/assets/stylesheets/framework/nav.scss | 1 - app/assets/stylesheets/framework/sidebar.scss | 17 ++++++++++++++--- app/helpers/nav_helper.rb | 8 +------- app/views/layouts/_page.html.haml | 6 ++++-- app/views/layouts/header/_default.html.haml | 2 +- app/views/layouts/nav/_admin.html.haml | 4 ++++ app/views/layouts/nav/_dashboard.html.haml | 3 +++ 9 files changed, 33 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/framework/gitlab-theme.scss b/app/assets/stylesheets/framework/gitlab-theme.scss index 245e8b285e9..408d4a68e1e 100644 --- a/app/assets/stylesheets/framework/gitlab-theme.scss +++ b/app/assets/stylesheets/framework/gitlab-theme.scss @@ -10,8 +10,12 @@ .page-with-sidebar { .collapse-nav a { - color: $white-light; + color: $color-light; background: $color; + + &:hover { + color: $white-light; + } } .sidebar-wrapper { diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 824f5cd21b4..c07b2753f4d 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -28,6 +28,7 @@ header { height: $header-height; background-color: $background-color; border: none; + border-bottom: 1px solid $border-color; @media (max-width: $screen-xs-min) { padding: 0 16px; diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index 793d4e0479f..ffdd8e7e0d4 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -172,7 +172,6 @@ > form { display: inline-block; margin-top: -1px; - margin-bottom: 12px; } .icon-label { diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index a96ce022309..b7ec3f70bfb 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -115,6 +115,12 @@ } } } + + .count { + float: right; + padding: 0 8px; + @include border-radius(6px); + } } .sidebar-subnav { @@ -131,9 +137,10 @@ position: fixed; top: 0; left: 0; - font-size: 13px; + padding: 5px 0; + font-size: 18px; background: transparent; - height: 40px; + height: 50px; text-align: center; line-height: 40px; transition-duration: .3s; @@ -157,7 +164,7 @@ width: 0; .nav-sidebar { - width: $sidebar_collapsed_width; + width: 0; li { width: auto; @@ -172,6 +179,10 @@ .collapse-nav a { width: 0; + + i { + display: none; + } } .sidebar-user { diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb index 39831ce2e48..469accf3142 100644 --- a/app/helpers/nav_helper.rb +++ b/app/helpers/nav_helper.rb @@ -36,13 +36,7 @@ module NavHelper end def nav_header_class - class_name = - if nav_menu_collapsed? - "header-collapsed" - else - "header-expanded" - end - class_name += " with-horizontal-nav" if defined?(nav) && nav + class_name = " with-horizontal-nav" if defined?(nav) && nav class_name end diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index c08aec959fc..1a721b0c296 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -11,8 +11,10 @@ .collapse-nav = render partial: 'layouts/collapse_button' - if current_user - = link_to current_user, class: 'sidebar-user', title: "Profile", data: {user: current_user.username} do - = image_tag avatar_icon(current_user, 60), alt: 'Profile', class: 'avatar avatar s46' + = link_to current_user, class: 'sidebar-user', title: "Profile" do + = image_tag avatar_icon(current_user, 60), alt: 'Profile', class: 'avatar avatar s36' + .username + = current_user.username - if defined?(nav) && nav .layout-nav %div{ class: (container_class) } diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index 184dac32e5a..ad30a367fc5 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -1,4 +1,4 @@ -%header.navbar.navbar-fixed-top.navbar-gitlab.header-collapsed +%header.navbar.navbar-fixed-top.navbar-gitlab.header-collapsed{ class: nav_header_class } %div{ class: fluid_layout ? "container-fluid" : "container-fluid" } .header-content %button.side-nav-toggle{type: 'button'} diff --git a/app/views/layouts/nav/_admin.html.haml b/app/views/layouts/nav/_admin.html.haml index 40c47487fa8..f292730fe45 100644 --- a/app/views/layouts/nav/_admin.html.haml +++ b/app/views/layouts/nav/_admin.html.haml @@ -29,11 +29,13 @@ = icon('cog fw') %span Runners + %span.count= number_with_delimiter(Ci::Runner.count(:all)) = nav_link path: 'builds#index' do = link_to admin_builds_path, title: 'Builds' do = icon('link fw') %span Builds + %span.count= number_with_delimiter(Ci::Build.count(:all)) = nav_link(controller: :logs) do = link_to admin_logs_path, title: 'Logs' do = icon('file-text fw') @@ -88,6 +90,7 @@ = icon('exclamation-circle fw') %span Abuse Reports + %span.count= number_with_delimiter(AbuseReport.count(:all)) - if askimet_enabled? = nav_link(controller: :spam_logs) do @@ -95,6 +98,7 @@ = icon('exclamation-triangle fw') %span Spam Logs + %span.count= number_with_delimiter(SpamLog.count(:all)) = nav_link(controller: :application_settings, html_options: { class: 'separate-item'}) do = link_to admin_application_settings_path, title: 'Settings' do diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index 5dc85ef0d96..18cae5bf87f 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -9,6 +9,7 @@ = icon('bell fw') %span Todos + %span.count= number_with_delimiter(todos_pending_count) = nav_link(path: 'dashboard#activity') do = link_to activity_dashboard_path, class: 'dashboard-shortcuts-activity', title: 'Activity' do = navbar_icon('activity') @@ -29,11 +30,13 @@ = navbar_icon('issues') %span Issues + %span.count= number_with_delimiter(current_user.assigned_issues.opened.count) = nav_link(path: 'dashboard#merge_requests') do = link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'dashboard-shortcuts-merge_requests' do = navbar_icon('mr') %span Merge Requests + %span.count= number_with_delimiter(current_user.assigned_merge_requests.opened.count) = nav_link(controller: :snippets) do = link_to dashboard_snippets_path, title: 'Snippets' do = icon('clipboard fw') From 3714e1914b6b891274ab7d8b8db8f21dedd29e37 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Fri, 10 Jun 2016 21:25:48 +0200 Subject: [PATCH 60/87] Improve after review --- doc/ci/yaml/README.md | 2 +- lib/ci/gitlab_ci_yaml_processor.rb | 4 ++-- spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 39fad549a04..0707555e393 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -670,7 +670,7 @@ failure. **Example configurations** -To upload artifacts only when build fails +To upload artifacts only when build fails. ```yaml job: diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index 15d57a46eb0..40a5d180fd0 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -208,7 +208,7 @@ module Ci raise ValidationError, "#{name} job: allow_failure parameter should be an boolean" end - if job[:when] && !job[:when].in?(%w(on_success on_failure always)) + if job[:when] && !job[:when].in?(%w[on_success on_failure always]) raise ValidationError, "#{name} job: when parameter should be on_success, on_failure or always" end end @@ -279,7 +279,7 @@ module Ci raise ValidationError, "#{name} job: artifacts:paths parameter should be an array of strings" end - if job[:artifacts][:when] && !job[:artifacts][:when].in?(%w(on_success on_failure always)) + if job[:artifacts][:when] && !job[:artifacts][:when].in?(%w[on_success on_failure always]) raise ValidationError, "#{name} job: artifacts:when parameter should be on_success, on_failure or always" end end diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index 3d3715f0ef0..fe1e8b2262e 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -602,7 +602,7 @@ module Ci }) end - %w(on_success on_failure always).each do |when_state| + %w[on_success on_failure always].each do |when_state| it "returns artifacts for when #{when_state} defined" do config = YAML.dump({ rspec: { @@ -612,6 +612,7 @@ module Ci }) config_processor = GitlabCiYamlProcessor.new(config, path) + builds = config_processor.builds_for_stage_and_ref("test", "master") expect(builds.size).to eq(1) expect(builds.first[:options][:artifacts][:when]).to eq(when_state) From 3e28d04cced2c417ee9144a17866e0cc2c910a6c Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Fri, 10 Jun 2016 15:08:13 -0500 Subject: [PATCH 61/87] Fix preferences_spec test --- app/assets/stylesheets/framework/header.scss | 4 ---- app/views/layouts/_page.html.haml | 2 +- spec/features/profiles/preferences_spec.rb | 8 +++++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index c07b2753f4d..63996ea44f6 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -116,10 +116,6 @@ header { padding-right: 0; } - @media (max-width: $screen-sm-max) { - padding-right: 30px; - } - .dropdown-menu { margin-top: -5px; } diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index 1a721b0c296..dbf425d46c7 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -11,7 +11,7 @@ .collapse-nav = render partial: 'layouts/collapse_button' - if current_user - = link_to current_user, class: 'sidebar-user', title: "Profile" do + = link_to current_user, class: 'sidebar-user', title: "Profile", data: {user: current_user.username} do = image_tag avatar_icon(current_user, 60), alt: 'Profile', class: 'avatar avatar s36' .username = current_user.username diff --git a/spec/features/profiles/preferences_spec.rb b/spec/features/profiles/preferences_spec.rb index 8f645438cff..787bf42d048 100644 --- a/spec/features/profiles/preferences_spec.rb +++ b/spec/features/profiles/preferences_spec.rb @@ -54,7 +54,7 @@ describe 'Profile > Preferences', feature: true do end end - describe 'User changes their default dashboard' do + describe 'User changes their default dashboard', js: true do it 'creates a flash message' do select 'Starred Projects', from: 'user_dashboard' click_button 'Save' @@ -66,8 +66,10 @@ describe 'Profile > Preferences', feature: true do select 'Starred Projects', from: 'user_dashboard' click_button 'Save' - click_link 'Dashboard' - expect(page.current_path).to eq starred_dashboard_projects_path + allowing_for_delay do + find('#logo').click + expect(page.current_path).to eq starred_dashboard_projects_path + end click_link 'Your Projects' expect(page.current_path).to eq dashboard_projects_path From 952660d2cf9b2e25b2014d117cce3bf4c93d6818 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Fri, 10 Jun 2016 12:40:54 -0500 Subject: [PATCH 62/87] Fixes a bug when assigning a label to multiple issues Fixes the case when we want to assign a label to multiple issues and one of the issues has already the label we want to apply. --- .../issues-bulk-assignment.js.coffee | 17 +++++++++++++---- .../issues/bulk_assigment_labels_spec.rb | 17 +++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/issues-bulk-assignment.js.coffee b/app/assets/javascripts/issues-bulk-assignment.js.coffee index 16d023dd391..9dc3529a17f 100644 --- a/app/assets/javascripts/issues-bulk-assignment.js.coffee +++ b/app/assets/javascripts/issues-bulk-assignment.js.coffee @@ -97,13 +97,22 @@ class @IssuableBulkActions $labels = @form.find('.labels-filter input[name="update[label_ids][]"]') $labels.each (k, label) -> - labelIds.push $(label).val() if label + labelIds.push parseInt($(label).val()) if label labelIds ###* - * Just an alias of @getUnmarkedIndeterminedLabels - * @return {Array} Array of labels + * Returns Label IDs that will be removed from issue selection + * @return {Array} Array of labels IDs ### getLabelsToRemove: -> - @getUnmarkedIndeterminedLabels() + result = [] + indeterminatedLabels = @getUnmarkedIndeterminedLabels() + labelsToApply = @getLabelsToApply() + + indeterminatedLabels.map (id) -> + # We need to exclude label IDs that will be applied + # By not doing this will cause issues from selection to not add labels at all + result.push(id) if labelsToApply.indexOf(id) is -1 + + result diff --git a/spec/features/issues/bulk_assigment_labels_spec.rb b/spec/features/issues/bulk_assigment_labels_spec.rb index c58b87281a3..0fbc2062e39 100644 --- a/spec/features/issues/bulk_assigment_labels_spec.rb +++ b/spec/features/issues/bulk_assigment_labels_spec.rb @@ -83,6 +83,23 @@ feature 'Issues > Labels bulk assignment', feature: true do end end + context 'can assign a label to all issues when label is present' do + before do + issue2.labels << bug + issue2.labels << feature + visit namespace_project_issues_path(project.namespace, project) + + check 'check_all_issues' + open_labels_dropdown ['bug'] + update_issues + end + + it do + expect(find("#issue_#{issue1.id}")).to have_content 'bug' + expect(find("#issue_#{issue2.id}")).to have_content 'bug' + end + end + context 'can bulk un-assign' do context 'all labels to all issues' do before do From a46b4f11d5afbeaec4fa0caed85b395e3d9d428d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sat, 11 Jun 2016 11:30:53 +0300 Subject: [PATCH 63/87] Center layout navigation and remove icons Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/framework/nav.scss | 2 ++ app/views/layouts/_page.html.haml | 2 +- app/views/layouts/nav/_group.html.haml | 6 ------ app/views/layouts/nav/_profile.html.haml | 10 ---------- app/views/layouts/nav/_project.html.haml | 10 ---------- 5 files changed, 3 insertions(+), 27 deletions(-) diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index ffdd8e7e0d4..4de89daeb36 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -69,6 +69,7 @@ } &.sub-nav { + text-align: center; background-color: $background-color; .container-fluid { @@ -250,6 +251,7 @@ background: $background-color; border-bottom: 1px solid $border-color; transition-duration: .3s; + text-align: center; .container-fluid { position: relative; diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index dbf425d46c7..f89e8582792 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -17,7 +17,7 @@ = current_user.username - if defined?(nav) && nav .layout-nav - %div{ class: (container_class) } + .container-fluid = render "layouts/nav/#{nav}" .content-wrapper{ class: "#{layout_nav_class}" } = render "layouts/broadcast" diff --git a/app/views/layouts/nav/_group.html.haml b/app/views/layouts/nav/_group.html.haml index 9cbee0aa363..66361a644dd 100644 --- a/app/views/layouts/nav/_group.html.haml +++ b/app/views/layouts/nav/_group.html.haml @@ -5,36 +5,30 @@ .fade-left = nav_link(path: 'groups#show', html_options: {class: 'home'}) do = link_to group_path(@group), title: 'Home' do - = navbar_icon('group') %span Group = nav_link(path: 'groups#activity') do = link_to activity_group_path(@group), title: 'Activity' do - = navbar_icon('activity') %span Activity = nav_link(controller: [:group, :milestones]) do = link_to group_milestones_path(@group), title: 'Milestones' do - = navbar_icon('milestones') %span Milestones = nav_link(path: 'groups#issues') do = link_to issues_group_path(@group), title: 'Issues' do - = navbar_icon('issues') %span Issues - issues = IssuesFinder.new(current_user, group_id: @group.id, state: 'opened').execute %span.badge.count= number_with_delimiter(issues.count) = nav_link(path: 'groups#merge_requests') do = link_to merge_requests_group_path(@group), title: 'Merge Requests' do - = navbar_icon('mr') %span Merge Requests - merge_requests = MergeRequestsFinder.new(current_user, group_id: @group.id, state: 'opened').execute %span.badge.count= number_with_delimiter(merge_requests.count) = nav_link(controller: [:group_members]) do = link_to group_group_members_path(@group), title: 'Members' do - = navbar_icon('members') %span Members .fade-right diff --git a/app/views/layouts/nav/_profile.html.haml b/app/views/layouts/nav/_profile.html.haml index 09d9f0184be..d4b1f477f3f 100644 --- a/app/views/layouts/nav/_profile.html.haml +++ b/app/views/layouts/nav/_profile.html.haml @@ -2,51 +2,41 @@ .fade-left = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do = link_to profile_path, title: 'Profile Settings' do - = icon('user fw') %span Profile = nav_link(controller: [:accounts, :two_factor_auths]) do = link_to profile_account_path, title: 'Account' do - = icon('gear fw') %span Account - if current_application_settings.user_oauth_applications? = nav_link(controller: 'oauth/applications') do = link_to applications_profile_path, title: 'Applications' do - = icon('cloud fw') %span Applications = nav_link(controller: :emails) do = link_to profile_emails_path, title: 'Emails' do - = icon('envelope-o fw') %span Emails - unless current_user.ldap_user? = nav_link(controller: :passwords) do = link_to edit_profile_password_path, title: 'Password' do - = icon('lock fw') %span Password = nav_link(controller: :notifications) do = link_to profile_notifications_path, title: 'Notifications' do - = icon('inbox fw') %span Notifications = nav_link(controller: :keys) do = link_to profile_keys_path, title: 'SSH Keys' do - = icon('key fw') %span SSH Keys = nav_link(controller: :preferences) do = link_to profile_preferences_path, title: 'Preferences' do - -# TODO (rspeicher): Better icon? - = icon('image fw') %span Preferences = nav_link(path: 'profiles#audit_log') do = link_to audit_log_profile_path, title: 'Audit Log' do - = icon('history fw') %span Audit Log .fade-right diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml index 79cc5c02888..53d1fcc30a6 100644 --- a/app/views/layouts/nav/_project.html.haml +++ b/app/views/layouts/nav/_project.html.haml @@ -24,48 +24,41 @@ .fade-left = nav_link(path: 'projects#show', html_options: {class: 'home'}) do = link_to project_path(@project), title: 'Project', class: 'shortcuts-project' do - = navbar_icon('project') %span Project = nav_link(path: 'projects#activity') do = link_to activity_project_path(@project), title: 'Activity', class: 'shortcuts-project-activity' do - = navbar_icon('activity') %span Activity - if project_nav_tab? :files = nav_link(controller: %w(tree blob blame edit_tree new_tree find_file commit commits compare repositories tags branches releases network)) do = link_to project_files_path(@project), title: 'Code', class: 'shortcuts-tree' do - = icon('code fw') %span Code - if project_nav_tab? :pipelines = nav_link(controller: :pipelines) do = link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do - = navbar_icon('pipelines') %span Pipelines - if project_nav_tab? :container_registry = nav_link(controller: %w(container_registry)) do = link_to project_container_registry_path(@project), title: 'Container Registry', class: 'shortcuts-container-registry' do - = icon('hdd-o fw') %span Registry - if project_nav_tab? :graphs = nav_link(controller: %w(graphs)) do = link_to namespace_project_graph_path(@project.namespace, @project, current_ref), title: 'Graphs', class: 'shortcuts-graphs' do - = icon('area-chart fw') %span Graphs - if project_nav_tab? :issues = nav_link(controller: [:issues, :labels, :milestones]) do = link_to url_for_project_issues(@project, only_path: true), title: 'Issues', class: 'shortcuts-issues' do - = navbar_icon('issues') %span Issues - if @project.default_issues_tracker? @@ -74,7 +67,6 @@ - if project_nav_tab? :merge_requests = nav_link(controller: :merge_requests) do = link_to namespace_project_merge_requests_path(@project.namespace, @project), title: 'Merge Requests', class: 'shortcuts-merge_requests' do - = navbar_icon('mr') %span Merge Requests %span.badge.count.merge_counter= number_with_delimiter(@project.merge_requests.opened.count) @@ -82,14 +74,12 @@ - if project_nav_tab? :wiki = nav_link(controller: :wikis) do = link_to get_project_wiki_path(@project), title: 'Wiki', class: 'shortcuts-wiki' do - = navbar_icon('wiki') %span Wiki - if project_nav_tab? :snippets = nav_link(controller: :snippets) do = link_to namespace_project_snippets_path(@project.namespace, @project), title: 'Snippets', class: 'shortcuts-snippets' do - = icon('clipboard fw') %span Snippets From a85dde9182f177cc2fdabd90ccdad870bf4d84c3 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 11 Jun 2016 07:16:32 -0700 Subject: [PATCH 64/87] Fix Error 500 when using closes_issues API with an external issue tracker Closes #18484 --- CHANGELOG | 1 + doc/api/merge_requests.md | 13 ++++++++++++- lib/api/entities.rb | 5 +++++ lib/api/helpers.rb | 8 ++++++++ lib/api/merge_requests.rb | 2 +- spec/requests/api/merge_requests_spec.rb | 15 +++++++++++++++ 6 files changed, 42 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 8f897b4a34c..99dd1d3ff4a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 8.9.0 (unreleased) + - Fix Error 500 when using closes_issues API with an external issue tracker - Bulk assign/unassign labels to issues. - Ability to prioritize labels !4009 / !3205 (Thijs Wouters) - Fix endless redirections when accessing user OAuth applications when they are disabled diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 16b892dc3b7..2930f615fc1 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -572,7 +572,7 @@ GET /projects/:id/merge_requests/:merge_request_id/closes_issues curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/projects/76/merge_requests/1/closes_issues ``` -Example response: +Example response when the GitLab issue tracker is used: ```json [ @@ -618,6 +618,17 @@ Example response: ] ``` +Example response when an external issue tracker (e.g. JIRA) is used: + +```json +[ + { + "id" : "PROJECT-123", + "title" : "Title of this issue" + } +] +``` + ## Subscribe to a merge request Subscribes the authenticated user to a merge request to receive notification. If diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 50d69274b2e..14370ac218d 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -179,6 +179,11 @@ module API expose :upvotes, :downvotes end + class ExternalIssue < Grape::Entity + expose :title + expose :id + end + class MergeRequest < ProjectEntity expose :target_branch, :source_branch expose :upvotes, :downvotes diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index e1d3bbcc02d..de5959e3aae 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -418,5 +418,13 @@ module API def send_git_archive(repository, ref:, format:) header(*Gitlab::Workhorse.send_git_archive(repository, ref: ref, format: format)) end + + def issue_entity(project) + if project.has_external_issue_tracker? + Entities::ExternalIssue + else + Entities::Issue + end + end end end diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 24df3e397e0..0e94efd4acd 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -329,7 +329,7 @@ module API get "#{path}/closes_issues" do merge_request = user_project.merge_requests.find(params[:merge_request_id]) issues = ::Kaminari.paginate_array(merge_request.closes_issues(current_user)) - present paginate(issues), with: Entities::Issue, current_user: current_user + present paginate(issues), with: issue_entity(user_project), current_user: current_user end end end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 1356f87b0e9..5896b93603f 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -563,6 +563,21 @@ describe API::API, api: true do expect(json_response).to be_an Array expect(json_response.length).to eq(0) end + + it 'handles external issues' do + jira_project = create(:jira_project, :public, name: 'JIR_EXT1') + issue = ExternalIssue.new("#{jira_project.name}-123", jira_project) + merge_request = create(:merge_request, :simple, author: user, assignee: user, source_project: jira_project) + merge_request.update_attribute(:description, "Closes #{issue.to_reference(jira_project)}") + + get api("/projects/#{jira_project.id}/merge_requests/#{merge_request.id}/closes_issues", user) + + expect(response.status).to eq(200) + expect(json_response).to be_an Array + expect(json_response.length).to eq(1) + expect(json_response.first['title']).to eq(issue.title) + expect(json_response.first['id']).to eq(issue.id) + end end describe 'POST :id/merge_requests/:merge_request_id/subscription' do From b43c6c43b4098f0633f24fbdc0ff249e3e6d4edc Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Sun, 12 Jun 2016 23:05:19 +0200 Subject: [PATCH 65/87] Cache only apt and ruby from vendor Since introduction of gitignore the vendor folder contains also gitignores which affects detection when to update a cache. We explicitly cache only apt and ruby folders. --- .gitlab-ci.yml | 3 ++- scripts/prepare_build.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3dc48a89463..f1dcf990629 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,8 @@ services: cache: key: "ruby21" paths: - - vendor + - vendor/apt + - vendor/ruby variables: MYSQL_ALLOW_EMPTY_PASSWORD: "1" diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index d6fb1a34e8c..7e71a030901 100755 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -16,10 +16,10 @@ retry() { } if [ -f /.dockerenv ] || [ -f ./dockerinit ]; then - mkdir -p vendor + mkdir -p vendor/apt # Install phantomjs package - pushd vendor + pushd vendor/apt if [ ! -e phantomjs_1.9.8-0jessie_amd64.deb ]; then wget -q https://gitlab.com/axil/phantomjs-debian/raw/master/phantomjs_1.9.8-0jessie_amd64.deb fi From f395ed242add9c21536a6e4d9ea7f0154351e503 Mon Sep 17 00:00:00 2001 From: Connor Shea Date: Sun, 12 Jun 2016 18:25:21 -0600 Subject: [PATCH 66/87] Update brakeman from 3.2.1 to 3.3.2 Removes a few dependencies. Changelog: https://github.com/presidentbeef/brakeman/blob/master/CHANGES --- Gemfile | 2 +- Gemfile.lock | 28 +++++----------------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/Gemfile b/Gemfile index b2660144f2b..6d8a33c2eef 100644 --- a/Gemfile +++ b/Gemfile @@ -245,7 +245,7 @@ end group :development do gem "foreman" - gem 'brakeman', '~> 3.2.0', require: false + gem 'brakeman', '~> 3.3.0', require: false gem 'letter_opener_web', '~> 1.3.0' gem 'quiet_assets', '~> 1.0.2' diff --git a/Gemfile.lock b/Gemfile.lock index dfc15700494..2ba2676efa1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,16 +97,7 @@ GEM bootstrap-sass (3.3.6) autoprefixer-rails (>= 5.2.1) sass (>= 3.3.4) - brakeman (3.2.1) - erubis (~> 2.6) - haml (>= 3.0, < 5.0) - highline (>= 1.6.20, < 2.0) - ruby2ruby (~> 2.3.0) - ruby_parser (~> 3.8.1) - safe_yaml (>= 1.0) - sass (~> 3.0) - slim (>= 1.3.6, < 4.0) - terminal-table (~> 1.4) + brakeman (3.3.2) browser (2.0.3) builder (3.2.2) bullet (5.0.0) @@ -338,7 +329,6 @@ GEM hashie (3.4.3) health_check (1.5.1) rails (>= 2.3.0) - highline (1.7.8) hipchat (1.5.2) httparty mimemagic @@ -642,10 +632,7 @@ GEM ruby-saml (1.1.2) nokogiri (>= 1.5.10) uuid (~> 2.3) - ruby2ruby (2.3.0) - ruby_parser (~> 3.1) - sexp_processor (~> 4.0) - ruby_parser (3.8.1) + ruby_parser (3.8.2) sexp_processor (~> 4.1) rubyntlm (0.5.2) rubypants (0.2.0) @@ -655,7 +642,7 @@ GEM safe_yaml (1.0.4) sanitize (2.1.0) nokogiri (>= 1.4.4) - sass (3.4.21) + sass (3.4.22) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) sass (~> 3.1) @@ -704,9 +691,6 @@ GEM tilt (>= 1.3, < 3) six (0.2.0) slack-notifier (1.2.1) - slim (3.0.6) - temple (~> 0.7.3) - tilt (>= 1.3.3, < 2.1) slop (3.6.0) spinach (0.8.10) colorize @@ -747,10 +731,8 @@ GEM railties (>= 3.2.5, < 6) teaspoon-jasmine (2.2.0) teaspoon (>= 1.0.0) - temple (0.7.6) term-ansicolor (1.3.2) tins (~> 1.0) - terminal-table (1.5.2) test_after_commit (0.4.2) activerecord (>= 3.2) thin (1.6.4) @@ -759,7 +741,7 @@ GEM rack (~> 1.0) thor (0.19.1) thread_safe (0.3.5) - tilt (2.0.2) + tilt (2.0.5) timecop (0.8.1) timfel-krb5-auth (0.8.3) tinder (1.10.1) @@ -848,7 +830,7 @@ DEPENDENCIES better_errors (~> 1.0.1) binding_of_caller (~> 0.7.2) bootstrap-sass (~> 3.3.0) - brakeman (~> 3.2.0) + brakeman (~> 3.3.0) browser (~> 2.0.3) bullet bundler-audit From 02b882418a44bccbcde403886c560505abd60281 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Thu, 2 Jun 2016 00:37:25 -0300 Subject: [PATCH 67/87] Fix SVG whitelisting to allow namespaced attributes --- lib/gitlab/sanitizers/svg.rb | 23 +++++++++--- spec/lib/gitlab/sanitizers/svg_spec.rb | 48 ++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 spec/lib/gitlab/sanitizers/svg_spec.rb diff --git a/lib/gitlab/sanitizers/svg.rb b/lib/gitlab/sanitizers/svg.rb index 5e95f6c0529..a540c534dee 100644 --- a/lib/gitlab/sanitizers/svg.rb +++ b/lib/gitlab/sanitizers/svg.rb @@ -13,12 +13,11 @@ module Gitlab unless Whitelist::ALLOWED_ELEMENTS.include?(node.name) node.unlink else - node.attributes.each do |attr_name, attr| - valid_attributes = Whitelist::ALLOWED_ATTRIBUTES[node.name] + valid_attributes = Whitelist::ALLOWED_ATTRIBUTES[node.name] - unless valid_attributes && valid_attributes.include?(attr_name) - if Whitelist::ALLOWED_DATA_ATTRIBUTES_IN_ELEMENTS.include?(node.name) && - attr_name.start_with?('data-') + node.attribute_nodes.each do |attr| + unless valid_attributes && valid_attributes.include?(attribute_name_with_namespace(attr)) + if Whitelist::ALLOWED_DATA_ATTRIBUTES_IN_ELEMENTS.include?(node.name) && data_attribute?(attr) # Arbitrary data attributes are allowed. Verify that the attribute # is a valid data attribute. attr.unlink unless attr_name =~ DATA_ATTR_PATTERN @@ -29,6 +28,20 @@ module Gitlab end end end + + def attribute_name_with_namespace(attr) + if attr.namespace + "#{attr.namespace.prefix}:#{attr.name}" + else + attr.name + end + end + + private + + def data_attribute?(attr) + attr.name.start_with?('data-') + end end end end diff --git a/spec/lib/gitlab/sanitizers/svg_spec.rb b/spec/lib/gitlab/sanitizers/svg_spec.rb new file mode 100644 index 00000000000..bb1c98f51a6 --- /dev/null +++ b/spec/lib/gitlab/sanitizers/svg_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +describe Gitlab::Sanitizers::SVG do + let(:scrubber) { Gitlab::Sanitizers::SVG::Scrubber.new } + let(:namespace) { double(Nokogiri::XML::Namespace, prefix: 'xlink') } + let(:namespaced_attr) { double(Nokogiri::XML::Attr, name: 'href', namespace: namespace) } + + context 'scrubber' do + describe '#scrub' do + let(:invalid_element) { double(Nokogiri::XML::Node, name: 'invalid') } + let(:invalid_attribute) { double(Nokogiri::XML::Attr, name: 'invalid', namespace: nil) } + let(:valid_element) { double(Nokogiri::XML::Node, name: 'use') } + + it 'removes an invalid element' do + expect(invalid_element).to receive(:unlink) + + scrubber.scrub(invalid_element) + end + + it 'removes an invalid attribute' do + allow(valid_element).to receive(:attribute_nodes) { [invalid_attribute] } + expect(invalid_attribute).to receive(:unlink) + + scrubber.scrub(valid_element) + end + + it 'accepts valid element' do + allow(valid_element).to receive(:attribute_nodes) { [namespaced_attr] } + expect(valid_element).not_to receive(:unlink) + + scrubber.scrub(valid_element) + end + + it 'accepts valid namespaced attributes' do + allow(valid_element).to receive(:attribute_nodes) { [namespaced_attr] } + expect(namespaced_attr).not_to receive(:unlink) + + scrubber.scrub(valid_element) + end + end + + describe '#attribute_name_with_namespace' do + it 'returns name with prefix when attribute is namespaced' do + expect(scrubber.attribute_name_with_namespace(namespaced_attr)).to eq('xlink:href') + end + end + end +end From 13791c6704ea6fbca7bcdb2da8e042b00849d783 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Thu, 2 Jun 2016 00:52:35 -0300 Subject: [PATCH 68/87] Refactor SVG sanitizer and prevent `xlink:href` to refer to external resources --- lib/gitlab/sanitizers/svg.rb | 20 +++++++++++++++----- spec/lib/gitlab/sanitizers/svg_spec.rb | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/lib/gitlab/sanitizers/svg.rb b/lib/gitlab/sanitizers/svg.rb index a540c534dee..3e705687873 100644 --- a/lib/gitlab/sanitizers/svg.rb +++ b/lib/gitlab/sanitizers/svg.rb @@ -10,13 +10,19 @@ module Gitlab DATA_ATTR_PATTERN = /\Adata-(?!xml)[a-z_][\w.\u00E0-\u00F6\u00F8-\u017F\u01DD-\u02AF-]*\z/u def scrub(node) - unless Whitelist::ALLOWED_ELEMENTS.include?(node.name) - node.unlink - else + if Whitelist::ALLOWED_ELEMENTS.include?(node.name) valid_attributes = Whitelist::ALLOWED_ATTRIBUTES[node.name] + return unless valid_attributes node.attribute_nodes.each do |attr| - unless valid_attributes && valid_attributes.include?(attribute_name_with_namespace(attr)) + attr_name = attribute_name_with_namespace(attr) + + if valid_attributes.include?(attr_name) + # xlink:href is on the whitelist but we should deny any reference other than internal ids + if attr_name == 'xlink:href' && unsafe_href?(attr) + attr.unlink + end + else if Whitelist::ALLOWED_DATA_ATTRIBUTES_IN_ELEMENTS.include?(node.name) && data_attribute?(attr) # Arbitrary data attributes are allowed. Verify that the attribute # is a valid data attribute. @@ -26,6 +32,8 @@ module Gitlab end end end + else + node.unlink end end @@ -37,7 +45,9 @@ module Gitlab end end - private + def unsafe_href?(attr) + !attr.value.start_with?('#') + end def data_attribute?(attr) attr.name.start_with?('data-') diff --git a/spec/lib/gitlab/sanitizers/svg_spec.rb b/spec/lib/gitlab/sanitizers/svg_spec.rb index bb1c98f51a6..061b759bac0 100644 --- a/spec/lib/gitlab/sanitizers/svg_spec.rb +++ b/spec/lib/gitlab/sanitizers/svg_spec.rb @@ -2,12 +2,12 @@ require 'spec_helper' describe Gitlab::Sanitizers::SVG do let(:scrubber) { Gitlab::Sanitizers::SVG::Scrubber.new } - let(:namespace) { double(Nokogiri::XML::Namespace, prefix: 'xlink') } - let(:namespaced_attr) { double(Nokogiri::XML::Attr, name: 'href', namespace: namespace) } + let(:namespace) { double(Nokogiri::XML::Namespace, prefix: 'xlink', href: 'http://www.w3.org/1999/xlink') } + let(:namespaced_attr) { double(Nokogiri::XML::Attr, name: 'href', namespace: namespace, value: '#awesome_id') } context 'scrubber' do describe '#scrub' do - let(:invalid_element) { double(Nokogiri::XML::Node, name: 'invalid') } + let(:invalid_element) { double(Nokogiri::XML::Node, name: 'invalid', value: 'invalid') } let(:invalid_attribute) { double(Nokogiri::XML::Attr, name: 'invalid', namespace: nil) } let(:valid_element) { double(Nokogiri::XML::Node, name: 'use') } @@ -44,5 +44,17 @@ describe Gitlab::Sanitizers::SVG do expect(scrubber.attribute_name_with_namespace(namespaced_attr)).to eq('xlink:href') end end + + describe '#unsafe_href?' do + let(:unsafe_attr) { double(Nokogiri::XML::Attr, name: 'href', namespace: namespace, value: 'http://evilsite.example.com/random.svg') } + + it 'returns true if href attribute is an external url' do + expect(scrubber.unsafe_href?(unsafe_attr)).to be_truthy + end + + it 'returns false if href atttribute is an internal reference' do + expect(scrubber.unsafe_href?(namespaced_attr)).to be_falsey + end + end end end From 388f6eaaa6d97a09de6162c457042f491d42f96e Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Thu, 2 Jun 2016 00:53:34 -0300 Subject: [PATCH 69/87] Added SVG sanitizer fix to the changelog --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 99dd1d3ff4a..364690286e1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,7 @@ v 8.9.0 (unreleased) - Fix issue todo not remove when leave project !4150 (Long Nguyen) - Allow customisable text on the 'nearly there' page after a user signs up - Bump recaptcha gem to 3.0.0 to remove deprecated stoken support + - Fix SVG sanitizer to allow more elements - Allow forking projects with restricted visibility level - Added descriptions to notification settings dropdown - Improve note validation to prevent errors when creating invalid note via API From a9eaa20dcb3da119a2d5f2efca615f2273533015 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Fri, 3 Jun 2016 16:08:43 -0300 Subject: [PATCH 70/87] Refactored SVG sanitizer --- lib/gitlab/sanitizers/svg.rb | 43 +++++++++++++------------- spec/lib/gitlab/sanitizers/svg_spec.rb | 18 +++++++++++ 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/lib/gitlab/sanitizers/svg.rb b/lib/gitlab/sanitizers/svg.rb index 3e705687873..8304b9a482c 100644 --- a/lib/gitlab/sanitizers/svg.rb +++ b/lib/gitlab/sanitizers/svg.rb @@ -10,30 +10,25 @@ module Gitlab DATA_ATTR_PATTERN = /\Adata-(?!xml)[a-z_][\w.\u00E0-\u00F6\u00F8-\u017F\u01DD-\u02AF-]*\z/u def scrub(node) - if Whitelist::ALLOWED_ELEMENTS.include?(node.name) - valid_attributes = Whitelist::ALLOWED_ATTRIBUTES[node.name] - return unless valid_attributes + unless Whitelist::ALLOWED_ELEMENTS.include?(node.name) + node.unlink + return + end - node.attribute_nodes.each do |attr| - attr_name = attribute_name_with_namespace(attr) + valid_attributes = Whitelist::ALLOWED_ATTRIBUTES[node.name] + return unless valid_attributes - if valid_attributes.include?(attr_name) - # xlink:href is on the whitelist but we should deny any reference other than internal ids - if attr_name == 'xlink:href' && unsafe_href?(attr) - attr.unlink - end - else - if Whitelist::ALLOWED_DATA_ATTRIBUTES_IN_ELEMENTS.include?(node.name) && data_attribute?(attr) - # Arbitrary data attributes are allowed. Verify that the attribute - # is a valid data attribute. - attr.unlink unless attr_name =~ DATA_ATTR_PATTERN - else - attr.unlink - end + node.attribute_nodes.each do |attr| + attr_name = attribute_name_with_namespace(attr) + + if valid_attributes.include?(attr_name) + attr.unlink if unsafe_href?(attr) + else + # Arbitrary data attributes are allowed. + unless allows_data_attribute?(node) && data_attribute?(attr) + attr.unlink end end - else - node.unlink end end @@ -45,12 +40,16 @@ module Gitlab end end + def allows_data_attribute?(node) + Whitelist::ALLOWED_DATA_ATTRIBUTES_IN_ELEMENTS.include?(node.name) + end + def unsafe_href?(attr) - !attr.value.start_with?('#') + attribute_name_with_namespace(attr) == 'xlink:href' && !attr.value.start_with?('#') end def data_attribute?(attr) - attr.name.start_with?('data-') + attr.name.start_with?('data-') && attr.name =~ DATA_ATTR_PATTERN && attr.namespace.nil? end end end diff --git a/spec/lib/gitlab/sanitizers/svg_spec.rb b/spec/lib/gitlab/sanitizers/svg_spec.rb index 061b759bac0..e1b040d6c64 100644 --- a/spec/lib/gitlab/sanitizers/svg_spec.rb +++ b/spec/lib/gitlab/sanitizers/svg_spec.rb @@ -56,5 +56,23 @@ describe Gitlab::Sanitizers::SVG do expect(scrubber.unsafe_href?(namespaced_attr)).to be_falsey end end + + describe '#data_attribute?' do + let(:data_attr) { double(Nokogiri::XML::Attr, name: 'data-gitlab', namespace: nil, value: 'gitlab is awesome') } + let(:namespaced_attr) { double(Nokogiri::XML::Attr, name: 'data-gitlab', namespace: namespace, value: 'gitlab is awesome') } + let(:other_attr) { double(Nokogiri::XML::Attr, name: 'something', namespace: nil, value: 'content') } + + it 'returns true if is a valid data attribute' do + expect(scrubber.data_attribute?(data_attr)).to be_truthy + end + + it 'returns false if attribute is namespaced' do + expect(scrubber.data_attribute?(namespaced_attr)).to be_falsey + end + + it 'returns false if not a data attribute' do + expect(scrubber.data_attribute?(other_attr)).to be_falsey + end + end end end From 7c87dac5f1f3d333b06dbcb2c7f66538abfb8255 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Thu, 9 Jun 2016 02:51:40 -0300 Subject: [PATCH 71/87] Improved SVG sanitizer specs to include smoke tests for clean. --- spec/lib/gitlab/sanitizers/svg_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/lib/gitlab/sanitizers/svg_spec.rb b/spec/lib/gitlab/sanitizers/svg_spec.rb index e1b040d6c64..030c2063ab2 100644 --- a/spec/lib/gitlab/sanitizers/svg_spec.rb +++ b/spec/lib/gitlab/sanitizers/svg_spec.rb @@ -5,6 +5,22 @@ describe Gitlab::Sanitizers::SVG do let(:namespace) { double(Nokogiri::XML::Namespace, prefix: 'xlink', href: 'http://www.w3.org/1999/xlink') } let(:namespaced_attr) { double(Nokogiri::XML::Attr, name: 'href', namespace: namespace, value: '#awesome_id') } + describe '.clean' do + let(:input_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'unsanitized.svg') } + let(:data) { open(input_svg_path).read } + let(:sanitized_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'sanitized.svg') } + let(:sanitized) { open(sanitized_svg_path).read } + + it 'delegates sanitization to scrubber' do + expect_any_instance_of(Gitlab::Sanitizers::SVG::Scrubber).to receive(:scrub).at_least(:once) + described_class.clean(data) + end + + it 'returns sanitized data' do + expect(described_class.clean(data)).to eq(sanitized) + end + end + context 'scrubber' do describe '#scrub' do let(:invalid_element) { double(Nokogiri::XML::Node, name: 'invalid', value: 'invalid') } From c1f37964ed04e34fd8606d9b2a63f9d6798766f5 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 12 Jun 2016 19:13:14 -0700 Subject: [PATCH 72/87] Fix typo causing related branches to Error 500 --- app/views/projects/issues/_related_branches.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/issues/_related_branches.html.haml b/app/views/projects/issues/_related_branches.html.haml index b9bb6fe559d..c6fc499a7b8 100644 --- a/app/views/projects/issues/_related_branches.html.haml +++ b/app/views/projects/issues/_related_branches.html.haml @@ -6,7 +6,7 @@ %li - sha = @project.repository.find_branch(branch).target - pipeline = @project.pipeline(sha, branch) if sha - - if ci_copipelinemmit + - if pipeline %span.related-branch-ci-status = render_pipeline_status(pipeline) %span.related-branch-info From b33b7be53e113e4f07154b6aafb7858d76d99516 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 13 Jun 2016 11:22:58 +0200 Subject: [PATCH 73/87] Handle NULL migration errors in migration helpers This ensures that whenever changing the NULL constraint of a column fails we still drop the column. --- lib/gitlab/database/migration_helpers.rb | 4 ++-- spec/lib/gitlab/database/migration_helpers_spec.rb | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 978c3f7896d..0f488e968f6 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -126,6 +126,8 @@ module Gitlab begin transaction do update_column_in_batches(table, column, default) + + change_column_null(table, column, false) unless allow_null end # We want to rescue _all_ exceptions here, even those that don't inherit # from StandardError. @@ -134,8 +136,6 @@ module Gitlab raise error end - - change_column_null(table, column, false) unless allow_null end end end diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index 83ddabe6b0b..1ec539066a7 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -120,6 +120,19 @@ describe Gitlab::Database::MigrationHelpers, lib: true do model.add_column_with_default(:projects, :foo, :integer, default: 10) end.to raise_error(RuntimeError) end + + it 'removes the added column whenever changing a column NULL constraint fails' do + expect(model).to receive(:change_column_null). + with(:projects, :foo, false). + and_raise(RuntimeError) + + expect(model).to receive(:remove_column). + with(:projects, :foo) + + expect do + model.add_column_with_default(:projects, :foo, :integer, default: 10) + end.to raise_error(RuntimeError) + end end context 'inside a transaction' do From 0e50fa24a5b4ff7665a68da2a1221b5cae9e5633 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 13 Jun 2016 12:32:53 +0300 Subject: [PATCH 74/87] Remove counters from Pipeline navigation Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/pipelines/_head.html.haml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/projects/pipelines/_head.html.haml b/app/views/projects/pipelines/_head.html.haml index f278d4e0538..d0ba0d27d7c 100644 --- a/app/views/projects/pipelines/_head.html.haml +++ b/app/views/projects/pipelines/_head.html.haml @@ -5,11 +5,9 @@ = link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do %span Pipelines - %span.badge.count.ci_counter= number_with_delimiter(@project.pipelines.running_or_pending.count) - if project_nav_tab? :builds = nav_link(controller: %w(builds)) do = link_to project_builds_path(@project), title: 'Builds', class: 'shortcuts-builds' do %span Builds - %span.badge.count.builds_counter= number_with_delimiter(@project.running_or_pending_build_count) From 9c238dc970afc4cc9e4e4f9e3327e7a34b8d7c9a Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 13 Jun 2016 11:38:57 +0200 Subject: [PATCH 75/87] Update columns in batches until no rows are left Instead of updating a fixed number of rows (based on the amount of rows available at the start of the update) the method "update_column_in_batches" will now continue updating rows until it runs out of rows to process. For a table with a high rate of inserts this may result in the migration taking quite some time. However, the alternative is not all rows being updated or the "change_column_null" method raising an error due to there being NULL values. --- lib/gitlab/database/migration_helpers.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 0f488e968f6..ddf428e9cb4 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -55,10 +55,10 @@ module Gitlab first['count']. to_i - # Update in batches of 5% + # Update in batches of 5% until we run out of any rows to update. batch_size = ((total / 100.0) * 5.0).ceil - while processed < total + loop do start_row = exec_query(%Q{ SELECT id FROM #{quoted_table} @@ -66,6 +66,9 @@ module Gitlab LIMIT 1 OFFSET #{processed} }).to_hash.first + # There are no more rows to process + break unless start_row + stop_row = exec_query(%Q{ SELECT id FROM #{quoted_table} From ea7ff1341032c04ff9abad0e286888a3ab8a9a15 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 13 Jun 2016 11:50:27 +0200 Subject: [PATCH 76/87] Removed old comment from update_column_in_batches --- lib/gitlab/database/migration_helpers.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index ddf428e9cb4..dd3ff0ab18b 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -31,8 +31,6 @@ module Gitlab # Any data inserted while running this method (or after it has finished # running) is _not_ updated automatically. # - # This method _only_ updates rows where the column's value is set to NULL. - # # table - The name of the table. # column - The name of the column to update. # value - The value for the column. From ffd316483ce01591e84996dfaedd539480226e5a Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 13 Jun 2016 11:59:42 +0200 Subject: [PATCH 77/87] Instrument all Banzai::ReferenceParser classes Now that this code is no longer part of Banzai::Filter it needs to be instrumented explicitly. --- CHANGELOG | 1 + config/initializers/metrics.rb | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 364690286e1..c39c99674b7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -68,6 +68,7 @@ v 8.9.0 (unreleased) - Improved UX of date pickers on issue & milestone forms - Cache on the database if a project has an active external issue tracker. - Put project Labels and Milestones pages links under Issues and Merge Requests tabs as subnav + - All classes in the Banzai::ReferenceParser namespace are now instrumented v 8.8.5 (unreleased) - Ensure branch cleanup regardless of whether the GitHub import process succeeds diff --git a/config/initializers/metrics.rb b/config/initializers/metrics.rb index 2673093b96a..f6509ee43f1 100644 --- a/config/initializers/metrics.rb +++ b/config/initializers/metrics.rb @@ -96,13 +96,18 @@ if Gitlab::Metrics.enabled? config.instrument_instance_methods(const) end - # Instruments all Banzai filters - Dir[Rails.root.join('lib', 'banzai', 'filter', '*.rb')].each do |file| - klass = File.basename(file, File.extname(file)).camelize - const = Banzai::Filter.const_get(klass) + # Instruments all Banzai filters and reference parsers + { + Filter: Rails.root.join('lib', 'banzai', 'filter', '*.rb'), + ReferenceParser: Rails.root.join('lib', 'banzai', 'reference_parser', '*.rb') + }.each do |const_name, path| + Dir[path].each do |file| + klass = File.basename(file, File.extname(file)).camelize + const = Banzai.const_get(const_name).const_get(klass) - config.instrument_methods(const) - config.instrument_instance_methods(const) + config.instrument_methods(const) + config.instrument_instance_methods(const) + end end config.instrument_methods(Banzai::Renderer) From b9977525394ac714e31c1751690c7b993eb8d830 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 10 Jun 2016 16:43:25 +0100 Subject: [PATCH 78/87] Only show branches for revert / cherry-pick Tags are immutable, so we can't add a commit to either revert or cherry-pick another commit to them. --- CHANGELOG | 1 + app/helpers/branches_helper.rb | 4 ++++ app/views/projects/commit/_change.html.haml | 2 +- spec/features/projects/commits/cherry_pick_spec.rb | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 0c712b445a4..509f3ec6a26 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ v 8.9.0 (unreleased) - Bump rouge to 1.11.0 - Make EmailsOnPushWorker use Sidekiq mailers queue - Fix wiki page events' webhook to point to the wiki repository + - Don't show tags for revert and cherry-pick operations - Fix issue todo not remove when leave project !4150 (Long Nguyen) - Allow customisable text on the 'nearly there' page after a user signs up - Bump recaptcha gem to 3.0.0 to remove deprecated stoken support diff --git a/app/helpers/branches_helper.rb b/app/helpers/branches_helper.rb index e39548e17e1..3ee3fc74f0c 100644 --- a/app/helpers/branches_helper.rb +++ b/app/helpers/branches_helper.rb @@ -14,4 +14,8 @@ module BranchesHelper ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(branch_name) end + + def project_branches + options_for_select(@project.repository.branch_names, @project.default_branch) + end end diff --git a/app/views/projects/commit/_change.html.haml b/app/views/projects/commit/_change.html.haml index 44ef1fdbbe3..d9b800a4ded 100644 --- a/app/views/projects/commit/_change.html.haml +++ b/app/views/projects/commit/_change.html.haml @@ -17,7 +17,7 @@ .form-group.branch = label_tag 'target_branch', target_label, class: 'control-label' .col-sm-10 - = select_tag "target_branch", grouped_options_refs, class: "select2 select2-sm js-target-branch" + = select_tag "target_branch", project_branches, class: "select2 select2-sm js-target-branch" - if can?(current_user, :push_code, @project) .js-create-merge-request-container .checkbox diff --git a/spec/features/projects/commits/cherry_pick_spec.rb b/spec/features/projects/commits/cherry_pick_spec.rb index 0559b02f321..f88c0616b52 100644 --- a/spec/features/projects/commits/cherry_pick_spec.rb +++ b/spec/features/projects/commits/cherry_pick_spec.rb @@ -16,6 +16,7 @@ describe 'Cherry-pick Commits' do it do visit namespace_project_commit_path(project.namespace, project, master_pickable_commit.id) find("a[href='#modal-cherry-pick-commit']").click + expect(page).not_to have_content('v1.0.0') # Only branches, not tags page.within('#modal-cherry-pick-commit') do uncheck 'create_merge_request' click_button 'Cherry-pick' From bb3fc8c72c2a3af7873cabf9ae3e951376e7ac9e Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 13 Jun 2016 12:07:03 +0200 Subject: [PATCH 79/87] Make "four phase test" --- spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index fe1e8b2262e..304290d6608 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -501,6 +501,7 @@ module Ci }) config_processor = GitlabCiYamlProcessor.new(config, path) + builds = config_processor.builds_for_stage_and_ref("test", "master") expect(builds.size).to eq(1) expect(builds.first[:when]).to eq(when_state) From 35e9fc98655e72ea67f4e04015d255fe7f242717 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Mon, 13 Jun 2016 13:52:20 +0200 Subject: [PATCH 80/87] Move logs/logs.md to administration/logs.md [ci skip] --- doc/administration/logs.md | 137 +++++++++++++++++++++++++++++++++++++ doc/logs/logs.md | 93 +------------------------ 2 files changed, 138 insertions(+), 92 deletions(-) create mode 100644 doc/administration/logs.md diff --git a/doc/administration/logs.md b/doc/administration/logs.md new file mode 100644 index 00000000000..737b39db16c --- /dev/null +++ b/doc/administration/logs.md @@ -0,0 +1,137 @@ +## Log system + +GitLab has an advanced log system where everything is logged so that you +can analyze your instance using various system log files. In addition to +system log files, GitLab Enterprise Edition comes with Audit Events. +Find more about them [in Audit Events +documentation](http://docs.gitlab.com/ee/administration/audit_events.html) + +System log files are typically plain text in a standard log file format. +This guide talks about how to read and use these system log files. + +### production.log + +This file lives in `/var/log/gitlab/gitlab-rails/production.log` for +omnibus package or in `/home/git/gitlab/log/production.log` for +installations from source. + +It contains information about all performed requests. You can see the +URL and type of request, IP address and what exactly parts of code were +involved to service this particular request. Also you can see all SQL +request that have been performed and how much time it took. This task is +more useful for GitLab contributors and developers. Use part of this log +file when you are going to report bug. For example: + +``` +Started GET "/gitlabhq/yaml_db/tree/master" for 168.111.56.1 at 2015-02-12 19:34:53 +0200 +Processing by Projects::TreeController#show as HTML + Parameters: {"project_id"=>"gitlabhq/yaml_db", "id"=>"master"} + + ... [CUT OUT] + + Namespaces"."created_at" DESC, "namespaces"."id" DESC LIMIT 1 [["id", 26]] + CACHE (0.0ms) SELECT "members".* FROM "members" WHERE "members"."source_type" = 'Project' AND "members"."type" IN ('ProjectMember') AND "members"."source_id" = $1 AND "members"."source_type" = $2 AND "members"."user_id" = 1 ORDER BY "members"."created_at" DESC, "members"."id" DESC LIMIT 1 [["source_id", 18], ["source_type", "Project"]] + CACHE (0.0ms) SELECT "members".* FROM "members" WHERE "members"."source_type" = 'Project' AND "members". + (1.4ms) SELECT COUNT(*) FROM "merge_requests" WHERE "merge_requests"."target_project_id" = $1 AND ("merge_requests"."state" IN ('opened','reopened')) [["target_project_id", 18]] + Rendered layouts/nav/_project.html.haml (28.0ms) + Rendered layouts/_collapse_button.html.haml (0.2ms) + Rendered layouts/_flash.html.haml (0.1ms) + Rendered layouts/_page.html.haml (32.9ms) +Completed 200 OK in 166ms (Views: 117.4ms | ActiveRecord: 27.2ms) +``` + +In this example we can see that server processed an HTTP request with URL +`/gitlabhq/yaml_db/tree/master` from IP 168.111.56.1 at 2015-02-12 +19:34:53 +0200. Also we can see that request was processed by +`Projects::TreeController`. + +### application.log + +This file lives in `/var/log/gitlab/gitlab-rails/application.log` for +omnibus package or in `/home/git/gitlab/log/application.log` for +installations from source. + +It helps you discover events happening in your instance such as user creation, +project removing and so on. For example: + +``` +October 06, 2014 11:56: User "Administrator" (admin@example.com) was created +October 06, 2014 11:56: Documentcloud created a new project "Documentcloud / Underscore" +October 06, 2014 11:56: Gitlab Org created a new project "Gitlab Org / Gitlab Ce" +October 07, 2014 11:25: User "Claudie Hodkiewicz" (nasir_stehr@olson.co.uk) was removed +October 07, 2014 11:25: Project "project133" was removed +``` + +### githost.log + +This file lives in `/var/log/gitlab/gitlab-rails/githost.log` for +omnibus package or in `/home/git/gitlab/log/githost.log` for +installations from source. + +GitLab has to interact with Git repositories but in some rare cases +something can go wrong and in this case you will know what exactly +happened. This log file contains all failed requests from GitLab to Git +repositories. In the majority of cases this file will be useful for developers +only. For example: + +``` +December 03, 2014 13:20 -> ERROR -> Command failed [1]: /usr/bin/git --git-dir=/Users/vsizov/gitlab-development-kit/gitlab/tmp/tests/gitlab-satellites/group184/gitlabhq/.git --work-tree=/Users/vsizov/gitlab-development-kit/gitlab/tmp/tests/gitlab-satellites/group184/gitlabhq merge --no-ff -mMerge branch 'feature_conflict' into 'feature' source/feature_conflict + +error: failed to push some refs to '/Users/vsizov/gitlab-development-kit/repositories/gitlabhq/gitlab_git.git' +``` + +### sidekiq.log + +This file lives in `/var/log/gitlab/gitlab-rails/sidekiq.log` for +omnibus package or in `/home/git/gitlab/log/sidekiq.log` for +installations from source. + +GitLab uses background jobs for processing tasks which can take a long +time. All information about processing these jobs are written down to +this file. For example: + +``` +2014-06-10T07:55:20Z 2037 TID-tm504 ERROR: /opt/bitnami/apps/discourse/htdocs/vendor/bundle/ruby/1.9.1/gems/redis-3.0.7/lib/redis/client.rb:228:in `read' +2014-06-10T18:18:26Z 14299 TID-55uqo INFO: Booting Sidekiq 3.0.0 with redis options {:url=>"redis://localhost:6379/0", :namespace=>"sidekiq"} +``` + +### gitlab-shell.log + +This file lives in `/var/log/gitlab/gitlab-shell/gitlab-shell.log` for +omnibus package or in `/home/git/gitlab-shell/gitlab-shell.log` for +installations from source. + +GitLab shell is used by Gitlab for executing Git commands and provide +SSH access to Git repositories. For example: + +``` +I, [2015-02-13T06:17:00.671315 #9291] INFO -- : Adding project root/example.git at . +I, [2015-02-13T06:17:00.679433 #9291] INFO -- : Moving existing hooks directory and symlinking global hooks directory for /var/opt/gitlab/git-data/repositories/root/example.git. +``` + +### unicorn\_stderr.log + +This file lives in `/var/log/gitlab/unicorn/unicorn_stderr.log` for +omnibus package or in `/home/git/gitlab/log/unicorn_stderr.log` for +installations from source. + +Unicorn is a high-performance forking Web server which is used for +serving the GitLab application. You can look at this log if, for +example, your application does not respond. This log contains all +information about the state of unicorn processes at any given time. + +``` +I, [2015-02-13T06:14:46.680381 #9047] INFO -- : Refreshing Gem list +I, [2015-02-13T06:14:56.931002 #9047] INFO -- : listening on addr=127.0.0.1:8080 fd=12 +I, [2015-02-13T06:14:56.931381 #9047] INFO -- : listening on addr=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket fd=13 +I, [2015-02-13T06:14:56.936638 #9047] INFO -- : master process ready +I, [2015-02-13T06:14:56.946504 #9092] INFO -- : worker=0 spawned pid=9092 +I, [2015-02-13T06:14:56.946943 #9092] INFO -- : worker=0 ready +I, [2015-02-13T06:14:56.947892 #9094] INFO -- : worker=1 spawned pid=9094 +I, [2015-02-13T06:14:56.948181 #9094] INFO -- : worker=1 ready +W, [2015-02-13T07:16:01.312916 #9094] WARN -- : #: worker (pid: 9094) exceeds memory limit (320626688 bytes > 247066940 bytes) +W, [2015-02-13T07:16:01.313000 #9094] WARN -- : Unicorn::WorkerKiller send SIGQUIT (pid: 9094) alive: 3621 sec (trial 1) +I, [2015-02-13T07:16:01.530733 #9047] INFO -- : reaped # worker=1 +I, [2015-02-13T07:16:01.534501 #13379] INFO -- : worker=1 spawned pid=13379 +I, [2015-02-13T07:16:01.534848 #13379] INFO -- : worker=1 ready +``` diff --git a/doc/logs/logs.md b/doc/logs/logs.md index f84060b8d07..a2eca62d691 100644 --- a/doc/logs/logs.md +++ b/doc/logs/logs.md @@ -1,92 +1 @@ -## Log system -GitLab has an advanced log system where everything is logged so that you can analyze your instance using various system log files. -In addition to system log files, GitLab Enterprise Edition comes with Audit Events. Find more about them [in Audit Events documentation](http://docs.gitlab.com/ee/administration/audit_events.html) - -System log files are typically plain text in a standard log file format. This guide talks about how to read and use these system log files. - -#### production.log -This file lives in `/var/log/gitlab/gitlab-rails/production.log` for omnibus package or in `/home/git/gitlab/log/production.log` for installations from the source. - -This file contains information about all performed requests. You can see url and type of request, IP address and what exactly parts of code were involved to service this particular request. Also you can see all SQL request that have been performed and how much time it took. -This task is more useful for GitLab contributors and developers. Use part of this log file when you are going to report bug. - -``` -Started GET "/gitlabhq/yaml_db/tree/master" for 168.111.56.1 at 2015-02-12 19:34:53 +0200 -Processing by Projects::TreeController#show as HTML - Parameters: {"project_id"=>"gitlabhq/yaml_db", "id"=>"master"} - - ... [CUT OUT] - - amespaces"."created_at" DESC, "namespaces"."id" DESC LIMIT 1 [["id", 26]] - CACHE (0.0ms) SELECT "members".* FROM "members" WHERE "members"."source_type" = 'Project' AND "members"."type" IN ('ProjectMember') AND "members"."source_id" = $1 AND "members"."source_type" = $2 AND "members"."user_id" = 1 ORDER BY "members"."created_at" DESC, "members"."id" DESC LIMIT 1 [["source_id", 18], ["source_type", "Project"]] - CACHE (0.0ms) SELECT "members".* FROM "members" WHERE "members"."source_type" = 'Project' AND "members". -  (1.4ms) SELECT COUNT(*) FROM "merge_requests" WHERE "merge_requests"."target_project_id" = $1 AND ("merge_requests"."state" IN ('opened','reopened')) [["target_project_id", 18]] - Rendered layouts/nav/_project.html.haml (28.0ms) - Rendered layouts/_collapse_button.html.haml (0.2ms) - Rendered layouts/_flash.html.haml (0.1ms) - Rendered layouts/_page.html.haml (32.9ms) -Completed 200 OK in 166ms (Views: 117.4ms | ActiveRecord: 27.2ms) -``` -In this example we can see that server processed HTTP request with url `/gitlabhq/yaml_db/tree/master` from IP 168.111.56.1 at 2015-02-12 19:34:53 +0200. Also we can see that request was processed by Projects::TreeController. - -#### application.log -This file lives in `/var/log/gitlab/gitlab-rails/application.log` for omnibus package or in `/home/git/gitlab/log/application.log` for installations from the source. - -This log file helps you discover events happening in your instance such as user creation, project removing and so on. - -``` -October 06, 2014 11:56: User "Administrator" (admin@example.com) was created -October 06, 2014 11:56: Documentcloud created a new project "Documentcloud / Underscore" -October 06, 2014 11:56: Gitlab Org created a new project "Gitlab Org / Gitlab Ce" -October 07, 2014 11:25: User "Claudie Hodkiewicz" (nasir_stehr@olson.co.uk) was removed -October 07, 2014 11:25: Project "project133" was removed -``` -#### githost.log -This file lives in `/var/log/gitlab/gitlab-rails/githost.log` for omnibus package or in `/home/git/gitlab/log/githost.log` for installations from the source. - -The GitLab has to interact with git repositories but in some rare cases something can go wrong and in this case you will know what exactly happened. This log file contains all failed requests from GitLab to git repository. In majority of cases this file will be useful for developers only. -``` -December 03, 2014 13:20 -> ERROR -> Command failed [1]: /usr/bin/git --git-dir=/Users/vsizov/gitlab-development-kit/gitlab/tmp/tests/gitlab-satellites/group184/gitlabhq/.git --work-tree=/Users/vsizov/gitlab-development-kit/gitlab/tmp/tests/gitlab-satellites/group184/gitlabhq merge --no-ff -mMerge branch 'feature_conflict' into 'feature' source/feature_conflict - -error: failed to push some refs to '/Users/vsizov/gitlab-development-kit/repositories/gitlabhq/gitlab_git.git' -``` - -#### sidekiq.log -This file lives in `/var/log/gitlab/gitlab-rails/sidekiq.log` for omnibus package or in `/home/git/gitlab/log/sidekiq.log` for installations from the source. - -GitLab uses background jobs for processing tasks which can take a long time. All information about processing these jobs are writing down to this file. -``` -2014-06-10T07:55:20Z 2037 TID-tm504 ERROR: /opt/bitnami/apps/discourse/htdocs/vendor/bundle/ruby/1.9.1/gems/redis-3.0.7/lib/redis/client.rb:228:in `read' -2014-06-10T18:18:26Z 14299 TID-55uqo INFO: Booting Sidekiq 3.0.0 with redis options {:url=>"redis://localhost:6379/0", :namespace=>"sidekiq"} -``` - -#### gitlab-shell.log -This file lives in `/var/log/gitlab/gitlab-shell/gitlab-shell.log` for omnibus package or in `/home/git/gitlab-shell/gitlab-shell.log` for installations from the source. - -gitlab-shell is using by Gitlab for executing git commands and provide ssh access to git repositories. - -``` -I, [2015-02-13T06:17:00.671315 #9291] INFO -- : Adding project root/example.git at . -I, [2015-02-13T06:17:00.679433 #9291] INFO -- : Moving existing hooks directory and symlinking global hooks directory for /var/opt/gitlab/git-data/repositories/root/example.git. -``` - -#### unicorn_stderr.log -This file lives in `/var/log/gitlab/unicorn/unicorn_stderr.log` for omnibus package or in `/home/git/gitlab/log/unicorn_stderr.log` for installations from the source. - -Unicorn is a high-performance forking Web server which is used for serving the GitLab application. You can look at this log if, for example, your application does not respond. This log contains all information about the state of unicorn processes at any given time. - -``` -I, [2015-02-13T06:14:46.680381 #9047] INFO -- : Refreshing Gem list -I, [2015-02-13T06:14:56.931002 #9047] INFO -- : listening on addr=127.0.0.1:8080 fd=12 -I, [2015-02-13T06:14:56.931381 #9047] INFO -- : listening on addr=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket fd=13 -I, [2015-02-13T06:14:56.936638 #9047] INFO -- : master process ready -I, [2015-02-13T06:14:56.946504 #9092] INFO -- : worker=0 spawned pid=9092 -I, [2015-02-13T06:14:56.946943 #9092] INFO -- : worker=0 ready -I, [2015-02-13T06:14:56.947892 #9094] INFO -- : worker=1 spawned pid=9094 -I, [2015-02-13T06:14:56.948181 #9094] INFO -- : worker=1 ready -W, [2015-02-13T07:16:01.312916 #9094] WARN -- : #: worker (pid: 9094) exceeds memory limit (320626688 bytes > 247066940 bytes) -W, [2015-02-13T07:16:01.313000 #9094] WARN -- : Unicorn::WorkerKiller send SIGQUIT (pid: 9094) alive: 3621 sec (trial 1) -I, [2015-02-13T07:16:01.530733 #9047] INFO -- : reaped # worker=1 -I, [2015-02-13T07:16:01.534501 #13379] INFO -- : worker=1 spawned pid=13379 -I, [2015-02-13T07:16:01.534848 #13379] INFO -- : worker=1 ready -``` +This document was moved to [administration/logs.md](../administration/logs.md). From e489e9a58534b7f71085048747e12d6223d1cb1e Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Mon, 13 Jun 2016 14:19:29 +0200 Subject: [PATCH 81/87] Change logs.md location in README [ci skip] --- doc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/README.md b/doc/README.md index d1345ab2493..5d89d0c9821 100644 --- a/doc/README.md +++ b/doc/README.md @@ -28,7 +28,7 @@ - [Integration](integration/README.md) How to integrate with systems such as JIRA, Redmine, Twitter. - [Issue closing](customization/issue_closing.md) Customize how to close an issue from commit messages. - [Libravatar](customization/libravatar.md) Use Libravatar for user avatars. -- [Log system](logs/logs.md) Log system. +- [Log system](administration/logs.md) Log system. - [Environment Variables](administration/environment_variables.md) to configure GitLab. - [Operations](operations/README.md) Keeping GitLab up and running - [Raketasks](raketasks/README.md) Backups, maintenance, automatic webhook setup and the importing of projects. From d1abbb3b662bd41a3b58eeb60c5c0740adff986c Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Mon, 13 Jun 2016 15:00:28 +0200 Subject: [PATCH 82/87] Add guide on changing a document's location [ci skip] --- doc/development/doc_styleguide.md | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/doc/development/doc_styleguide.md b/doc/development/doc_styleguide.md index 8292b393757..c59012bef46 100644 --- a/doc/development/doc_styleguide.md +++ b/doc/development/doc_styleguide.md @@ -141,6 +141,48 @@ Inside the document: [ruby-dl]: https://www.ruby-lang.org/en/downloads/ "Ruby download website" +## Changing document location + +Changing a document's location is not to be taken lightly. Remember that the +documentation is available to all installations under `help/` and not only to +GitLab.com or http://docs.gitlab.com. Make sure this is discussed with the +Documentation team beforehand. + +If you indeed need to change a document's location, do NOT remove the old +document, but rather put a text in it that points to the new location, like: + +``` +This document was moved to [path/to/new_doc.md](path/to/new_doc.md). +``` + +where `path/to/new_doc.md` is the relative path to the root directory `doc/`. + +--- + +For example, if you were to move `doc/workflow/lfs/lfs_administration.md` to +`doc/administration/lfs.md`, then the steps would be: + +1. Copy `doc/workflow/lfs/lfs_administration.md` to `doc/administration/lfs.md` +1. Replace the contents of `doc/workflow/lfs/lfs_administration.md` with: + + ``` + This document was moved to [administration/lfs.md](../../administration/lfs.md). + ``` + +1. Find and replace any occurrences of the old location with the new one. + A quick way to find them is to use `grep`: + + ``` + grep -nR "lfs_administration.md" doc/ + ``` + + The above command will search in the `doc/` directory for + `lfs_administration.md` recursively and will print the file and the line + where this file is mentioned. Note that we used just the filename + (`lfs_administration.md`) and not the whole the relative path + (`workflow/lfs/lfs_administration.md`). + + ## API Here is a list of must-have items. Use them in the exact order that appears From cb7fa10cb593a7288d51e91466ff5be2767c98f0 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Mon, 13 Jun 2016 15:04:22 +0200 Subject: [PATCH 83/87] Change to new Notes styleguide [ci skip] --- doc/development/doc_styleguide.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/development/doc_styleguide.md b/doc/development/doc_styleguide.md index 8292b393757..dbaa7eff410 100644 --- a/doc/development/doc_styleguide.md +++ b/doc/development/doc_styleguide.md @@ -103,14 +103,14 @@ Inside the document: - Every piece of documentation that comes with a new feature should declare the GitLab version that feature got introduced. Right below the heading add a - note: `_**Note:** This feature was introduced in GitLab 8.3_` + note: `>**Note:** This feature was introduced in GitLab 8.3` - If possible every feature should have a link to the MR that introduced it. The above note would be then transformed to: - `_**Note:** This feature was [introduced][ce-1242] in GitLab 8.3_`, where + `>**Note:** This feature was [introduced][ce-1242] in GitLab 8.3`, where the [link identifier](#links) is named after the repository (CE) and the MR number - If the feature is only in GitLab EE, don't forget to mention it, like: - `_**Note:** This feature was introduced in GitLab EE 8.3_`. Otherwise, leave + `>**Note:** This feature was introduced in GitLab EE 8.3`. Otherwise, leave this mention out ## References @@ -222,8 +222,8 @@ curl --data "name=foo" -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab. #### Post data using JSON content -_**Note:** In this example we create a new group. Watch carefully the single -and double quotes._ +> **Note:** In this example we create a new group. Watch carefully the single +and double quotes. ```bash curl -X POST -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" -H "Content-Type: application/json" --data '{"path": "my-group", "name": "My group"}' https://gitlab.example.com/api/v3/groups From f73cf3e937b92d29753e468dac8a17470253c791 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 13 Jun 2016 15:38:25 +0200 Subject: [PATCH 84/87] Also rename "find" in the specs --- spec/lib/gitlab/auth_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb index f081d550ec8..7bec1367156 100644 --- a/spec/lib/gitlab/auth_spec.rb +++ b/spec/lib/gitlab/auth_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Gitlab::Auth, lib: true do let(:gl_auth) { described_class } - describe 'find' do + describe 'find_for_git_client' do it 'recognizes CI' do token = '123' project = create(:empty_project) @@ -11,7 +11,7 @@ describe Gitlab::Auth, lib: true do ip = 'ip' expect(gl_auth).to receive(:rate_limit!).with(ip, success: true, login: 'gitlab-ci-token') - expect(gl_auth.find('gitlab-ci-token', token, project: project, ip: ip)).to eq(Gitlab::Auth::Result.new(nil, :ci)) + expect(gl_auth.find_for_git_client('gitlab-ci-token', token, project: project, ip: ip)).to eq(Gitlab::Auth::Result.new(nil, :ci)) end it 'recognizes master passwords' do @@ -19,7 +19,7 @@ describe Gitlab::Auth, lib: true do ip = 'ip' expect(gl_auth).to receive(:rate_limit!).with(ip, success: true, login: user.username) - expect(gl_auth.find(user.username, 'password', project: nil, ip: ip)).to eq(Gitlab::Auth::Result.new(user, :gitlab_or_ldap)) + expect(gl_auth.find_for_git_client(user.username, 'password', project: nil, ip: ip)).to eq(Gitlab::Auth::Result.new(user, :gitlab_or_ldap)) end it 'recognizes OAuth tokens' do @@ -29,7 +29,7 @@ describe Gitlab::Auth, lib: true do ip = 'ip' expect(gl_auth).to receive(:rate_limit!).with(ip, success: true, login: 'oauth2') - expect(gl_auth.find("oauth2", token.token, project: nil, ip: ip)).to eq(Gitlab::Auth::Result.new(user, :oauth)) + expect(gl_auth.find_for_git_client("oauth2", token.token, project: nil, ip: ip)).to eq(Gitlab::Auth::Result.new(user, :oauth)) end it 'returns double nil for invalid credentials' do @@ -37,7 +37,7 @@ describe Gitlab::Auth, lib: true do ip = 'ip' expect(gl_auth).to receive(:rate_limit!).with(ip, success: false, login: login) - expect(gl_auth.find(login, 'bar', project: nil, ip: ip)).to eq(Gitlab::Auth::Result.new) + expect(gl_auth.find_for_git_client(login, 'bar', project: nil, ip: ip)).to eq(Gitlab::Auth::Result.new) end end From 747989c115c86b090612f805170beb175fe1672a Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Mon, 13 Jun 2016 17:40:36 -0300 Subject: [PATCH 85/87] =?UTF-8?q?Schema=20doesn=E2=80=99t=20reflect=20the?= =?UTF-8?q?=20changes=20of=20the=20last=203=20migrations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The schema doesn’t reflect the changes of the last 3 migrations: * 20160610140403_remove_notification_setting_not_null_constraints.rb * 20160610201627_migrate_users_notification_level.rb * 20160610301627_remove_notification_level_from_users.rb --- db/schema.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index aac327797e7..3c947d62e82 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160608155312) do +ActiveRecord::Schema.define(version: 20160610301627) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -670,8 +670,8 @@ ActiveRecord::Schema.define(version: 20160608155312) do create_table "notification_settings", force: :cascade do |t| t.integer "user_id", null: false - t.integer "source_id", null: false - t.string "source_type", null: false + t.integer "source_id" + t.string "source_type" t.integer "level", default: 0, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -988,7 +988,6 @@ ActiveRecord::Schema.define(version: 20160608155312) do t.boolean "can_create_team", default: true, null: false t.string "state" t.integer "color_scheme_id", default: 1, null: false - t.integer "notification_level", default: 1, null: false t.datetime "password_expires_at" t.integer "created_by_id" t.datetime "last_credential_check_at" From 0568b90c97dcbad3ab100e060fef91e0786aafe8 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Fri, 10 Jun 2016 16:53:20 -0300 Subject: [PATCH 86/87] Remove deprecated issues_tracker and issues_tracker_id from project --- app/models/project.rb | 5 ----- .../project_services/issue_tracker_service.rb | 18 +++------------ ...ed_issues_tracker_columns_from_projects.rb | 6 +++++ db/schema.rb | 2 -- spec/factories/projects.rb | 6 ----- spec/helpers/issues_helper_spec.rb | 16 +++----------- spec/models/project_spec.rb | 22 ------------------- 7 files changed, 12 insertions(+), 63 deletions(-) create mode 100644 db/migrate/20160610194713_remove_deprecated_issues_tracker_columns_from_projects.rb diff --git a/app/models/project.rb b/app/models/project.rb index e2f7ffe493c..dfa99fe0df2 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -146,7 +146,6 @@ class Project < ActiveRecord::Base message: Gitlab::Regex.project_path_regex_message } validates :issues_enabled, :merge_requests_enabled, :wiki_enabled, inclusion: { in: [true, false] } - validates :issues_tracker_id, length: { maximum: 255 }, allow_blank: true validates :namespace, presence: true validates_uniqueness_of :name, scope: :namespace_id validates_uniqueness_of :path, scope: :namespace_id @@ -589,10 +588,6 @@ class Project < ActiveRecord::Base update_column(:has_external_issue_tracker, services.external_issue_trackers.any?) end - def can_have_issues_tracker_id? - self.issues_enabled && !self.default_issues_tracker? - end - def build_missing_services services_templates = Service.where(template: true) diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb index 6ae9b16d3ce..87ecb3b8b86 100644 --- a/app/models/project_services/issue_tracker_service.rb +++ b/app/models/project_services/issue_tracker_service.rb @@ -38,9 +38,9 @@ class IssueTrackerService < Service if enabled_in_gitlab_config self.properties = { title: issues_tracker['title'], - project_url: add_issues_tracker_id(issues_tracker['project_url']), - issues_url: add_issues_tracker_id(issues_tracker['issues_url']), - new_issue_url: add_issues_tracker_id(issues_tracker['new_issue_url']) + project_url: issues_tracker['project_url'], + issues_url: issues_tracker['issues_url'], + new_issue_url: issues_tracker['new_issue_url'] } else self.properties = {} @@ -83,16 +83,4 @@ class IssueTrackerService < Service def issues_tracker Gitlab.config.issues_tracker[to_param] end - - def add_issues_tracker_id(url) - if self.project - id = self.project.issues_tracker_id - - if id - url = url.gsub(":issues_tracker_id", id) - end - end - - url - end end diff --git a/db/migrate/20160610194713_remove_deprecated_issues_tracker_columns_from_projects.rb b/db/migrate/20160610194713_remove_deprecated_issues_tracker_columns_from_projects.rb new file mode 100644 index 00000000000..477b2106dea --- /dev/null +++ b/db/migrate/20160610194713_remove_deprecated_issues_tracker_columns_from_projects.rb @@ -0,0 +1,6 @@ +class RemoveDeprecatedIssuesTrackerColumnsFromProjects < ActiveRecord::Migration + def change + remove_column :projects, :issues_tracker, :string, default: 'gitlab', null: false + remove_column :projects, :issues_tracker_id, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 3c947d62e82..3dccbbd50ba 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -751,8 +751,6 @@ ActiveRecord::Schema.define(version: 20160610301627) do t.boolean "merge_requests_enabled", default: true, null: false t.boolean "wiki_enabled", default: true, null: false t.integer "namespace_id" - t.string "issues_tracker", default: "gitlab", null: false - t.string "issues_tracker_id" t.boolean "snippets_enabled", default: true, null: false t.datetime "last_activity_at" t.string "import_url" diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index da8d97c9f82..5c8ddbebf0d 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -67,9 +67,6 @@ FactoryGirl.define do 'new_issue_url' => 'http://redmine/projects/project_name_in_redmine/issues/new' } ) - - project.issues_tracker = 'redmine' - project.issues_tracker_id = 'project_name_in_redmine' end end @@ -84,9 +81,6 @@ FactoryGirl.define do 'new_issue_url' => 'http://jira.example/secure/CreateIssue.jspa' } ) - - project.issues_tracker = 'jira' - project.issues_tracker_id = 'project_name_in_jira' end end end diff --git a/spec/helpers/issues_helper_spec.rb b/spec/helpers/issues_helper_spec.rb index eae61a54dfc..831ae7fb69c 100644 --- a/spec/helpers/issues_helper_spec.rb +++ b/spec/helpers/issues_helper_spec.rb @@ -7,10 +7,7 @@ describe IssuesHelper do describe "url_for_project_issues" do let(:project_url) { ext_project.external_issue_tracker.project_url } - let(:ext_expected) do - project_url.gsub(':project_id', ext_project.id.to_s) - .gsub(':issues_tracker_id', ext_project.issues_tracker_id.to_s) - end + let(:ext_expected) { project_url.gsub(':project_id', ext_project.id.to_s) } let(:int_expected) { polymorphic_path([@project.namespace, project]) } it "should return internal path if used internal tracker" do @@ -56,11 +53,7 @@ describe IssuesHelper do describe "url_for_issue" do let(:issues_url) { ext_project.external_issue_tracker.issues_url} - let(:ext_expected) do - issues_url.gsub(':id', issue.iid.to_s) - .gsub(':project_id', ext_project.id.to_s) - .gsub(':issues_tracker_id', ext_project.issues_tracker_id.to_s) - end + let(:ext_expected) { issues_url.gsub(':id', issue.iid.to_s).gsub(':project_id', ext_project.id.to_s) } let(:int_expected) { polymorphic_path([@project.namespace, project, issue]) } it "should return internal path if used internal tracker" do @@ -106,10 +99,7 @@ describe IssuesHelper do describe 'url_for_new_issue' do let(:issues_url) { ext_project.external_issue_tracker.new_issue_url } - let(:ext_expected) do - issues_url.gsub(':project_id', ext_project.id.to_s) - .gsub(':issues_tracker_id', ext_project.issues_tracker_id.to_s) - end + let(:ext_expected) { issues_url.gsub(':project_id', ext_project.id.to_s) } let(:int_expected) { new_namespace_project_issue_path(project.namespace, project) } it "should return internal path if used internal tracker" do diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index f3590f72cfe..de8815f5a38 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -53,7 +53,6 @@ describe Project, models: true do it { is_expected.to validate_length_of(:path).is_within(0..255) } it { is_expected.to validate_length_of(:description).is_within(0..2000) } it { is_expected.to validate_presence_of(:creator) } - it { is_expected.to validate_length_of(:issues_tracker_id).is_within(0..255) } it { is_expected.to validate_presence_of(:namespace) } it 'should not allow new projects beyond user limits' do @@ -321,27 +320,6 @@ describe Project, models: true do end end - describe :can_have_issues_tracker_id? do - let(:project) { create(:project) } - let(:ext_project) { create(:redmine_project) } - - it 'should be true for projects with external issues tracker if issues enabled' do - expect(ext_project.can_have_issues_tracker_id?).to be_truthy - end - - it 'should be false for projects with internal issue tracker if issues enabled' do - expect(project.can_have_issues_tracker_id?).to be_falsey - end - - it 'should be always false if issues disabled' do - project.issues_enabled = false - ext_project.issues_enabled = false - - expect(project.can_have_issues_tracker_id?).to be_falsey - expect(ext_project.can_have_issues_tracker_id?).to be_falsey - end - end - describe :open_branches do let(:project) { create(:project) } From 4c716de450ecc2959022c67f99f188fff540c6c4 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Fri, 10 Jun 2016 16:53:48 -0300 Subject: [PATCH 87/87] Update CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 7a6a14919da..3387394de5b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -72,6 +72,7 @@ v 8.9.0 (unreleased) - Cache on the database if a project has an active external issue tracker. - Put project Labels and Milestones pages links under Issues and Merge Requests tabs as subnav - All classes in the Banzai::ReferenceParser namespace are now instrumented + - Remove deprecated issues_tracker and issues_tracker_id from project model v 8.8.5 (unreleased) - Ensure branch cleanup regardless of whether the GitHub import process succeeds