summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml6
-rw-r--r--.gitlab/merge_request_templates/Database Changes.md11
-rw-r--r--GITALY_SERVER_VERSION2
-rw-r--r--Gemfile7
-rw-r--r--Gemfile.lock10
-rw-r--r--Gemfile.rails5.lock48
-rw-r--r--app/assets/javascripts/awards_handler.js4
-rw-r--r--app/assets/javascripts/lib/utils/common_utils.js1
-rw-r--r--app/assets/javascripts/notes/components/comment_form.vue6
-rw-r--r--app/assets/javascripts/notes/components/notes_app.vue6
-rw-r--r--app/assets/javascripts/notes/constants.js1
-rw-r--r--app/assets/javascripts/notes/index.js5
-rw-r--r--app/assets/javascripts/notes/mixins/noteable.js2
-rw-r--r--app/assets/javascripts/sidebar/components/confidential/confidential_issue_sidebar.vue101
-rw-r--r--app/assets/javascripts/sidebar/components/confidential/edit_form.vue53
-rw-r--r--app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue21
-rw-r--r--app/assets/javascripts/sidebar/components/lock/edit_form.vue66
-rw-r--r--app/assets/javascripts/sidebar/components/lock/edit_form_buttons.vue23
-rw-r--r--app/assets/javascripts/sidebar/components/lock/lock_issue_sidebar.vue114
-rw-r--r--app/assets/stylesheets/framework/sidebar.scss1
-rw-r--r--app/assets/stylesheets/pages/issuable.scss4
-rw-r--r--app/assets/stylesheets/pages/repo.scss24
-rw-r--r--app/assets/stylesheets/pages/repo.scss.orig786
-rw-r--r--app/controllers/admin/appearances_controller.rb18
-rw-r--r--app/controllers/concerns/issuable_actions.rb6
-rw-r--r--app/controllers/concerns/notes_actions.rb2
-rw-r--r--app/controllers/projects/branches_controller.rb10
-rw-r--r--app/controllers/projects/discussions_controller.rb2
-rw-r--r--app/controllers/projects/services_controller.rb2
-rw-r--r--app/helpers/appearances_helper.rb16
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/helpers/emails_helper.rb4
-rw-r--r--app/helpers/notes_helper.rb18
-rw-r--r--app/mailers/emails/merge_requests.rb1
-rw-r--r--app/models/note.rb7
-rw-r--r--app/serializers/discussion_entity.rb6
-rw-r--r--app/serializers/note_entity.rb30
-rw-r--r--app/serializers/note_serializer.rb3
-rw-r--r--app/serializers/project_note_entity.rb25
-rw-r--r--app/serializers/project_note_serializer.rb3
-rw-r--r--app/services/projects/import_service.rb6
-rw-r--r--app/services/projects/update_pages_service.rb19
-rw-r--r--app/validators/certificate_fingerprint_validator.rb9
-rw-r--r--app/validators/importable_url_validator.rb6
-rw-r--r--app/validators/top_level_group_validator.rb7
-rw-r--r--app/views/layouts/devise.html.haml4
-rw-r--r--app/views/layouts/devise_empty.html.haml2
-rw-r--r--app/views/notify/push_to_merge_request_email.html.haml4
-rw-r--r--app/views/notify/push_to_merge_request_email.text.haml2
-rw-r--r--app/views/projects/_export.html.haml2
-rw-r--r--app/views/projects/clusters/show.html.haml4
-rw-r--r--app/views/projects/deploy_keys/_index.html.haml2
-rw-r--r--app/views/projects/edit.html.haml8
-rw-r--r--app/views/projects/protected_branches/shared/_index.html.haml2
-rw-r--r--app/views/projects/protected_tags/shared/_index.html.haml2
-rw-r--r--app/views/projects/settings/ci_cd/show.html.haml8
-rw-r--r--app/workers/object_storage/migrate_uploads_worker.rb30
-rwxr-xr-xbin/rspec6
-rw-r--r--changelogs/unreleased/43745-store-metadata-checksum-for-artifacts.yml5
-rw-r--r--changelogs/unreleased/44425-use-gitlab_environment.yml5
-rw-r--r--changelogs/unreleased/44776-fix-upload-migrate-fails-for-group.yml5
-rw-r--r--changelogs/unreleased/44878-update-brakeman-3-6-1-to-4-2-1.yml5
-rw-r--r--changelogs/unreleased/44902-remove-rake-test-ci.yml5
-rw-r--r--changelogs/unreleased/blackst0ne-bump-html-pipeline-gem.yml5
-rw-r--r--changelogs/unreleased/blackst0ne-replace-spinach-project-issues-issues-feature.yml5
-rw-r--r--changelogs/unreleased/blackst0ne-replace-spinach-project-issues-labels-feature.yml5
-rw-r--r--changelogs/unreleased/sh-move-sidekiq-exporter-logs.yml5
-rw-r--r--changelogs/unreleased/zj-bump-gitaly.yml5
-rw-r--r--doc/administration/logs.md8
-rw-r--r--doc/api/commits.md5
-rw-r--r--doc/ci/examples/browser_performance.md93
-rw-r--r--doc/ci/examples/code_climate.md7
-rw-r--r--doc/ci/examples/container_scanning.md4
-rw-r--r--doc/ci/examples/dast.md25
-rw-r--r--doc/ci/pipelines.md8
-rw-r--r--doc/ci/quick_start/README.md5
-rw-r--r--doc/ci/yaml/README.md5
-rw-r--r--doc/development/ee_features.md14
-rw-r--r--doc/workflow/lfs/lfs_administration.md109
-rw-r--r--features/project/issues/issues.feature180
-rw-r--r--features/project/issues/labels.feature48
-rw-r--r--features/project/issues/milestones.feature1
-rw-r--r--features/steps/project/issues/issues.rb181
-rw-r--r--features/steps/project/issues/labels.rb101
-rw-r--r--features/steps/shared/issuable.rb23
-rw-r--r--features/steps/shared/markdown.rb37
-rw-r--r--features/steps/shared/note.rb22
-rw-r--r--features/steps/shared/paths.rb31
-rw-r--r--features/steps/shared/project.rb4
-rw-r--r--features/steps/shared/user.rb4
-rw-r--r--lib/api/runner.rb3
-rw-r--r--lib/banzai/filter/emoji_filter.rb2
-rw-r--r--lib/banzai/filter/gollum_tags_filter.rb2
-rw-r--r--lib/banzai/filter/inline_diff_filter.rb2
-rw-r--r--lib/gitlab/git/checksum.rb82
-rw-r--r--lib/gitlab/git/gitmodules_parser.rb4
-rw-r--r--lib/gitlab/http.rb2
-rw-r--r--lib/gitlab/metrics/sidekiq_metrics_exporter.rb10
-rw-r--r--lib/gitlab/performance_bar.rb1
-rw-r--r--lib/gitlab/proxy_http_connection_adapter.rb12
-rw-r--r--lib/gitlab/url_blocker.rb86
-rw-r--r--lib/tasks/gitlab/two_factor.rake2
-rw-r--r--lib/tasks/gitlab/uploads/migrate.rake1
-rw-r--r--lib/tasks/test.rake5
-rwxr-xr-xscripts/trigger-build-omnibus3
-rw-r--r--spec/controllers/projects/branches_controller_spec.rb18
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb2
-rw-r--r--spec/features/dashboard/issues_filter_spec.rb6
-rw-r--r--spec/features/dashboard/merge_requests_spec.rb6
-rw-r--r--spec/features/issuables/discussion_lock_spec.rb2
-rw-r--r--spec/features/issues/issue_sidebar_spec.rb44
-rw-r--r--spec/features/issues/user_uses_slash_commands_spec.rb26
-rw-r--r--spec/features/merge_request/user_uses_slash_commands_spec.rb22
-rw-r--r--spec/features/projects/issues/user_comments_on_issue_spec.rb73
-rw-r--r--spec/features/projects/issues/user_creates_issue_spec.rb87
-rw-r--r--spec/features/projects/issues/user_edits_issue_spec.rb25
-rw-r--r--spec/features/projects/issues/user_sorts_issues_spec.rb42
-rw-r--r--spec/features/projects/issues/user_toggles_subscription_spec.rb28
-rw-r--r--spec/features/projects/issues/user_views_issue_spec.rb16
-rw-r--r--spec/features/projects/issues/user_views_issues_spec.rb120
-rw-r--r--spec/features/projects/labels/user_creates_labels_spec.rb88
-rw-r--r--spec/features/projects/labels/user_edits_labels_spec.rb25
-rw-r--r--spec/features/projects/labels/user_removes_labels_spec.rb52
-rw-r--r--spec/features/projects/labels/user_views_labels_spec.rb23
-rw-r--r--spec/features/projects/milestones/milestones_sorting_spec.rb1
-rw-r--r--spec/features/user_sorts_things_spec.rb57
-rw-r--r--spec/javascripts/boards/mock_data.js49
-rw-r--r--spec/javascripts/droplab/constants_spec.js16
-rw-r--r--spec/javascripts/notes/mock_data.js863
-rw-r--r--spec/javascripts/pipelines/graph/mock_data.js467
-rw-r--r--spec/javascripts/sidebar/confidential_issue_sidebar_spec.js18
-rw-r--r--spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js18
-rw-r--r--spec/javascripts/sidebar/mock_data.js59
-rw-r--r--spec/javascripts/vue_mr_widget/mock_data.js387
-rw-r--r--spec/javascripts/vue_shared/components/mock_data.js2
-rw-r--r--spec/lib/gitlab/git/checksum_spec.rb38
-rw-r--r--spec/lib/gitlab/git/gitmodules_parser_spec.rb3
-rw-r--r--spec/lib/gitlab/http_spec.rb6
-rw-r--r--spec/lib/gitlab/metrics/sidekiq_metrics_exporter_spec.rb4
-rw-r--r--spec/lib/gitlab/performance_bar_spec.rb6
-rw-r--r--spec/lib/gitlab/url_blocker_spec.rb12
-rw-r--r--spec/mailers/notify_spec.rb30
-rw-r--r--spec/models/project_spec.rb4
-rw-r--r--spec/requests/api/runner_spec.rb6
-rw-r--r--spec/serializers/discussion_entity_spec.rb2
-rw-r--r--spec/serializers/note_entity_spec.rb50
-rw-r--r--spec/serializers/project_note_entity_spec.rb29
-rw-r--r--spec/services/projects/import_service_spec.rb4
-rw-r--r--spec/services/projects/update_pages_service_spec.rb40
-rw-r--r--spec/support/cookie_helper.rb13
-rw-r--r--spec/support/features/discussion_comments_shared_example.rb19
-rw-r--r--spec/support/features/issuable_slash_commands_shared_examples.rb28
-rw-r--r--spec/support/helpers/features/notes_helpers.rb27
-rw-r--r--spec/support/helpers/features/sorting_helpers.rb26
-rw-r--r--spec/support/login_helpers.rb4
-rw-r--r--spec/support/matchers/issuable_matchers.rb11
-rw-r--r--spec/support/quick_actions_helpers.rb10
-rw-r--r--spec/support/shared_examples/serializers/note_entity_examples.rb42
-rw-r--r--spec/support/sorting_helper.rb18
-rw-r--r--spec/tasks/gitlab/uploads/migrate_rake_spec.rb115
-rw-r--r--spec/uploaders/workers/object_storage/background_move_worker_spec.rb146
-rw-r--r--spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb119
162 files changed, 4063 insertions, 2155 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4890738aa3d..66fbf3fce58 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -266,12 +266,13 @@ package-and-qa:
when: manual
variables:
GIT_STRATEGY: none
+ retry: 0
before_script:
# We need to download the script rather than clone the repo since the
# package-and-qa job will not be able to run when the branch gets
# deleted (when merging the MR).
- apk add --update openssl
- - wget https://gitlab.com/gitlab-org/gitlab-ce/raw/$CI_COMMIT_SHA/scripts/trigger-build-omnibus
+ - wget https://gitlab.com/$CI_PROJECT_PATH/raw/$CI_COMMIT_SHA/scripts/trigger-build-omnibus
- chmod 755 trigger-build-omnibus
script:
- ./trigger-build-omnibus
@@ -618,6 +619,9 @@ karma:
codequality:
<<: *dedicated-no-docs-no-db-pull-cache-job
image: docker:latest
+ # gitlab-org runners set `privileged: false` but we need to have it set to true
+ # since we're using Docker in Docker
+ tags: []
before_script: []
services:
- docker:dind
diff --git a/.gitlab/merge_request_templates/Database Changes.md b/.gitlab/merge_request_templates/Database Changes.md
index 8302b3b30c7..68bc0fd1c7f 100644
--- a/.gitlab/merge_request_templates/Database Changes.md
+++ b/.gitlab/merge_request_templates/Database Changes.md
@@ -33,13 +33,16 @@ When removing columns, tables, indexes or other structures:
## General Checklist
-- [ ] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added, if necessary
-- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
+- [ ] [Changelog entry](https://docs.gitlab.com/ee/development/changelog.html) added, if necessary
+- [ ] [Documentation created/updated](https://docs.gitlab.com/ee/development/doc_styleguide.html)
- [ ] API support added
- [ ] Tests added for this feature/bug
- Review
- [ ] Has been reviewed by Backend
- [ ] Has been reviewed by Database
-- [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
-- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
+- [ ] Conform by the [merge request performance guides](https://docs.gitlab.com/ee/development/merge_request_performance_guidelines.html)
+- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/CONTRIBUTING.md#style-guides)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
+- [ ] Internationalization required/considered
+- [ ] If paid feature, have we considered GitLab.com plan and how it works for groups and is there a design for promoting it to users who aren't on the correct plan
+- [ ] End-to-end tests pass (`package-qa` manual pipeline job)
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION
index 36545ad338e..9188543ea64 100644
--- a/GITALY_SERVER_VERSION
+++ b/GITALY_SERVER_VERSION
@@ -1 +1 @@
-0.92.0
+0.93.0
diff --git a/Gemfile b/Gemfile
index a1e43700260..5eac6d73269 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,7 +6,6 @@ end
gem_versions = {}
gem_versions['activerecord_sane_schema_dumper'] = rails5? ? '1.0' : '0.2'
gem_versions['default_value_for'] = rails5? ? '~> 3.0.5' : '~> 3.0.0'
-gem_versions['html-pipeline'] = rails5? ? '~> 2.6.0' : '~> 1.11.0'
gem_versions['rails'] = rails5? ? '5.0.6' : '4.2.10'
gem_versions['rails-i18n'] = rails5? ? '~> 5.1' : '~> 4.0.9'
# --- The end of special code for migrating to Rails 5.0 ---
@@ -136,7 +135,7 @@ gem 'unf', '~> 0.1.4'
gem 'seed-fu', '~> 2.3.7'
# Markdown and HTML processing
-gem 'html-pipeline', gem_versions['html-pipeline']
+gem 'html-pipeline', '~> 2.7.1'
gem 'deckar01-task_list', '2.0.0'
gem 'gitlab-markup', '~> 1.6.2'
gem 'redcarpet', '~> 3.4'
@@ -310,7 +309,7 @@ end
group :development do
gem 'foreman', '~> 0.84.0'
- gem 'brakeman', '~> 3.6.0', require: false
+ gem 'brakeman', '~> 4.2', require: false
gem 'letter_opener_web', '~> 1.3.0'
gem 'rblineprof', '~> 0.3.6', platform: :mri, require: false
@@ -385,7 +384,7 @@ group :test do
gem 'email_spec', '~> 1.6.0'
gem 'json-schema', '~> 2.8.0'
gem 'webmock', '~> 2.3.2'
- gem 'test_after_commit', '~> 1.1'
+ gem 'test_after_commit', '~> 1.1' unless rails5? # Remove this gem when migrated to rails 5.0. It's been integrated to rails 5.0.
gem 'sham_rack', '~> 1.3.6'
gem 'concurrent-ruby', '~> 1.0.5'
gem 'test-prof', '~> 0.2.5'
diff --git a/Gemfile.lock b/Gemfile.lock
index 5545552f352..55e7bd9492a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -95,7 +95,7 @@ GEM
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
bootstrap_form (2.7.0)
- brakeman (3.6.1)
+ brakeman (4.2.1)
browser (2.2.0)
builder (3.2.3)
bullet (5.5.1)
@@ -399,9 +399,9 @@ GEM
hipchat (1.5.2)
httparty
mimemagic
- html-pipeline (1.11.0)
+ html-pipeline (2.7.1)
activesupport (>= 2)
- nokogiri (~> 1.4)
+ nokogiri (>= 1.4)
html2text (0.2.0)
nokogiri (~> 1.6)
htmlentities (4.3.4)
@@ -1012,7 +1012,7 @@ DEPENDENCIES
binding_of_caller (~> 0.7.2)
bootstrap-sass (~> 3.3.0)
bootstrap_form (~> 2.7.0)
- brakeman (~> 3.6.0)
+ brakeman (~> 4.2)
browser (~> 2.2)
bullet (~> 5.5.0)
bundler-audit (~> 0.5.0)
@@ -1083,7 +1083,7 @@ DEPENDENCIES
hashie-forbidden_attributes
health_check (~> 2.6.0)
hipchat (~> 1.5.0)
- html-pipeline (~> 1.11.0)
+ html-pipeline (~> 2.7.1)
html2text
httparty (~> 0.13.3)
influxdb (~> 0.2)
diff --git a/Gemfile.rails5.lock b/Gemfile.rails5.lock
index 86a22dbe550..ca86861255b 100644
--- a/Gemfile.rails5.lock
+++ b/Gemfile.rails5.lock
@@ -60,7 +60,7 @@ GEM
faraday_middleware-multi_json (~> 0.0)
oauth2 (~> 1.0)
asciidoctor (1.5.6.1)
- asciidoctor-plantuml (0.0.7)
+ asciidoctor-plantuml (0.0.8)
asciidoctor (~> 1.5)
asset_sync (2.2.0)
activemodel (>= 4.1.0)
@@ -144,6 +144,7 @@ GEM
connection_pool (2.2.1)
crack (0.4.3)
safe_yaml (~> 1.0.0)
+ crass (1.0.3)
creole (0.5.0)
css_parser (1.6.0)
addressable
@@ -244,10 +245,11 @@ GEM
builder
excon (~> 0.58)
formatador (~> 0.2)
- fog-google (0.6.0)
+ fog-google (1.3.3)
fog-core
fog-json
fog-xml
+ google-api-client (~> 0.19.1)
fog-json (1.0.2)
fog-core (~> 1.0)
multi_json (~> 1.10)
@@ -289,7 +291,7 @@ GEM
po_to_json (>= 1.0.0)
rails (>= 3.2.0)
gherkin-ruby (0.3.2)
- gitaly-proto (0.88.0)
+ gitaly-proto (0.91.0)
google-protobuf (~> 3.1)
grpc (~> 1.0)
github-linguist (5.3.3)
@@ -484,7 +486,8 @@ GEM
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
- loofah (2.0.3)
+ loofah (2.2.2)
+ crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.0)
mini_mime (>= 0.1.1)
@@ -527,8 +530,8 @@ GEM
omniauth (1.8.1)
hashie (>= 3.4.6, < 3.6.0)
rack (>= 1.6.2, < 3)
- omniauth-auth0 (1.4.2)
- omniauth-oauth2 (~> 1.1)
+ omniauth-auth0 (2.0.0)
+ omniauth-oauth2 (~> 1.4)
omniauth-authentiq (0.3.1)
omniauth-oauth2 (~> 1.3, >= 1.3.1)
omniauth-azure-oauth2 (0.0.9)
@@ -551,6 +554,9 @@ GEM
jwt (>= 1.5)
omniauth (>= 1.1.1)
omniauth-oauth2 (>= 1.5)
+ omniauth-jwt (0.0.2)
+ jwt
+ omniauth (~> 1.1)
omniauth-kerberos (0.3.0)
omniauth-multipassword
timfel-krb5-auth (~> 0.8)
@@ -569,9 +575,9 @@ GEM
ruby-saml (~> 1.7)
omniauth-shibboleth (1.2.1)
omniauth (>= 1.0.0)
- omniauth-twitter (1.2.1)
- json (~> 1.3)
+ omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
+ rack
omniauth_crowd (2.2.3)
activesupport
nokogiri (>= 1.4.4)
@@ -808,7 +814,7 @@ GEM
rubyzip (1.2.1)
rufus-scheduler (3.4.2)
et-orbi (~> 1.0)
- rugged (0.26.0)
+ rugged (0.27.0)
safe_yaml (1.0.4)
sanitize (2.1.0)
nokogiri (>= 1.4.4)
@@ -907,8 +913,6 @@ GEM
sysexits (1.2.0)
temple (0.7.7)
test-prof (0.2.5)
- test_after_commit (1.1.0)
- activerecord (>= 3.2)
text (1.3.1)
thin (1.7.2)
daemons (~> 1.0, >= 1.0.9)
@@ -995,8 +999,8 @@ DEPENDENCIES
akismet (~> 2.0)
allocations (~> 1.0)
asana (~> 0.6.0)
- asciidoctor (~> 1.5.2)
- asciidoctor-plantuml (= 0.0.7)
+ asciidoctor (~> 1.5.6)
+ asciidoctor-plantuml (= 0.0.8)
asset_sync (~> 2.2.0)
attr_encrypted (~> 3.0.0)
awesome_print (~> 1.2.0)
@@ -1044,9 +1048,9 @@ DEPENDENCIES
flipper-active_record (~> 0.13.0)
flipper-active_support_cache_store (~> 0.13.0)
fog-aliyun (~> 0.2.0)
- fog-aws (~> 2.0)
+ fog-aws (~> 2.0.1)
fog-core (~> 1.44)
- fog-google (~> 0.5)
+ fog-google (~> 1.3.3)
fog-local (~> 0.3)
fog-openstack (~> 0.1)
fog-rackspace (~> 0.1.1)
@@ -1058,7 +1062,7 @@ DEPENDENCIES
gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.3)
- gitaly-proto (~> 0.88.0)
+ gitaly-proto (~> 0.91.0)
github-linguist (~> 5.3.3)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-markup (~> 1.6.2)
@@ -1095,7 +1099,7 @@ DEPENDENCIES
license_finder (~> 3.1)
licensee (~> 8.9)
lograge (~> 0.5)
- loofah (~> 2.0.3)
+ loofah (~> 2.2)
mail_room (~> 0.9.1)
method_source (~> 0.8)
minitest (~> 5.7.0)
@@ -1107,19 +1111,20 @@ DEPENDENCIES
oauth2 (~> 1.4)
octokit (~> 4.8)
omniauth (~> 1.8)
- omniauth-auth0 (~> 1.4.1)
+ omniauth-auth0 (~> 2.0.0)
omniauth-authentiq (~> 0.3.1)
omniauth-azure-oauth2 (~> 0.0.9)
omniauth-cas3 (~> 1.1.4)
omniauth-facebook (~> 4.0.0)
omniauth-github (~> 1.1.1)
omniauth-gitlab (~> 1.0.2)
- omniauth-google-oauth2 (~> 0.5.2)
+ omniauth-google-oauth2 (~> 0.5.3)
+ omniauth-jwt (~> 0.0.2)
omniauth-kerberos (~> 0.3.0)
omniauth-oauth2-generic (~> 0.2.2)
omniauth-saml (~> 1.10)
omniauth-shibboleth (~> 1.2.0)
- omniauth-twitter (~> 1.2.0)
+ omniauth-twitter (~> 1.4)
omniauth_crowd (~> 2.2.0)
org-ruby (~> 0.9.12)
peek (~> 1.0.1)
@@ -1169,7 +1174,7 @@ DEPENDENCIES
ruby-prof (~> 0.17.0)
ruby_parser (~> 3.8)
rufus-scheduler (~> 3.4)
- rugged (~> 0.26.0)
+ rugged (~> 0.27)
sanitize (~> 2.0)
sass-rails (~> 5.0.6)
scss_lint (~> 0.56.0)
@@ -1197,7 +1202,6 @@ DEPENDENCIES
state_machines-activerecord (~> 0.5.1)
sys-filesystem (~> 1.1.6)
test-prof (~> 0.2.5)
- test_after_commit (~> 1.1)
thin (~> 1.7.0)
timecop (~> 0.8.0)
toml-rb (~> 1.0.0)
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js
index 6da33a26e58..0e1ca7fe883 100644
--- a/app/assets/javascripts/awards_handler.js
+++ b/app/assets/javascripts/awards_handler.js
@@ -4,7 +4,7 @@ import $ from 'jquery';
import _ from 'underscore';
import Cookies from 'js-cookie';
import { __ } from './locale';
-import { isInIssuePage, isInMRPage, hasVueMRDiscussionsCookie, updateTooltipTitle } from './lib/utils/common_utils';
+import { isInIssuePage, isInMRPage, isInEpicPage, hasVueMRDiscussionsCookie, updateTooltipTitle } from './lib/utils/common_utils';
import flash from './flash';
import axios from './lib/utils/axios_utils';
@@ -300,7 +300,7 @@ class AwardsHandler {
}
isInVueNoteablePage() {
- return isInIssuePage() || this.isVueMRDiscussions();
+ return isInIssuePage() || isInEpicPage() || this.isVueMRDiscussions();
}
getVotesBlock() {
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js
index 0830ebe9e4e..9ff2042475b 100644
--- a/app/assets/javascripts/lib/utils/common_utils.js
+++ b/app/assets/javascripts/lib/utils/common_utils.js
@@ -33,6 +33,7 @@ export const checkPageAndAction = (page, action) => {
export const isInIssuePage = () => checkPageAndAction('issues', 'show');
export const isInMRPage = () => checkPageAndAction('merge_requests', 'show');
+export const isInEpicPage = () => checkPageAndAction('epics', 'show');
export const isInNoteablePage = () => isInIssuePage() || isInMRPage();
export const hasVueMRDiscussionsCookie = () => Cookies.get('vue_mr_discussions');
diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue
index 90dcafd75b7..648fa6ff804 100644
--- a/app/assets/javascripts/notes/components/comment_form.vue
+++ b/app/assets/javascripts/notes/components/comment_form.vue
@@ -99,6 +99,10 @@ export default {
'js-note-target-reopen': !this.isOpen,
};
},
+ supportQuickActions() {
+ // Disable quick actions support for Epics
+ return this.noteableType !== constants.EPIC_NOTEABLE_TYPE;
+ },
markdownDocsPath() {
return this.getNotesData.markdownDocsPath;
},
@@ -355,7 +359,7 @@ Please check your network connection and try again.`;
name="note[note]"
class="note-textarea js-vue-comment-form
js-gfm-input js-autosize markdown-area js-vue-textarea"
- data-supports-quick-actions="true"
+ :data-supports-quick-actions="supportQuickActions"
aria-label="Description"
v-model="note"
ref="textarea"
diff --git a/app/assets/javascripts/notes/components/notes_app.vue b/app/assets/javascripts/notes/components/notes_app.vue
index a90c6d6381d..5bd81c7cad6 100644
--- a/app/assets/javascripts/notes/components/notes_app.vue
+++ b/app/assets/javascripts/notes/components/notes_app.vue
@@ -50,7 +50,11 @@ export default {
...mapGetters(['notes', 'getNotesDataByProp', 'discussionCount']),
noteableType() {
// FIXME -- @fatihacet Get this from JSON data.
- const { ISSUE_NOTEABLE_TYPE, MERGE_REQUEST_NOTEABLE_TYPE } = constants;
+ const { ISSUE_NOTEABLE_TYPE, MERGE_REQUEST_NOTEABLE_TYPE, EPIC_NOTEABLE_TYPE } = constants;
+
+ if (this.noteableData.noteableType === EPIC_NOTEABLE_TYPE) {
+ return EPIC_NOTEABLE_TYPE;
+ }
return this.noteableData.merge_params
? MERGE_REQUEST_NOTEABLE_TYPE
diff --git a/app/assets/javascripts/notes/constants.js b/app/assets/javascripts/notes/constants.js
index f4f407ffd8a..68f8cb1cf1e 100644
--- a/app/assets/javascripts/notes/constants.js
+++ b/app/assets/javascripts/notes/constants.js
@@ -10,6 +10,7 @@ export const CLOSED = 'closed';
export const EMOJI_THUMBSUP = 'thumbsup';
export const EMOJI_THUMBSDOWN = 'thumbsdown';
export const ISSUE_NOTEABLE_TYPE = 'issue';
+export const EPIC_NOTEABLE_TYPE = 'epic';
export const MERGE_REQUEST_NOTEABLE_TYPE = 'merge_request';
export const UNRESOLVE_NOTE_METHOD_NAME = 'delete';
export const RESOLVE_NOTE_METHOD_NAME = 'post';
diff --git a/app/assets/javascripts/notes/index.js b/app/assets/javascripts/notes/index.js
index f90775d0157..e4121f151db 100644
--- a/app/assets/javascripts/notes/index.js
+++ b/app/assets/javascripts/notes/index.js
@@ -12,8 +12,11 @@ document.addEventListener(
data() {
const notesDataset = document.getElementById('js-vue-notes').dataset;
const parsedUserData = JSON.parse(notesDataset.currentUserData);
+ const noteableData = JSON.parse(notesDataset.noteableData);
let currentUserData = {};
+ noteableData.noteableType = notesDataset.noteableType;
+
if (parsedUserData) {
currentUserData = {
id: parsedUserData.id,
@@ -25,7 +28,7 @@ document.addEventListener(
}
return {
- noteableData: JSON.parse(notesDataset.noteableData),
+ noteableData,
currentUserData,
notesData: JSON.parse(notesDataset.notesData),
};
diff --git a/app/assets/javascripts/notes/mixins/noteable.js b/app/assets/javascripts/notes/mixins/noteable.js
index 0da4ff49f08..5bf8216a1f3 100644
--- a/app/assets/javascripts/notes/mixins/noteable.js
+++ b/app/assets/javascripts/notes/mixins/noteable.js
@@ -14,6 +14,8 @@ export default {
return constants.MERGE_REQUEST_NOTEABLE_TYPE;
case 'Issue':
return constants.ISSUE_NOTEABLE_TYPE;
+ case 'Epic':
+ return constants.EPIC_NOTEABLE_TYPE;
default:
return '';
}
diff --git a/app/assets/javascripts/sidebar/components/confidential/confidential_issue_sidebar.vue b/app/assets/javascripts/sidebar/components/confidential/confidential_issue_sidebar.vue
index 8a86c409b62..ceb02309959 100644
--- a/app/assets/javascripts/sidebar/components/confidential/confidential_issue_sidebar.vue
+++ b/app/assets/javascripts/sidebar/components/confidential/confidential_issue_sidebar.vue
@@ -1,59 +1,73 @@
<script>
- import Flash from '../../../flash';
- import editForm from './edit_form.vue';
- import Icon from '../../../vue_shared/components/icon.vue';
- import { __ } from '../../../locale';
+import Flash from '../../../flash';
+import editForm from './edit_form.vue';
+import Icon from '../../../vue_shared/components/icon.vue';
+import { __ } from '../../../locale';
+import eventHub from '../../event_hub';
- export default {
- components: {
- editForm,
- Icon,
+export default {
+ components: {
+ editForm,
+ Icon,
+ },
+ props: {
+ isConfidential: {
+ required: true,
+ type: Boolean,
},
- props: {
- isConfidential: {
- required: true,
- type: Boolean,
- },
- isEditable: {
- required: true,
- type: Boolean,
- },
- service: {
- required: true,
- type: Object,
- },
+ isEditable: {
+ required: true,
+ type: Boolean,
},
- data() {
- return {
- edit: false,
- };
+ service: {
+ required: true,
+ type: Object,
},
- computed: {
- confidentialityIcon() {
- return this.isConfidential ? 'eye-slash' : 'eye';
- },
+ },
+ data() {
+ return {
+ edit: false,
+ };
+ },
+ computed: {
+ confidentialityIcon() {
+ return this.isConfidential ? 'eye-slash' : 'eye';
},
- methods: {
- toggleForm() {
- this.edit = !this.edit;
- },
- updateConfidentialAttribute(confidential) {
- this.service.update('issue', { confidential })
- .then(() => location.reload())
- .catch(() => {
- Flash(__('Something went wrong trying to change the confidentiality of this issue'));
- });
- },
+ },
+ created() {
+ eventHub.$on('closeConfidentialityForm', this.toggleForm);
+ },
+ beforeDestroy() {
+ eventHub.$off('closeConfidentialityForm', this.toggleForm);
+ },
+ methods: {
+ toggleForm() {
+ this.edit = !this.edit;
},
- };
+ updateConfidentialAttribute(confidential) {
+ this.service
+ .update('issue', { confidential })
+ .then(() => location.reload())
+ .catch(() => {
+ Flash(
+ __(
+ 'Something went wrong trying to change the confidentiality of this issue',
+ ),
+ );
+ });
+ },
+ },
+};
</script>
<template>
<div class="block issuable-sidebar-item confidentiality">
- <div class="sidebar-collapsed-icon">
+ <div
+ class="sidebar-collapsed-icon"
+ @click="toggleForm"
+ >
<icon
:name="confidentialityIcon"
- :size="16"
aria-hidden="true"
/>
</div>
@@ -71,7 +85,6 @@
<div class="value sidebar-item-value hide-collapsed">
<editForm
v-if="edit"
- :toggle-form="toggleForm"
:is-confidential="isConfidential"
:update-confidential-attribute="updateConfidentialAttribute"
/>
diff --git a/app/assets/javascripts/sidebar/components/confidential/edit_form.vue b/app/assets/javascripts/sidebar/components/confidential/edit_form.vue
index c569843b05f..3783f71a848 100644
--- a/app/assets/javascripts/sidebar/components/confidential/edit_form.vue
+++ b/app/assets/javascripts/sidebar/components/confidential/edit_form.vue
@@ -1,34 +1,34 @@
<script>
- import editFormButtons from './edit_form_buttons.vue';
- import { s__ } from '../../../locale';
+import editFormButtons from './edit_form_buttons.vue';
+import { s__ } from '../../../locale';
- export default {
- components: {
- editFormButtons,
+export default {
+ components: {
+ editFormButtons,
+ },
+ props: {
+ isConfidential: {
+ required: true,
+ type: Boolean,
},
- props: {
- isConfidential: {
- required: true,
- type: Boolean,
- },
- toggleForm: {
- required: true,
- type: Function,
- },
- updateConfidentialAttribute: {
- required: true,
- type: Function,
- },
+ updateConfidentialAttribute: {
+ required: true,
+ type: Function,
},
- computed: {
- confidentialityOnWarning() {
- return s__('confidentiality|You are going to turn on the confidentiality. This means that only team members with <strong>at least Reporter access</strong> are able to see and leave comments on the issue.');
- },
- confidentialityOffWarning() {
- return s__('confidentiality|You are going to turn off the confidentiality. This means <strong>everyone</strong> will be able to see and leave a comment on this issue.');
- },
+ },
+ computed: {
+ confidentialityOnWarning() {
+ return s__(
+ 'confidentiality|You are going to turn on the confidentiality. This means that only team members with <strong>at least Reporter access</strong> are able to see and leave comments on the issue.',
+ );
},
- };
+ confidentialityOffWarning() {
+ return s__(
+ 'confidentiality|You are going to turn off the confidentiality. This means <strong>everyone</strong> will be able to see and leave a comment on this issue.',
+ );
+ },
+ },
+};
</script>
<template>
@@ -45,7 +45,6 @@
</p>
<edit-form-buttons
:is-confidential="isConfidential"
- :toggle-form="toggleForm"
:update-confidential-attribute="updateConfidentialAttribute"
/>
</div>
diff --git a/app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue b/app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue
index 49d5dfeea1a..38b1ddbfd5b 100644
--- a/app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue
+++ b/app/assets/javascripts/sidebar/components/confidential/edit_form_buttons.vue
@@ -1,14 +1,13 @@
<script>
+import $ from 'jquery';
+import eventHub from '../../event_hub';
+
export default {
props: {
isConfidential: {
required: true,
type: Boolean,
},
- toggleForm: {
- required: true,
- type: Function,
- },
updateConfidentialAttribute: {
required: true,
type: Function,
@@ -22,6 +21,16 @@ export default {
return !this.isConfidential;
},
},
+ methods: {
+ closeForm() {
+ eventHub.$emit('closeConfidentialityForm');
+ $(this.$el).trigger('hidden.gl.dropdown');
+ },
+ submitForm() {
+ this.closeForm();
+ this.updateConfidentialAttribute(this.updateConfidentialBool);
+ },
+ },
};
</script>
@@ -30,14 +39,14 @@ export default {
<button
type="button"
class="btn btn-default append-right-10"
- @click="toggleForm"
+ @click="closeForm"
>
{{ __('Cancel') }}
</button>
<button
type="button"
class="btn btn-close"
- @click.prevent="updateConfidentialAttribute(updateConfidentialBool)"
+ @click.prevent="submitForm"
>
{{ toggleButtonText }}
</button>
diff --git a/app/assets/javascripts/sidebar/components/lock/edit_form.vue b/app/assets/javascripts/sidebar/components/lock/edit_form.vue
index bc32e974bc3..e1e4715826a 100644
--- a/app/assets/javascripts/sidebar/components/lock/edit_form.vue
+++ b/app/assets/javascripts/sidebar/components/lock/edit_form.vue
@@ -1,40 +1,43 @@
<script>
- import editFormButtons from './edit_form_buttons.vue';
- import issuableMixin from '../../../vue_shared/mixins/issuable';
- import { __, sprintf } from '../../../locale';
+import editFormButtons from './edit_form_buttons.vue';
+import issuableMixin from '../../../vue_shared/mixins/issuable';
+import { __, sprintf } from '../../../locale';
- export default {
- components: {
- editFormButtons,
+export default {
+ components: {
+ editFormButtons,
+ },
+ mixins: [issuableMixin],
+ props: {
+ isLocked: {
+ required: true,
+ type: Boolean,
},
- mixins: [
- issuableMixin,
- ],
- props: {
- isLocked: {
- required: true,
- type: Boolean,
- },
- toggleForm: {
- required: true,
- type: Function,
- },
-
- updateLockedAttribute: {
- required: true,
- type: Function,
- },
+ updateLockedAttribute: {
+ required: true,
+ type: Function,
+ },
+ },
+ computed: {
+ lockWarning() {
+ return sprintf(
+ __(
+ 'Lock this %{issuableDisplayName}? Only <strong>project members</strong> will be able to comment.',
+ ),
+ { issuableDisplayName: this.issuableDisplayName },
+ );
},
- computed: {
- lockWarning() {
- return sprintf(__('Lock this %{issuableDisplayName}? Only <strong>project members</strong> will be able to comment.'), { issuableDisplayName: this.issuableDisplayName });
- },
- unlockWarning() {
- return sprintf(__('Unlock this %{issuableDisplayName}? <strong>Everyone</strong> will be able to comment.'), { issuableDisplayName: this.issuableDisplayName });
- },
+ unlockWarning() {
+ return sprintf(
+ __(
+ 'Unlock this %{issuableDisplayName}? <strong>Everyone</strong> will be able to comment.',
+ ),
+ { issuableDisplayName: this.issuableDisplayName },
+ );
},
- };
+ },
+};
</script>
<template>
@@ -54,7 +57,6 @@
<edit-form-buttons
:is-locked="isLocked"
- :toggle-form="toggleForm"
:update-locked-attribute="updateLockedAttribute"
/>
</div>
diff --git a/app/assets/javascripts/sidebar/components/lock/edit_form_buttons.vue b/app/assets/javascripts/sidebar/components/lock/edit_form_buttons.vue
index c3a553a7605..5e7b8f9698f 100644
--- a/app/assets/javascripts/sidebar/components/lock/edit_form_buttons.vue
+++ b/app/assets/javascripts/sidebar/components/lock/edit_form_buttons.vue
@@ -1,4 +1,7 @@
<script>
+import $ from 'jquery';
+import eventHub from '../../event_hub';
+
export default {
props: {
isLocked: {
@@ -6,11 +9,6 @@ export default {
type: Boolean,
},
- toggleForm: {
- required: true,
- type: Function,
- },
-
updateLockedAttribute: {
required: true,
type: Function,
@@ -26,6 +24,17 @@ export default {
return !this.isLocked;
},
},
+
+ methods: {
+ closeForm() {
+ eventHub.$emit('closeLockForm');
+ $(this.$el).trigger('hidden.gl.dropdown');
+ },
+ submitForm() {
+ this.closeForm();
+ this.updateLockedAttribute(this.toggleLock);
+ },
+ },
};
</script>
@@ -34,7 +43,7 @@ export default {
<button
type="button"
class="btn btn-default append-right-10"
- @click="toggleForm"
+ @click="closeForm"
>
{{ __('Cancel') }}
</button>
@@ -42,7 +51,7 @@ export default {
<button
type="button"
class="btn btn-close"
- @click.prevent="updateLockedAttribute(toggleLock)"
+ @click.prevent="submitForm"
>
{{ buttonText }}
</button>
diff --git a/app/assets/javascripts/sidebar/components/lock/lock_issue_sidebar.vue b/app/assets/javascripts/sidebar/components/lock/lock_issue_sidebar.vue
index 0686910fc7e..e4893451af3 100644
--- a/app/assets/javascripts/sidebar/components/lock/lock_issue_sidebar.vue
+++ b/app/assets/javascripts/sidebar/components/lock/lock_issue_sidebar.vue
@@ -1,70 +1,93 @@
<script>
- import Flash from '~/flash';
- import editForm from './edit_form.vue';
- import issuableMixin from '../../../vue_shared/mixins/issuable';
- import Icon from '../../../vue_shared/components/icon.vue';
+import Flash from '~/flash';
+import editForm from './edit_form.vue';
+import issuableMixin from '../../../vue_shared/mixins/issuable';
+import Icon from '../../../vue_shared/components/icon.vue';
+import eventHub from '../../event_hub';
- export default {
- components: {
- editForm,
- Icon,
- },
- mixins: [
- issuableMixin,
- ],
+export default {
+ components: {
+ editForm,
+ Icon,
+ },
+ mixins: [issuableMixin],
- props: {
- isLocked: {
- required: true,
- type: Boolean,
- },
+ props: {
+ isLocked: {
+ required: true,
+ type: Boolean,
+ },
- isEditable: {
- required: true,
- type: Boolean,
- },
+ isEditable: {
+ required: true,
+ type: Boolean,
+ },
- mediator: {
- required: true,
- type: Object,
- validator(mediatorObject) {
- return mediatorObject.service && mediatorObject.service.update && mediatorObject.store;
- },
+ mediator: {
+ required: true,
+ type: Object,
+ validator(mediatorObject) {
+ return (
+ mediatorObject.service &&
+ mediatorObject.service.update &&
+ mediatorObject.store
+ );
},
},
+ },
- computed: {
- lockIcon() {
- return this.isLocked ? 'lock' : 'lock-open';
- },
+ computed: {
+ lockIcon() {
+ return this.isLocked ? 'lock' : 'lock-open';
+ },
- isLockDialogOpen() {
- return this.mediator.store.isLockDialogOpen;
- },
+ isLockDialogOpen() {
+ return this.mediator.store.isLockDialogOpen;
},
+ },
- methods: {
- toggleForm() {
- this.mediator.store.isLockDialogOpen = !this.mediator.store.isLockDialogOpen;
- },
+ created() {
+ eventHub.$on('closeLockForm', this.toggleForm);
+ },
+
+ beforeDestroy() {
+ eventHub.$off('closeLockForm', this.toggleForm);
+ },
- updateLockedAttribute(locked) {
- this.mediator.service.update(this.issuableType, {
+ methods: {
+ toggleForm() {
+ this.mediator.store.isLockDialogOpen = !this.mediator.store
+ .isLockDialogOpen;
+ },
+
+ updateLockedAttribute(locked) {
+ this.mediator.service
+ .update(this.issuableType, {
discussion_locked: locked,
})
.then(() => location.reload())
- .catch(() => Flash(this.__(`Something went wrong trying to change the locked state of this ${this.issuableDisplayName}`)));
- },
+ .catch(() =>
+ Flash(
+ this.__(
+ `Something went wrong trying to change the locked state of this ${
+ this.issuableDisplayName
+ }`,
+ ),
+ ),
+ );
},
- };
+ },
+};
</script>
<template>
<div class="block issuable-sidebar-item lock">
- <div class="sidebar-collapsed-icon">
+ <div
+ class="sidebar-collapsed-icon"
+ @click="toggleForm"
+ >
<icon
:name="lockIcon"
- :size="16"
aria-hidden="true"
class="sidebar-item-icon is-active"
/>
@@ -85,7 +108,6 @@
<div class="value sidebar-item-value hide-collapsed">
<edit-form
v-if="isLockDialogOpen"
- :toggle-form="toggleForm"
:is-locked="isLocked"
:update-locked-attribute="updateLockedAttribute"
:issuable-type="issuableType"
diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss
index 3dd4a613789..798f248dad4 100644
--- a/app/assets/stylesheets/framework/sidebar.scss
+++ b/app/assets/stylesheets/framework/sidebar.scss
@@ -88,7 +88,6 @@
.right-sidebar {
border-left: 1px solid $border-color;
- height: calc(100% - #{$header-height});
}
.with-performance-bar .right-sidebar.affix {
diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss
index e21a9f0afc9..2c0ed976301 100644
--- a/app/assets/stylesheets/pages/issuable.scss
+++ b/app/assets/stylesheets/pages/issuable.scss
@@ -522,10 +522,6 @@
.with-performance-bar .right-sidebar {
top: $header-height + $performance-bar-height;
-
- .issuable-sidebar {
- height: calc(100% - #{$performance-bar-height});
- }
}
.sidebar-move-issue-confirmation-button {
diff --git a/app/assets/stylesheets/pages/repo.scss b/app/assets/stylesheets/pages/repo.scss
index 96e781146a7..1f6f7138e1f 100644
--- a/app/assets/stylesheets/pages/repo.scss
+++ b/app/assets/stylesheets/pages/repo.scss
@@ -19,7 +19,7 @@
.ide-view {
display: flex;
height: calc(100vh - #{$header-height});
- margin-top: 40px;
+ margin-top: 0;
border-top: 1px solid $white-dark;
border-bottom: 1px solid $white-dark;
@@ -457,6 +457,8 @@
display: flex;
flex-direction: column;
flex: 1;
+ max-height: 100%;
+ overflow: auto;
}
.multi-file-commit-empty-state-container {
@@ -467,7 +469,7 @@
.multi-file-commit-panel-header {
display: flex;
align-items: center;
- margin-bottom: 12px;
+ margin-bottom: 0;
border-bottom: 1px solid $white-dark;
padding: $gl-btn-padding 0;
@@ -674,8 +676,14 @@
overflow: hidden;
&.nav-only {
+ padding-top: $header-height;
+
+ .with-performance-bar & {
+ padding-top: $header-height + $performance-bar-height;
+ }
+
.flash-container {
- margin-top: $header-height;
+ margin-top: 0;
margin-bottom: 0;
}
@@ -685,7 +693,7 @@
}
.content-wrapper {
- margin-top: $header-height;
+ margin-top: 0;
padding-bottom: 0;
}
@@ -709,11 +717,11 @@
.with-performance-bar .ide.nav-only {
.flash-container {
- margin-top: #{$header-height + $performance-bar-height};
+ margin-top: 0;
}
.content-wrapper {
- margin-top: #{$header-height + $performance-bar-height};
+ margin-top: 0;
padding-bottom: 0;
}
@@ -722,10 +730,6 @@
}
&.flash-shown {
- .content-wrapper {
- margin-top: 0;
- }
-
.ide-view {
height: calc(100vh - #{$header-height + $performance-bar-height + $flash-height});
}
diff --git a/app/assets/stylesheets/pages/repo.scss.orig b/app/assets/stylesheets/pages/repo.scss.orig
new file mode 100644
index 00000000000..57b995adb64
--- /dev/null
+++ b/app/assets/stylesheets/pages/repo.scss.orig
@@ -0,0 +1,786 @@
+.project-refs-form,
+.project-refs-target-form {
+ display: inline-block;
+}
+
+.fade-enter,
+.fade-leave-to {
+ opacity: 0;
+}
+
+.commit-message {
+ @include str-truncated(250px);
+}
+
+.editable-mode {
+ display: inline-block;
+}
+
+.ide-view {
+ display: flex;
+ height: calc(100vh - #{$header-height});
+ margin-top: 40px;
+ color: $almost-black;
+ border-top: 1px solid $white-dark;
+ border-bottom: 1px solid $white-dark;
+
+ &.is-collapsed {
+ .ide-file-list {
+ max-width: 250px;
+ }
+ }
+
+ .file-status-icon {
+ width: 10px;
+ height: 10px;
+ }
+}
+
+.ide-file-list {
+ flex: 1;
+
+ .file {
+ cursor: pointer;
+
+ &.file-open {
+ background: $white-normal;
+ }
+
+ .ide-file-name {
+ flex: 1;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+
+ svg {
+ vertical-align: middle;
+ margin-right: 2px;
+ }
+
+ .loading-container {
+ margin-right: 4px;
+ display: inline-block;
+ }
+ }
+
+ .ide-file-changed-icon {
+ margin-left: auto;
+ }
+
+ .ide-new-btn {
+ display: none;
+ margin-bottom: -4px;
+ margin-right: -8px;
+ }
+
+ &:hover {
+ .ide-new-btn {
+ display: block;
+ }
+ }
+
+ &.folder {
+ svg {
+ fill: $gl-text-color-secondary;
+ }
+ }
+ }
+
+ a {
+ color: $gl-text-color;
+ }
+
+ th {
+ position: sticky;
+ top: 0;
+ }
+}
+
+.file-name,
+.file-col-commit-message {
+ display: flex;
+ overflow: visible;
+ padding: 6px 12px;
+}
+
+.multi-file-loading-container {
+ margin-top: 10px;
+ padding: 10px;
+
+ .animation-container {
+ background: $gray-light;
+
+ div {
+ background: $gray-light;
+ }
+ }
+}
+
+.multi-file-table-col-commit-message {
+ white-space: nowrap;
+ width: 50%;
+}
+
+.multi-file-edit-pane {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ border-left: 1px solid $white-dark;
+ overflow: hidden;
+}
+
+.multi-file-tabs {
+ display: flex;
+ background-color: $white-normal;
+ box-shadow: inset 0 -1px $white-dark;
+
+ > ul {
+ display: flex;
+ overflow-x: auto;
+ }
+
+ li {
+ position: relative;
+ }
+
+ .dropdown {
+ display: flex;
+ margin-left: auto;
+ margin-bottom: 1px;
+ padding: 0 $grid-size;
+ border-left: 1px solid $white-dark;
+ background-color: $white-light;
+
+ &.shadow {
+ box-shadow: 0 0 10px $dropdown-shadow-color;
+ }
+
+ .btn {
+ margin-top: auto;
+ margin-bottom: auto;
+ }
+ }
+}
+
+.multi-file-tab {
+ @include str-truncated(150px);
+ padding: ($gl-padding / 2) ($gl-padding + 12) ($gl-padding / 2) $gl-padding;
+ background-color: $gray-normal;
+ border-right: 1px solid $white-dark;
+ border-bottom: 1px solid $white-dark;
+ cursor: pointer;
+
+ svg {
+ vertical-align: middle;
+ }
+
+ &.active {
+ background-color: $white-light;
+ border-bottom-color: $white-light;
+ }
+}
+
+.multi-file-tab-close {
+ position: absolute;
+ right: 8px;
+ top: 50%;
+ width: 16px;
+ height: 16px;
+ padding: 0;
+ background: none;
+ border: 0;
+ border-radius: $border-radius-default;
+ color: $theme-gray-900;
+ transform: translateY(-50%);
+
+ svg {
+ position: relative;
+ top: -1px;
+ }
+
+ &:hover {
+ background-color: $theme-gray-200;
+ }
+
+ &:focus {
+ background-color: $blue-500;
+ color: $white-light;
+ outline: 0;
+
+ svg {
+ fill: currentColor;
+ }
+ }
+}
+
+.multi-file-edit-pane-content {
+ flex: 1;
+ height: 0;
+}
+
+.blob-editor-container {
+ flex: 1;
+ height: 0;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+
+ .vertical-center {
+ min-height: auto;
+ }
+
+ .monaco-editor .lines-content .cigr {
+ display: none;
+ }
+
+ .monaco-diff-editor.vs {
+ .editor.modified {
+ box-shadow: none;
+ }
+
+ .diagonal-fill {
+ display: none !important;
+ }
+
+ .diffOverview {
+ background-color: $white-light;
+ border-left: 1px solid $white-dark;
+ cursor: ns-resize;
+ }
+
+ .diffViewport {
+ display: none;
+ }
+
+ .char-insert {
+ background-color: $line-added-dark;
+ }
+
+ .char-delete {
+ background-color: $line-removed-dark;
+ }
+
+ .line-numbers {
+ color: $black-transparent;
+ }
+
+ .view-overlays {
+ .line-insert {
+ background-color: $line-added;
+ }
+
+ .line-delete {
+ background-color: $line-removed;
+ }
+ }
+
+ .margin {
+ background-color: $gray-light;
+ border-right: 1px solid $white-normal;
+
+ .line-insert {
+ border-right: 1px solid $line-added-dark;
+ }
+
+ .line-delete {
+ border-right: 1px solid $line-removed-dark;
+ }
+ }
+
+ .margin-view-overlays .insert-sign,
+ .margin-view-overlays .delete-sign {
+ opacity: 0.4;
+ }
+
+ .cursors-layer {
+ display: none;
+ }
+ }
+}
+
+.multi-file-editor-holder {
+ height: 100%;
+}
+
+.multi-file-editor-btn-group {
+ padding: $gl-bar-padding $gl-padding;
+ border-top: 1px solid $white-dark;
+ border-bottom: 1px solid $white-dark;
+ background: $white-light;
+}
+
+.ide-status-bar {
+ padding: $gl-bar-padding $gl-padding;
+ background: $white-light;
+ display: flex;
+ justify-content: space-between;
+
+ svg {
+ vertical-align: middle;
+ }
+}
+
+// Not great, but this is to deal with our current output
+.multi-file-preview-holder {
+ height: 100%;
+ overflow: scroll;
+
+ .file-content.code {
+ display: flex;
+
+ i {
+ margin-left: -10px;
+ }
+ }
+
+ .line-numbers {
+ min-width: 50px;
+ }
+
+ .file-content,
+ .line-numbers,
+ .blob-content,
+ .code {
+ min-height: 100%;
+ }
+}
+
+.file-content.blob-no-preview {
+ a {
+ margin-left: auto;
+ margin-right: auto;
+ }
+}
+
+.multi-file-commit-panel {
+ display: flex;
+ position: relative;
+ flex-direction: column;
+ width: 340px;
+ padding: 0;
+ background-color: $gray-light;
+ padding-right: 3px;
+
+ .projects-sidebar {
+ display: flex;
+ flex-direction: column;
+
+ .context-header {
+ width: auto;
+ margin-right: 0;
+ }
+ }
+
+ .multi-file-commit-panel-inner {
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ }
+
+ .multi-file-commit-panel-inner-scroll {
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ overflow: auto;
+ }
+
+ &.is-collapsed {
+ width: 60px;
+
+ .multi-file-commit-list {
+ padding-top: $gl-padding;
+ overflow: hidden;
+ }
+
+ .multi-file-context-bar-icon {
+ align-items: center;
+
+ svg {
+ float: none;
+ margin: 0;
+ }
+ }
+ }
+
+ .branch-container {
+ border-left: 4px solid $indigo-700;
+ margin-bottom: $gl-bar-padding;
+ }
+
+ .branch-header {
+ background: $white-dark;
+ display: flex;
+ }
+
+ .branch-header-title {
+ flex: 1;
+ padding: $grid-size $gl-padding;
+ color: $indigo-700;
+ font-weight: $gl-font-weight-bold;
+
+ svg {
+ vertical-align: middle;
+ }
+ }
+
+ .branch-header-btns {
+ padding: $gl-vert-padding $gl-padding;
+ }
+
+ .left-collapse-btn {
+ display: none;
+ background: $gray-light;
+ text-align: left;
+ border-top: 1px solid $white-dark;
+
+ svg {
+ vertical-align: middle;
+ }
+ }
+}
+
+.multi-file-context-bar-icon {
+ padding: 10px;
+
+ svg {
+ margin-right: 10px;
+ float: left;
+ }
+}
+
+.multi-file-commit-panel-section {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+}
+
+.multi-file-commit-empty-state-container {
+ align-items: center;
+ justify-content: center;
+}
+
+.multi-file-commit-panel-header {
+ display: flex;
+ align-items: center;
+ margin-bottom: 12px;
+ border-bottom: 1px solid $white-dark;
+ padding: $gl-btn-padding 0;
+
+ &.is-collapsed {
+ border-bottom: 1px solid $white-dark;
+
+ svg {
+ margin-left: auto;
+ margin-right: auto;
+ }
+
+ .multi-file-commit-panel-collapse-btn {
+ margin-right: auto;
+ margin-left: auto;
+ border-left: 0;
+ }
+ }
+}
+
+.multi-file-commit-panel-header-title {
+ display: flex;
+ flex: 1;
+ padding: 0 $gl-btn-padding;
+
+ svg {
+ margin-right: $gl-btn-padding;
+ }
+}
+
+.multi-file-commit-panel-collapse-btn {
+ border-left: 1px solid $white-dark;
+}
+
+.multi-file-commit-list {
+ flex: 1;
+ overflow: auto;
+ padding: $gl-padding 0;
+ min-height: 60px;
+}
+
+.multi-file-commit-list-item {
+ display: flex;
+ padding: 0;
+ align-items: center;
+
+ .multi-file-discard-btn {
+ display: none;
+ margin-left: auto;
+ color: $gl-link-color;
+ padding: 0 2px;
+
+ &:focus,
+ &:hover {
+ text-decoration: underline;
+ }
+ }
+
+ &:hover {
+ background: $white-normal;
+
+ .multi-file-discard-btn {
+ display: block;
+ }
+ }
+}
+
+.multi-file-addition {
+ fill: $green-500;
+}
+
+.multi-file-modified {
+ fill: $orange-500;
+}
+
+.multi-file-commit-list-collapsed {
+ display: flex;
+ flex-direction: column;
+
+ > svg {
+ margin-left: auto;
+ margin-right: auto;
+ }
+
+ .file-status-icon {
+ width: 10px;
+ height: 10px;
+ margin-left: 3px;
+ }
+}
+
+.multi-file-commit-list-path {
+ padding: $grid-size / 2;
+ padding-left: $gl-padding;
+ background: none;
+ border: 0;
+ text-align: left;
+ width: 100%;
+ min-width: 0;
+
+ svg {
+ min-width: 16px;
+ vertical-align: middle;
+ display: inline-block;
+ }
+
+ &:hover,
+ &:focus {
+ outline: 0;
+ }
+}
+
+.multi-file-commit-list-file-path {
+ @include str-truncated(100%);
+
+ &:hover {
+ text-decoration: underline;
+ }
+
+ &:active {
+ text-decoration: none;
+ }
+}
+
+.multi-file-commit-form {
+ padding: $gl-padding;
+ border-top: 1px solid $white-dark;
+
+ .btn {
+ font-size: $gl-font-size;
+ }
+}
+
+.multi-file-commit-message.form-control {
+ height: 160px;
+ resize: none;
+}
+
+.dirty-diff {
+ // !important need to override monaco inline style
+ width: 4px !important;
+ left: 0 !important;
+
+ &-modified {
+ background-color: $blue-500;
+ }
+
+ &-added {
+ background-color: $green-600;
+ }
+
+ &-removed {
+ height: 0 !important;
+ width: 0 !important;
+ bottom: -2px;
+ border-style: solid;
+ border-width: 5px;
+ border-color: transparent transparent transparent $red-500;
+
+ &::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100px;
+ height: 1px;
+ background-color: rgba($red-500, 0.5);
+ }
+ }
+}
+
+.ide-loading {
+ display: flex;
+ height: 100vh;
+ align-items: center;
+ justify-content: center;
+}
+
+.ide-empty-state {
+ display: flex;
+ height: 100vh;
+ align-items: center;
+ justify-content: center;
+}
+
+.ide-new-btn {
+ .dropdown-toggle svg {
+ margin-top: -2px;
+ margin-bottom: 2px;
+ }
+
+ .dropdown-menu {
+ left: auto;
+ right: 0;
+
+ label {
+ font-weight: $gl-font-weight-normal;
+ padding: 5px 8px;
+ margin-bottom: 0;
+ }
+ }
+}
+
+.ide {
+ overflow: hidden;
+
+ &.nav-only {
+ .flash-container {
+ margin-top: $header-height;
+ margin-bottom: 0;
+ }
+
+ .alert-wrapper .flash-container .flash-alert:last-child,
+ .alert-wrapper .flash-container .flash-notice:last-child {
+ margin-bottom: 0;
+ }
+
+ .content-wrapper {
+ margin-top: $header-height;
+ padding-bottom: 0;
+ }
+
+ &.flash-shown {
+ .content-wrapper {
+ margin-top: 0;
+ }
+
+ .ide-view {
+ height: calc(100vh - #{$header-height + $flash-height});
+ }
+ }
+
+ .projects-sidebar {
+ .multi-file-commit-panel-inner-scroll {
+ flex: 1;
+ }
+ }
+ }
+}
+
+.with-performance-bar .ide.nav-only {
+ .flash-container {
+ margin-top: #{$header-height + $performance-bar-height};
+ }
+
+ .content-wrapper {
+ margin-top: #{$header-height + $performance-bar-height};
+ padding-bottom: 0;
+ }
+
+ .ide-view {
+ height: calc(100vh - #{$header-height + $performance-bar-height});
+ }
+
+ &.flash-shown {
+ .content-wrapper {
+ margin-top: 0;
+ }
+
+ .ide-view {
+ height: calc(
+ 100vh - #{$header-height + $performance-bar-height + $flash-height}
+ );
+ }
+ }
+}
+
+.dragHandle {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ width: 3px;
+ background-color: $white-dark;
+
+ &.dragright {
+ right: 0;
+ }
+
+ &.dragleft {
+ left: 0;
+ }
+}
+
+.ide-commit-radios {
+ label {
+ font-weight: normal;
+ }
+
+ .help-block {
+ margin-top: 0;
+ line-height: 0;
+ }
+}
+
+.ide-commit-new-branch {
+ margin-left: 25px;
+}
+
+.ide-external-links {
+ p {
+ margin: 0;
+ }
+}
+
+.ide-sidebar-link {
+ padding: $gl-padding-8 $gl-padding;
+ background: $indigo-700;
+ color: $white-light;
+ text-decoration: none;
+ display: flex;
+ align-items: center;
+
+ &:focus,
+ &:hover {
+ color: $white-light;
+ text-decoration: underline;
+ background: $indigo-500;
+ }
+
+ &:active {
+ background: $indigo-800;
+ }
+}
diff --git a/app/controllers/admin/appearances_controller.rb b/app/controllers/admin/appearances_controller.rb
index dd0b38970bd..ea302f17d16 100644
--- a/app/controllers/admin/appearances_controller.rb
+++ b/app/controllers/admin/appearances_controller.rb
@@ -50,9 +50,19 @@ class Admin::AppearancesController < Admin::ApplicationController
# Only allow a trusted parameter "white list" through.
def appearance_params
- params.require(:appearance).permit(
- :title, :description, :logo, :logo_cache, :header_logo, :header_logo_cache,
- :new_project_guidelines, :updated_by
- )
+ params.require(:appearance).permit(allowed_appearance_params)
+ end
+
+ def allowed_appearance_params
+ %i[
+ title
+ description
+ logo
+ logo_cache
+ header_logo
+ header_logo_cache
+ new_project_guidelines
+ updated_by
+ ]
end
end
diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb
index a21e658fda1..0379f76fc3d 100644
--- a/app/controllers/concerns/issuable_actions.rb
+++ b/app/controllers/concerns/issuable_actions.rb
@@ -88,11 +88,15 @@ module IssuableActions
discussions = Discussion.build_collection(notes, issuable)
- render json: DiscussionSerializer.new(project: project, noteable: issuable, current_user: current_user).represent(discussions, context: self)
+ render json: discussion_serializer.represent(discussions, context: self)
end
private
+ def discussion_serializer
+ DiscussionSerializer.new(project: project, noteable: issuable, current_user: current_user, note_entity: ProjectNoteEntity)
+ end
+
def recaptcha_check_if_spammable(should_redirect = true, &block)
return yield unless issuable.is_a? Spammable
diff --git a/app/controllers/concerns/notes_actions.rb b/app/controllers/concerns/notes_actions.rb
index 03ed5b5310b..839cac3687c 100644
--- a/app/controllers/concerns/notes_actions.rb
+++ b/app/controllers/concerns/notes_actions.rb
@@ -212,7 +212,7 @@ module NotesActions
end
def note_serializer
- NoteSerializer.new(project: project, noteable: noteable, current_user: current_user)
+ ProjectNoteSerializer.new(project: project, noteable: noteable, current_user: current_user)
end
def note_project
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb
index 176679f0849..b7b36f770f5 100644
--- a/app/controllers/projects/branches_controller.rb
+++ b/app/controllers/projects/branches_controller.rb
@@ -22,9 +22,13 @@ class Projects::BranchesController < Projects::ApplicationController
@refs_pipelines = @project.pipelines.latest_successful_for_refs(@branches.map(&:name))
@merged_branch_names = repository.merged_branch_names(@branches.map(&:name))
- @max_commits = @branches.reduce(0) do |memo, branch|
- diverging_commit_counts = repository.diverging_commit_counts(branch)
- [memo, diverging_commit_counts[:behind], diverging_commit_counts[:ahead]].max
+
+ # n+1: https://gitlab.com/gitlab-org/gitaly/issues/992
+ Gitlab::GitalyClient.allow_n_plus_1_calls do
+ @max_commits = @branches.reduce(0) do |memo, branch|
+ diverging_commit_counts = repository.diverging_commit_counts(branch)
+ [memo, diverging_commit_counts[:behind], diverging_commit_counts[:ahead]].max
+ end
end
render
diff --git a/app/controllers/projects/discussions_controller.rb b/app/controllers/projects/discussions_controller.rb
index cba9a53dc4b..7bc16214010 100644
--- a/app/controllers/projects/discussions_controller.rb
+++ b/app/controllers/projects/discussions_controller.rb
@@ -43,7 +43,7 @@ class Projects::DiscussionsController < Projects::ApplicationController
def render_json_with_discussions_serializer
render json:
- DiscussionSerializer.new(project: project, noteable: discussion.noteable, current_user: current_user)
+ DiscussionSerializer.new(project: project, noteable: discussion.noteable, current_user: current_user, note_entity: ProjectNoteEntity)
.represent(discussion, context: self)
end
diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb
index f14cb5f6a9f..a5ea9ff7ed7 100644
--- a/app/controllers/projects/services_controller.rb
+++ b/app/controllers/projects/services_controller.rb
@@ -46,6 +46,8 @@ class Projects::ServicesController < Projects::ApplicationController
else
{ error: true, message: 'Validations failed.', service_response: @service.errors.full_messages.join(',') }
end
+ rescue Gitlab::HTTP::BlockedUrlError => e
+ { error: true, message: 'Test failed.', service_response: e.message }
end
def success_message
diff --git a/app/helpers/appearances_helper.rb b/app/helpers/appearances_helper.rb
index c037de33c22..f48db024e3f 100644
--- a/app/helpers/appearances_helper.rb
+++ b/app/helpers/appearances_helper.rb
@@ -1,27 +1,27 @@
module AppearancesHelper
def brand_title
- brand_item&.title.presence || 'GitLab Community Edition'
+ current_appearance&.title.presence || 'GitLab Community Edition'
end
def brand_image
- image_tag(brand_item.logo) if brand_item&.logo?
+ image_tag(current_appearance.logo) if current_appearance&.logo?
end
def brand_text
- markdown_field(brand_item, :description)
+ markdown_field(current_appearance, :description)
end
def brand_new_project_guidelines
- markdown_field(brand_item, :new_project_guidelines)
+ markdown_field(current_appearance, :new_project_guidelines)
end
- def brand_item
+ def current_appearance
@appearance ||= Appearance.current
end
def brand_header_logo
- if brand_item&.header_logo?
- image_tag brand_item.header_logo
+ if current_appearance&.header_logo?
+ image_tag current_appearance.header_logo
else
render 'shared/logo.svg'
end
@@ -29,7 +29,7 @@ module AppearancesHelper
# Skip the 'GitLab' type logo when custom brand logo is set
def brand_header_logo_type
- unless brand_item&.header_logo?
+ unless current_appearance&.header_logo?
render 'shared/logo_type.svg'
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 701be97ee96..86ec500ceb3 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -285,6 +285,10 @@ module ApplicationHelper
class_names
end
+ # EE feature: System header and footer, unavailable in CE
+ def system_message_class
+ end
+
# Returns active css class when condition returns true
# otherwise returns nil.
#
diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb
index 4ddc1dbed49..c86a26ac30f 100644
--- a/app/helpers/emails_helper.rb
+++ b/app/helpers/emails_helper.rb
@@ -54,9 +54,9 @@ module EmailsHelper
end
def header_logo
- if brand_item && brand_item.header_logo?
+ if current_appearance&.header_logo?
image_tag(
- brand_item.header_logo,
+ current_appearance.header_logo,
style: 'height: 50px'
)
else
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 20aed60cb7a..27ed48fdbc7 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -151,16 +151,17 @@ module NotesHelper
}
end
- def notes_data(issuable)
- discussions_path =
- if issuable.is_a?(Issue)
- discussions_project_issue_path(@project, issuable, format: :json)
- else
- discussions_project_merge_request_path(@project, issuable, format: :json)
- end
+ def discussions_path(issuable)
+ if issuable.is_a?(Issue)
+ discussions_project_issue_path(@project, issuable, format: :json)
+ else
+ discussions_project_merge_request_path(@project, issuable, format: :json)
+ end
+ end
+ def notes_data(issuable)
{
- discussionsPath: discussions_path,
+ discussionsPath: discussions_path(issuable),
registerPath: new_session_path(:user, redirect_to_referer: 'yes', anchor: 'register-pane'),
newSessionPath: new_session_path(:user, redirect_to_referer: 'yes'),
markdownDocsPath: help_page_path('user/markdown'),
@@ -170,7 +171,6 @@ module NotesHelper
notesPath: notes_url,
totalNotes: issuable.discussions.length,
lastFetchedAt: Time.now.to_i
-
}.to_json
end
diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb
index be99f3780cc..b3f2aeb08ca 100644
--- a/app/mailers/emails/merge_requests.rb
+++ b/app/mailers/emails/merge_requests.rb
@@ -15,6 +15,7 @@ module Emails
setup_merge_request_mail(merge_request_id, recipient_id)
@new_commits = new_commits
@existing_commits = existing_commits
+ @updated_by_user = User.find(updated_by_user_id)
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason))
end
diff --git a/app/models/note.rb b/app/models/note.rb
index 787a80f0196..0f5fb529a87 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -379,12 +379,15 @@ class Note < ActiveRecord::Base
def expire_etag_cache
return unless noteable&.discussions_rendered_on_frontend?
- key = Gitlab::Routing.url_helpers.project_noteable_notes_path(
+ Gitlab::EtagCaching::Store.new.touch(etag_key)
+ end
+
+ def etag_key
+ Gitlab::Routing.url_helpers.project_noteable_notes_path(
project,
target_type: noteable_type.underscore,
target_id: noteable_id
)
- Gitlab::EtagCaching::Store.new.touch(key)
end
def touch(*args)
diff --git a/app/serializers/discussion_entity.rb b/app/serializers/discussion_entity.rb
index bbbcf6a97c1..718fb35e62d 100644
--- a/app/serializers/discussion_entity.rb
+++ b/app/serializers/discussion_entity.rb
@@ -4,7 +4,9 @@ class DiscussionEntity < Grape::Entity
expose :id, :reply_id
expose :expanded?, as: :expanded
- expose :notes, using: NoteEntity
+ expose :notes do |discussion, opts|
+ request.note_entity.represent(discussion.notes, opts)
+ end
expose :individual_note?, as: :individual_note
expose :resolvable?, as: :resolvable
@@ -12,7 +14,7 @@ class DiscussionEntity < Grape::Entity
expose :resolve_path, if: -> (d, _) { d.resolvable? } do |discussion|
resolve_project_merge_request_discussion_path(discussion.project, discussion.noteable, discussion.id)
end
- expose :resolve_with_issue_path do |discussion|
+ expose :resolve_with_issue_path, if: -> (d, _) { d.resolvable? } do |discussion|
new_project_issue_path(discussion.project, merge_request_to_resolve_discussions_of: discussion.noteable.iid, discussion_to_resolve: discussion.id)
end
diff --git a/app/serializers/note_entity.rb b/app/serializers/note_entity.rb
index 4ccf0bca476..c964aa9c99b 100644
--- a/app/serializers/note_entity.rb
+++ b/app/serializers/note_entity.rb
@@ -5,10 +5,6 @@ class NoteEntity < API::Entities::Note
expose :author, using: NoteUserEntity
- expose :human_access do |note|
- note.project.team.human_max_access(note.author_id)
- end
-
unexpose :note, as: :body
expose :note
@@ -37,36 +33,10 @@ class NoteEntity < API::Entities::Note
expose :emoji_awardable?, as: :emoji_awardable
expose :award_emoji, if: -> (note, _) { note.emoji_awardable? }, using: AwardEmojiEntity
- expose :toggle_award_path, if: -> (note, _) { note.emoji_awardable? } do |note|
- if note.for_personal_snippet?
- toggle_award_emoji_snippet_note_path(note.noteable, note)
- else
- toggle_award_emoji_project_note_path(note.project, note.id)
- end
- end
expose :report_abuse_path do |note|
new_abuse_report_path(user_id: note.author.id, ref_url: Gitlab::UrlBuilder.build(note))
end
- expose :path do |note|
- if note.for_personal_snippet?
- snippet_note_path(note.noteable, note)
- else
- project_note_path(note.project, note)
- end
- end
-
- expose :resolve_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? } do |note|
- resolve_project_merge_request_discussion_path(note.project, note.noteable, note.discussion_id)
- end
-
- expose :resolve_with_issue_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? } do |note|
- new_project_issue_path(note.project, merge_request_to_resolve_discussions_of: note.noteable.iid, discussion_to_resolve: note.discussion_id)
- end
-
expose :attachment, using: NoteAttachmentEntity, if: -> (note, _) { note.attachment? }
- expose :delete_attachment_path, if: -> (note, _) { note.attachment? } do |note|
- delete_attachment_project_note_path(note.project, note)
- end
end
diff --git a/app/serializers/note_serializer.rb b/app/serializers/note_serializer.rb
deleted file mode 100644
index 2afe40d7a34..00000000000
--- a/app/serializers/note_serializer.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class NoteSerializer < BaseSerializer
- entity NoteEntity
-end
diff --git a/app/serializers/project_note_entity.rb b/app/serializers/project_note_entity.rb
new file mode 100644
index 00000000000..e541bfbee8d
--- /dev/null
+++ b/app/serializers/project_note_entity.rb
@@ -0,0 +1,25 @@
+class ProjectNoteEntity < NoteEntity
+ expose :human_access do |note|
+ note.project.team.human_max_access(note.author_id)
+ end
+
+ expose :toggle_award_path, if: -> (note, _) { note.emoji_awardable? } do |note|
+ toggle_award_emoji_project_note_path(note.project, note.id)
+ end
+
+ expose :path do |note|
+ project_note_path(note.project, note)
+ end
+
+ expose :resolve_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? } do |note|
+ resolve_project_merge_request_discussion_path(note.project, note.noteable, note.discussion_id)
+ end
+
+ expose :resolve_with_issue_path, if: -> (note, _) { note.part_of_discussion? && note.resolvable? } do |note|
+ new_project_issue_path(note.project, merge_request_to_resolve_discussions_of: note.noteable.iid, discussion_to_resolve: note.discussion_id)
+ end
+
+ expose :delete_attachment_path, if: -> (note, _) { note.attachment? } do |note|
+ delete_attachment_project_note_path(note.project, note)
+ end
+end
diff --git a/app/serializers/project_note_serializer.rb b/app/serializers/project_note_serializer.rb
new file mode 100644
index 00000000000..763ad0bdb3f
--- /dev/null
+++ b/app/serializers/project_note_serializer.rb
@@ -0,0 +1,3 @@
+class ProjectNoteSerializer < BaseSerializer
+ entity ProjectNoteEntity
+end
diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb
index a34024f4f80..a3828acc50b 100644
--- a/app/services/projects/import_service.rb
+++ b/app/services/projects/import_service.rb
@@ -28,7 +28,11 @@ module Projects
def add_repository_to_project
if project.external_import? && !unknown_url?
- raise Error, 'Blocked import URL.' if Gitlab::UrlBlocker.blocked_url?(project.import_url, valid_ports: Project::VALID_IMPORT_PORTS)
+ begin
+ Gitlab::UrlBlocker.validate!(project.import_url, valid_ports: Project::VALID_IMPORT_PORTS)
+ rescue Gitlab::UrlBlocker::BlockedUrlError => e
+ raise Error, "Blocked import URL: #{e.message}"
+ end
end
# We should skip the repository for a GitHub import or GitLab project import,
diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb
index 9c8877be14e..7e228d1833d 100644
--- a/app/services/projects/update_pages_service.rb
+++ b/app/services/projects/update_pages_service.rb
@@ -31,15 +31,17 @@ module Projects
# Check if we did extract public directory
archive_public_path = File.join(archive_path, 'public')
- raise FailedToExtractError, 'pages miss the public folder' unless Dir.exist?(archive_public_path)
+ raise InvaildStateError, 'pages miss the public folder' unless Dir.exist?(archive_public_path)
raise InvaildStateError, 'pages are outdated' unless latest?
deploy_page!(archive_public_path)
success
end
- rescue InvaildStateError, FailedToExtractError => e
- register_failure
+ rescue InvaildStateError => e
error(e.message)
+ rescue => e
+ error(e.message, false)
+ raise e
end
private
@@ -50,12 +52,13 @@ module Projects
super
end
- def error(message, http_status = nil)
+ def error(message, allow_delete_artifact = true)
+ register_failure
log_error("Projects::UpdatePagesService: #{message}")
@status.allow_failure = !latest?
@status.description = message
@status.drop(:script_failure)
- delete_artifact!
+ delete_artifact! if allow_delete_artifact
super
end
@@ -76,7 +79,7 @@ module Projects
elsif artifacts.ends_with?('.zip')
extract_zip_archive!(temp_path)
else
- raise FailedToExtractError, 'unsupported artifacts format'
+ raise InvaildStateError, 'unsupported artifacts format'
end
end
@@ -91,13 +94,13 @@ module Projects
end
def extract_zip_archive!(temp_path)
- raise FailedToExtractError, 'missing artifacts metadata' unless build.artifacts_metadata?
+ raise InvaildStateError, 'missing artifacts metadata' unless build.artifacts_metadata?
# Calculate page size after extract
public_entry = build.artifacts_metadata_entry(SITE_PATH, recursive: true)
if public_entry.total_size > max_size
- raise FailedToExtractError, "artifacts for pages are too large: #{public_entry.total_size}"
+ raise InvaildStateError, "artifacts for pages are too large: #{public_entry.total_size}"
end
# Requires UnZip at least 6.00 Info-ZIP.
diff --git a/app/validators/certificate_fingerprint_validator.rb b/app/validators/certificate_fingerprint_validator.rb
new file mode 100644
index 00000000000..17df756183a
--- /dev/null
+++ b/app/validators/certificate_fingerprint_validator.rb
@@ -0,0 +1,9 @@
+class CertificateFingerprintValidator < ActiveModel::EachValidator
+ FINGERPRINT_PATTERN = /\A([a-zA-Z0-9]{2}[\s\-:]?){16,}\z/.freeze
+
+ def validate_each(record, attribute, value)
+ unless value.try(:match, FINGERPRINT_PATTERN)
+ record.errors.add(attribute, "must be a hash containing only letters, numbers, spaces, : and -")
+ end
+ end
+end
diff --git a/app/validators/importable_url_validator.rb b/app/validators/importable_url_validator.rb
index 3ec1594e202..612d3c71913 100644
--- a/app/validators/importable_url_validator.rb
+++ b/app/validators/importable_url_validator.rb
@@ -4,8 +4,8 @@
# protect against Server-side Request Forgery (SSRF).
class ImportableUrlValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
- if Gitlab::UrlBlocker.blocked_url?(value, valid_ports: Project::VALID_IMPORT_PORTS)
- record.errors.add(attribute, "imports are not allowed from that URL")
- end
+ Gitlab::UrlBlocker.validate!(value, valid_ports: Project::VALID_IMPORT_PORTS)
+ rescue Gitlab::UrlBlocker::BlockedUrlError => e
+ record.errors.add(attribute, "is blocked: #{e.message}")
end
end
diff --git a/app/validators/top_level_group_validator.rb b/app/validators/top_level_group_validator.rb
new file mode 100644
index 00000000000..7e2e735e0cf
--- /dev/null
+++ b/app/validators/top_level_group_validator.rb
@@ -0,0 +1,7 @@
+class TopLevelGroupValidator < ActiveModel::EachValidator
+ def validate_each(record, attribute, value)
+ if value&.subgroup?
+ record.errors.add(attribute, "must be a top level Group")
+ end
+ end
+end
diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml
index 257f7326409..6513b719199 100644
--- a/app/views/layouts/devise.html.haml
+++ b/app/views/layouts/devise.html.haml
@@ -1,5 +1,5 @@
!!! 5
-%html.devise-layout-html
+%html.devise-layout-html{ class: system_message_class }
= render "layouts/head"
%body.ui_indigo.login-page.application.navless{ data: { page: body_data_page } }
.page-wrap
@@ -16,7 +16,7 @@
%h1
= brand_title
= brand_image
- - if brand_item&.description?
+ - if current_appearance&.description?
= brand_text
- else
%h3 Open source software to collaborate on code
diff --git a/app/views/layouts/devise_empty.html.haml b/app/views/layouts/devise_empty.html.haml
index 8718bb3db1a..adf90cb7667 100644
--- a/app/views/layouts/devise_empty.html.haml
+++ b/app/views/layouts/devise_empty.html.haml
@@ -1,5 +1,5 @@
!!! 5
-%html{ lang: "en" }
+%html{ lang: "en", class: system_message_class }
= render "layouts/head"
%body.ui_indigo.login-page.application.navless
= render "layouts/header/empty"
diff --git a/app/views/notify/push_to_merge_request_email.html.haml b/app/views/notify/push_to_merge_request_email.html.haml
index 5cc6f21c0f3..4c507c08ed7 100644
--- a/app/views/notify/push_to_merge_request_email.html.haml
+++ b/app/views/notify/push_to_merge_request_email.html.haml
@@ -1,7 +1,7 @@
%h3
- New commits were pushed to the merge request
+ = @updated_by_user.name
+ pushed new commits to merge request
= link_to(@merge_request.to_reference, project_merge_request_url(@merge_request.target_project, @merge_request))
- by #{@current_user.name}
- if @existing_commits.any?
- count = @existing_commits.size
diff --git a/app/views/notify/push_to_merge_request_email.text.haml b/app/views/notify/push_to_merge_request_email.text.haml
index d7722e5f41f..553f771f1a6 100644
--- a/app/views/notify/push_to_merge_request_email.text.haml
+++ b/app/views/notify/push_to_merge_request_email.text.haml
@@ -1,4 +1,4 @@
-New commits were pushed to the merge request #{@merge_request.to_reference} by #{@current_user.name}
+#{@updated_by_user.name} pushed new commits to merge request #{@merge_request.to_reference}
\
#{url_for(project_merge_request_url(@merge_request.target_project, @merge_request))}
\
diff --git a/app/views/projects/_export.html.haml b/app/views/projects/_export.html.haml
index 5dfe973f33c..825bfd0707f 100644
--- a/app/views/projects/_export.html.haml
+++ b/app/views/projects/_export.html.haml
@@ -7,7 +7,7 @@
.settings-header
%h4
Export project
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Export this project with all its related data in order to move your project to a new GitLab instance. Once the export is finished, you can import the file from the "New Project" page.
diff --git a/app/views/projects/clusters/show.html.haml b/app/views/projects/clusters/show.html.haml
index 2ee0eafcf1a..4c510293204 100644
--- a/app/views/projects/clusters/show.html.haml
+++ b/app/views/projects/clusters/show.html.haml
@@ -31,7 +31,7 @@
%section.settings#js-cluster-details{ class: ('expanded' if expanded) }
.settings-header
%h4= s_('ClusterIntegration|Kubernetes cluster details')
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p= s_('ClusterIntegration|See and edit the details for your Kubernetes cluster')
.settings-content
@@ -43,7 +43,7 @@
%section.settings.no-animate#js-cluster-advanced-settings{ class: ('expanded' if expanded) }
.settings-header
%h4= _('Advanced settings')
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p= s_("ClusterIntegration|Advanced options on this Kubernetes cluster's integration")
.settings-content
diff --git a/app/views/projects/deploy_keys/_index.html.haml b/app/views/projects/deploy_keys/_index.html.haml
index 75dd4c9ae15..7dd8dc28e5b 100644
--- a/app/views/projects/deploy_keys/_index.html.haml
+++ b/app/views/projects/deploy_keys/_index.html.haml
@@ -3,7 +3,7 @@
.settings-header
%h4
Deploy Keys
- %button.btn.js-settings-toggle.qa-expand-deploy-keys
+ %button.btn.js-settings-toggle.qa-expand-deploy-keys{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Deploy keys allow read-only or read-write (if enabled) access to your repository. Deploy keys can be used for CI, staging or production servers. You can create a deploy key or add an existing one.
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index a96485ab155..99eeb9551e3 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -8,7 +8,7 @@
.settings-header
%h4
General project settings
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Update your project name, description, avatar, and other general settings.
@@ -64,7 +64,7 @@
.settings-header
%h4
Permissions
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Enable or disable certain project features and choose access levels.
@@ -79,7 +79,7 @@
.settings-header
%h4
Merge request settings
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Customize your merge request restrictions.
@@ -94,7 +94,7 @@
.settings-header
%h4
Advanced settings
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Perform advanced options such as housekeeping, archiving, renaming, transferring, or removing your project.
diff --git a/app/views/projects/protected_branches/shared/_index.html.haml b/app/views/projects/protected_branches/shared/_index.html.haml
index e662b877fbb..55d87c35a80 100644
--- a/app/views/projects/protected_branches/shared/_index.html.haml
+++ b/app/views/projects/protected_branches/shared/_index.html.haml
@@ -4,7 +4,7 @@
.settings-header
%h4
Protected Branches
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Keep stable branches secure and force developers to use merge requests.
diff --git a/app/views/projects/protected_tags/shared/_index.html.haml b/app/views/projects/protected_tags/shared/_index.html.haml
index 24baf1cfc89..c33723d8072 100644
--- a/app/views/projects/protected_tags/shared/_index.html.haml
+++ b/app/views/projects/protected_tags/shared/_index.html.haml
@@ -4,7 +4,7 @@
.settings-header
%h4
Protected Tags
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Limit access to creating and updating tags.
diff --git a/app/views/projects/settings/ci_cd/show.html.haml b/app/views/projects/settings/ci_cd/show.html.haml
index 756f31f91d9..d65341dbd40 100644
--- a/app/views/projects/settings/ci_cd/show.html.haml
+++ b/app/views/projects/settings/ci_cd/show.html.haml
@@ -8,7 +8,7 @@
.settings-header
%h4
General pipelines settings
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Update your CI/CD configuration, like job timeout or Auto DevOps.
@@ -19,7 +19,7 @@
.settings-header
%h4
Runners settings
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Register and see your runners for this project.
@@ -31,7 +31,7 @@
%h4
= _('Secret variables')
= link_to icon('question-circle'), help_page_path('ci/variables/README', anchor: 'secret-variables'), target: '_blank', rel: 'noopener noreferrer'
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p.append-bottom-0
= render "ci/variables/content"
@@ -42,7 +42,7 @@
.settings-header
%h4
Pipeline triggers
- %button.btn.js-settings-toggle
+ %button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Triggers can force a specific branch or tag to get rebuilt with an API call. These tokens will
diff --git a/app/workers/object_storage/migrate_uploads_worker.rb b/app/workers/object_storage/migrate_uploads_worker.rb
index 01ed123e6c8..a6b2c251254 100644
--- a/app/workers/object_storage/migrate_uploads_worker.rb
+++ b/app/workers/object_storage/migrate_uploads_worker.rb
@@ -138,21 +138,18 @@ module ObjectStorage
include Report
- def self.enqueue!(uploads, mounted_as, to_store)
- sanity_check!(uploads, mounted_as)
+ def self.enqueue!(uploads, model_class, mounted_as, to_store)
+ sanity_check!(uploads, model_class, mounted_as)
- perform_async(uploads.ids, mounted_as, to_store)
+ perform_async(uploads.ids, model_class.to_s, mounted_as, to_store)
end
# We need to be sure all the uploads are for the same uploader and model type
# and that the mount point exists if provided.
#
- def self.sanity_check!(uploads, mounted_as)
+ def self.sanity_check!(uploads, model_class, mounted_as)
upload = uploads.first
-
uploader_class = upload.uploader.constantize
- model_class = uploads.first.model_type.constantize
-
uploader_types = uploads.map(&:uploader).uniq
model_types = uploads.map(&:model_type).uniq
model_has_mount = mounted_as.nil? || model_class.uploaders[mounted_as] == uploader_class
@@ -162,7 +159,12 @@ module ObjectStorage
raise(SanityCheckError, "Mount point #{mounted_as} not found in #{model_class}.") unless model_has_mount
end
- def perform(ids, mounted_as, to_store)
+ def perform(*args)
+ args_check!(args)
+
+ (ids, model_type, mounted_as, to_store) = args
+
+ @model_class = model_type.constantize
@mounted_as = mounted_as&.to_sym
@to_store = to_store
@@ -178,7 +180,17 @@ module ObjectStorage
end
def sanity_check!(uploads)
- self.class.sanity_check!(uploads, @mounted_as)
+ self.class.sanity_check!(uploads, @model_class, @mounted_as)
+ end
+
+ def args_check!(args)
+ return if args.count == 4
+
+ case args.count
+ when 3 then raise SanityCheckError, "Job is missing the `model_type` argument."
+ else
+ raise SanityCheckError, "Job has wrong arguments format."
+ end
end
def build_uploaders(uploads)
diff --git a/bin/rspec b/bin/rspec
index 6e6709219af..26583242051 100755
--- a/bin/rspec
+++ b/bin/rspec
@@ -1,4 +1,10 @@
#!/usr/bin/env ruby
+
+# Remove these two lines below when upgraded to rails 5.0.
+# Allow run `rspec` command as `RAILS5=1 rspec ...` instead of `BUNDLE_GEMFILE=Gemfile.rails5 rspec ...`
+gemfile = %w[1 true].include?(ENV["RAILS5"]) ? "Gemfile.rails5" : "Gemfile"
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../#{gemfile}", __dir__)
+
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
diff --git a/changelogs/unreleased/43745-store-metadata-checksum-for-artifacts.yml b/changelogs/unreleased/43745-store-metadata-checksum-for-artifacts.yml
new file mode 100644
index 00000000000..6283e797930
--- /dev/null
+++ b/changelogs/unreleased/43745-store-metadata-checksum-for-artifacts.yml
@@ -0,0 +1,5 @@
+---
+title: Store sha256 checksum of artifact metadata
+merge_request: 18149
+author:
+type: added
diff --git a/changelogs/unreleased/44425-use-gitlab_environment.yml b/changelogs/unreleased/44425-use-gitlab_environment.yml
new file mode 100644
index 00000000000..a774143d5f5
--- /dev/null
+++ b/changelogs/unreleased/44425-use-gitlab_environment.yml
@@ -0,0 +1,5 @@
+---
+title: Fix `gitlab-rake gitlab:two_factor:disable_for_all_users`
+merge_request: 18154
+author:
+type: fixed
diff --git a/changelogs/unreleased/44776-fix-upload-migrate-fails-for-group.yml b/changelogs/unreleased/44776-fix-upload-migrate-fails-for-group.yml
new file mode 100644
index 00000000000..6094fcd0b3e
--- /dev/null
+++ b/changelogs/unreleased/44776-fix-upload-migrate-fails-for-group.yml
@@ -0,0 +1,5 @@
+---
+title: Fixed gitlab:uploads:migrate task failing for Groups' avatar.
+merge_request: 18088
+author:
+type: fixed
diff --git a/changelogs/unreleased/44878-update-brakeman-3-6-1-to-4-2-1.yml b/changelogs/unreleased/44878-update-brakeman-3-6-1-to-4-2-1.yml
new file mode 100644
index 00000000000..f5710cf4f7f
--- /dev/null
+++ b/changelogs/unreleased/44878-update-brakeman-3-6-1-to-4-2-1.yml
@@ -0,0 +1,5 @@
+---
+title: Update brakeman 3.6.1 to 4.2.1
+merge_request: 18122
+author: Takuya Noguchi
+type: other
diff --git a/changelogs/unreleased/44902-remove-rake-test-ci.yml b/changelogs/unreleased/44902-remove-rake-test-ci.yml
new file mode 100644
index 00000000000..459de1c2ca3
--- /dev/null
+++ b/changelogs/unreleased/44902-remove-rake-test-ci.yml
@@ -0,0 +1,5 @@
+---
+title: Remove test_ci rake task
+merge_request: 18139
+author: Takuya Noguchi
+type: other
diff --git a/changelogs/unreleased/blackst0ne-bump-html-pipeline-gem.yml b/changelogs/unreleased/blackst0ne-bump-html-pipeline-gem.yml
new file mode 100644
index 00000000000..9885c8853cc
--- /dev/null
+++ b/changelogs/unreleased/blackst0ne-bump-html-pipeline-gem.yml
@@ -0,0 +1,5 @@
+---
+title: Bump html-pipeline to 2.7.1
+merge_request: 18132
+author: "@blackst0ne"
+type: other
diff --git a/changelogs/unreleased/blackst0ne-replace-spinach-project-issues-issues-feature.yml b/changelogs/unreleased/blackst0ne-replace-spinach-project-issues-issues-feature.yml
new file mode 100644
index 00000000000..7defdc0a28f
--- /dev/null
+++ b/changelogs/unreleased/blackst0ne-replace-spinach-project-issues-issues-feature.yml
@@ -0,0 +1,5 @@
+---
+title: Replace the spinach test with an rspec analog
+merge_request: 17950
+author: blackst0ne
+type: other
diff --git a/changelogs/unreleased/blackst0ne-replace-spinach-project-issues-labels-feature.yml b/changelogs/unreleased/blackst0ne-replace-spinach-project-issues-labels-feature.yml
new file mode 100644
index 00000000000..4e1bb15f150
--- /dev/null
+++ b/changelogs/unreleased/blackst0ne-replace-spinach-project-issues-labels-feature.yml
@@ -0,0 +1,5 @@
+---
+title: Replace the `project/issues/labels.feature` spinach test with an rspec analog
+merge_request: 18126
+author: blackst0ne
+type: other
diff --git a/changelogs/unreleased/sh-move-sidekiq-exporter-logs.yml b/changelogs/unreleased/sh-move-sidekiq-exporter-logs.yml
new file mode 100644
index 00000000000..1990f4f6124
--- /dev/null
+++ b/changelogs/unreleased/sh-move-sidekiq-exporter-logs.yml
@@ -0,0 +1,5 @@
+---
+title: Move Sidekiq exporter logs to log/sidekiq_exporter.log
+merge_request:
+author:
+type: other
diff --git a/changelogs/unreleased/zj-bump-gitaly.yml b/changelogs/unreleased/zj-bump-gitaly.yml
new file mode 100644
index 00000000000..eb28bed70e4
--- /dev/null
+++ b/changelogs/unreleased/zj-bump-gitaly.yml
@@ -0,0 +1,5 @@
+---
+title: Upgrade Gitaly to upgrade its charlock_holmes
+merge_request:
+author:
+type: other
diff --git a/doc/administration/logs.md b/doc/administration/logs.md
index 00a2f3d01b8..cd107a5b39c 100644
--- a/doc/administration/logs.md
+++ b/doc/administration/logs.md
@@ -206,4 +206,12 @@ is populated whenever `gitlab-ctl reconfigure` is run manually or as part of an
Reconfigure logs files are named according to the UNIX timestamp of when the reconfigure
was initiated, such as `1509705644.log`
+## `sidekiq_exporter.log`
+
+If Prometheus metrics and the Sidekiq Exporter are both enabled, Sidekiq will
+start a Web server and listen to the defined port (default: 3807). Access logs
+will be generated in `/var/log/gitlab/gitlab-rails/sidekiq_exporter.log` for
+Omnibus GitLab packages or in `/home/git/gitlab/log/sidekiq_exporter.log` for
+installations from source.
+
[repocheck]: repository_checks.md
diff --git a/doc/api/commits.md b/doc/api/commits.md
index a6b96ba539f..db0a80d04d9 100644
--- a/doc/api/commits.md
+++ b/doc/api/commits.md
@@ -412,9 +412,10 @@ Example response:
Since GitLab 8.1, this is the new commit status API.
-### Get the status of a commit
+### List the statuses of a commit
-Get the statuses of a commit in a project.
+List the statuses of a commit in a project.
+The pagination parameters `page` and `per_page` can be used to restrict the list of references.
```
GET /projects/:id/repository/commits/:sha/statuses
diff --git a/doc/ci/examples/browser_performance.md b/doc/ci/examples/browser_performance.md
index 42dc6ef36ba..691370d7195 100644
--- a/doc/ci/examples/browser_performance.md
+++ b/doc/ci/examples/browser_performance.md
@@ -1,22 +1,28 @@
# Browser Performance Testing with the Sitespeed.io container
-This example shows how to run the [Sitespeed.io container](https://hub.docker.com/r/sitespeedio/sitespeed.io/) on your code by using
-GitLab CI/CD and [Sitespeed.io](https://www.sitespeed.io) using Docker-in-Docker.
+This example shows how to run the
+[Sitespeed.io container](https://hub.docker.com/r/sitespeedio/sitespeed.io/) on
+your code by using GitLab CI/CD and [Sitespeed.io](https://www.sitespeed.io)
+using Docker-in-Docker.
-First, you need a GitLab Runner with the [docker-in-docker executor](../docker/using_docker_build.md#use-docker-in-docker-executor).
-
-Once you set up the Runner, add a new job to `.gitlab-ci.yml`, called `performance`:
+First, you need a GitLab Runner with the
+[docker-in-docker executor](../docker/using_docker_build.md#use-docker-in-docker-executor).
+Once you set up the Runner, add a new job to `.gitlab-ci.yml`, called
+`performance`:
```yaml
+performance:
stage: performance
image: docker:git
+ variables:
+ URL: https://example.com
services:
- docker:dind
script:
- mkdir gitlab-exporter
- - wget -O ./gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/10-5/index.js
+ - wget -O ./gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/master/index.js
- mkdir sitespeed-results
- - docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:6.3.1 --plugins.add ./gitlab-exporter --outputFolder sitespeed-results https://my.website.com
+ - docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:6.3.1 --plugins.add ./gitlab-exporter --outputFolder sitespeed-results $URL
- mv sitespeed-results/data/performance.json performance.json
artifacts:
paths:
@@ -24,37 +30,84 @@ Once you set up the Runner, add a new job to `.gitlab-ci.yml`, called `performan
- sitespeed-results/
```
-This will create a `performance` job in your CI/CD pipeline and will run Sitespeed.io against the webpage you define. The GitLab plugin for Sitespeed.io is downloaded in order to export key metrics to JSON. The full HTML Sitespeed.io report will also be saved as an artifact, and if you have Pages enabled it can be viewed directly in your browser. For further customization options of Sitespeed.io, including the ability to provide a list of URLs to test, please consult their [documentation](https://www.sitespeed.io/documentation/sitespeed.io/configuration/).
+The above example will:
+
+1. Create a `performance` job in your CI/CD pipeline and will run
+ Sitespeed.io against the webpage you defined in `URL`.
+1. The [GitLab plugin](https://gitlab.com/gitlab-org/gl-performance) for
+ Sitespeed.io is downloaded in order to export key metrics to JSON. The full
+ HTML Sitespeed.io report will also be saved as an artifact, and if you have
+ [GitLab Pages](../../user/project/pages/index.md) enabled, it can be viewed
+ directly in your browser.
+
+For further customization options of Sitespeed.io, including the ability to
+provide a list of URLs to test, please consult
+[their documentation](https://www.sitespeed.io/documentation/sitespeed.io/configuration/).
-For [GitLab Premium](https://about.gitlab.com/products/) users, key metrics are automatically
-extracted and shown right in the merge request widget. Learn more about [Browser Performance Testing](https://docs.gitlab.com/ee/user/project/merge_requests/browser_performance_testing.html).
+TIP: **Tip:**
+For [GitLab Premium](https://about.gitlab.com/pricing/) users, key metrics are automatically
+extracted and shown right in the merge request widget. Learn more about
+[Browser Performance Testing](https://docs.gitlab.com/ee/user/project/merge_requests/browser_performance_testing.html).
## Performance testing on Review Apps
-The above CI YML is great for testing against static environments, and it can be extended for dynamic environments. There are a few extra steps to take to set this up:
-1. The `performance` job should run after the environment has started.
-1. In the `deploy` job, persist the hostname so it is available to the `performance` job. The same can be done for static environments like staging and production to unify the code path. Saving it as an artifact is as simple as `echo $CI_ENVIRONMENT_URL > environment_url.txt`.
-1. In the `performance` job read the artifact into an environment variable, like `$CI_ENVIRONMENT_URL`, and use it to parameterize the test URL's.
-1. Now you can run the Sitespeed.io container against the desired hostname and paths.
+The above CI YML is great for testing against static environments, and it can
+be extended for dynamic environments. There are a few extra steps to take to
+set this up:
-A simple `performance` job would look like:
+1. The `performance` job should run after the dynamic environment has started.
+1. In the `review` job, persist the hostname and upload it as an artifact so
+ it's available to the `performance` job (the same can be done for static
+ environments like staging and production to unify the code path). Saving it
+ as an artifact is as simple as `echo $CI_ENVIRONMENT_URL > environment_url.txt`
+ in your job's `script`.
+1. In the `performance` job, read the previous artifact into an environment
+ variable, like `$CI_ENVIRONMENT_URL`, and use it to parameterize the test
+ URLs.
+1. You can now run the Sitespeed.io container against the desired hostname and
+ paths.
+
+Your `.gitlab-ci.yml` file would look like:
```yaml
+stages:
+ - deploy
+ - performance
+
+review:
+ stage: deploy
+ environment:
+ name: review/$CI_COMMIT_REF_SLUG
+ url: http://$CI_COMMIT_REF_SLUG.$APPS_DOMAIN
+ script:
+ - run_deploy_script
+ - echo $CI_ENVIRONMENT_URL > environment_url.txt
+ artifacts:
+ paths:
+ - environment_url.txt
+ only:
+ - branches
+ except:
+ - master
+
+performance:
stage: performance
image: docker:git
services:
- docker:dind
+ dependencies:
+ - review
script:
- export CI_ENVIRONMENT_URL=$(cat environment_url.txt)
- mkdir gitlab-exporter
- - wget -O ./gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/10-5/index.js
+ - wget -O ./gitlab-exporter/index.js https://gitlab.com/gitlab-org/gl-performance/raw/master/index.js
- mkdir sitespeed-results
- docker run --shm-size=1g --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io:6.3.1 --plugins.add ./gitlab-exporter --outputFolder sitespeed-results "$CI_ENVIRONMENT_URL"
- mv sitespeed-results/data/performance.json performance.json
artifacts:
paths:
- - performance.json
- - sitespeed-results/
+ - performance.json
+ - sitespeed-results/
```
-A complete example can be found in our [Auto DevOps CI YML](https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/master/Auto-DevOps.gitlab-ci.yml). \ No newline at end of file
+A complete example can be found in our [Auto DevOps CI YML](https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/master/Auto-DevOps.gitlab-ci.yml).
diff --git a/doc/ci/examples/code_climate.md b/doc/ci/examples/code_climate.md
index 64a759a9a99..92317c77427 100644
--- a/doc/ci/examples/code_climate.md
+++ b/doc/ci/examples/code_climate.md
@@ -9,11 +9,12 @@ Once you set up the Runner, add a new job to `.gitlab-ci.yml`, called `codequali
```yaml
codequality:
- image: docker:latest
+ image: docker:stable
variables:
- DOCKER_DRIVER: overlay
+ DOCKER_DRIVER: overlay2
+ allow_failure: true
services:
- - docker:dind
+ - docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run --env SOURCE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
diff --git a/doc/ci/examples/container_scanning.md b/doc/ci/examples/container_scanning.md
index 3437b63748a..c58efc7392a 100644
--- a/doc/ci/examples/container_scanning.md
+++ b/doc/ci/examples/container_scanning.md
@@ -11,7 +11,7 @@ called `sast:container`:
```yaml
sast:container:
- image: docker:latest
+ image: docker:stable
variables:
DOCKER_DRIVER: overlay2
## Define two new variables based on GitLab's CI/CD predefined variables
@@ -20,7 +20,7 @@ sast:container:
CI_APPLICATION_TAG: $CI_COMMIT_SHA
allow_failure: true
services:
- - docker:dind
+ - docker:stable-dind
script:
- docker run -d --name db arminc/clair-db:latest
- docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.1
diff --git a/doc/ci/examples/dast.md b/doc/ci/examples/dast.md
index 96de0f5ff5c..8df223ee560 100644
--- a/doc/ci/examples/dast.md
+++ b/doc/ci/examples/dast.md
@@ -14,9 +14,10 @@ called `dast`:
```yaml
dast:
- image: owasp/zap2docker-stable
+ image: registry.gitlab.com/gitlab-org/security-products/zaproxy
variables:
website: "https://example.com"
+ allow_failure: true
script:
- mkdir /zap/wrk/
- /zap/zap-baseline.py -J gl-dast-report.json -t $website || true
@@ -30,6 +31,28 @@ the tests on the URL defined in the `website` variable (change it to use your
own) and finally write the results in the `gl-dast-report.json` file. You can
then download and analyze the report artifact in JSON format.
+It's also possible to authenticate the user before performing DAST checks:
+
+```yaml
+dast:
+ image: registry.gitlab.com/gitlab-org/security-products/zaproxy
+ variables:
+ website: "https://example.com"
+ login_url: "https://example.com/sign-in"
+ allow_failure: true
+ script:
+ - mkdir /zap/wrk/
+ - /zap/zap-baseline.py -J gl-dast-report.json -t $website \
+ --auth-url $login_url \
+ --auth-username "john.doe@example.com" \
+ --auth-password "john-doe-password" || true
+ - cp /zap/wrk/gl-dast-report.json .
+ artifacts:
+ paths: [gl-dast-report.json]
+```
+See [zaproxy documentation](https://gitlab.com/gitlab-org/security-products/zaproxy)
+to learn more about authentication settings.
+
TIP: **Tip:**
Starting with [GitLab Ultimate][ee] 10.4, this information will
be automatically extracted and shown right in the merge request widget. To do
diff --git a/doc/ci/pipelines.md b/doc/ci/pipelines.md
index 856d7f264e4..301cccc80a3 100644
--- a/doc/ci/pipelines.md
+++ b/doc/ci/pipelines.md
@@ -2,6 +2,11 @@
> Introduced in GitLab 8.8.
+NOTE: **Note:**
+If you have a [mirrored repository where GitLab pulls from](https://docs.gitlab.com/ee/workflow/repository_mirroring.html#pulling-from-a-remote-repository),
+you may need to enable pipeline triggering in your project's
+**Settings > Repository > Pull from a remote repository > Trigger pipelines for mirror updates**.
+
## Pipelines
A pipeline is a group of [jobs][] that get executed in [stages][](batches).
@@ -121,9 +126,8 @@ The basic requirements is that there are two numbers separated with one of
the following (you can even use them interchangeably):
- a space
-- a forward slash (`/`)
+- a slash (`/`)
- a colon (`:`)
-- a dot (`.`)
>**Note:**
More specifically, [it uses][regexp] this regular expression: `\d+[\s:\/\\]+\d+\s*`.
diff --git a/doc/ci/quick_start/README.md b/doc/ci/quick_start/README.md
index f64e868d390..fec0ff87326 100644
--- a/doc/ci/quick_start/README.md
+++ b/doc/ci/quick_start/README.md
@@ -126,6 +126,11 @@ git push origin master
Now if you go to the **Pipelines** page you will see that the pipeline is
pending.
+NOTE: **Note:**
+If you have a [mirrored repository where GitLab pulls from](https://docs.gitlab.com/ee/workflow/repository_mirroring.html#pulling-from-a-remote-repository),
+you may need to enable pipeline triggering in your project's
+**Settings > Repository > Pull from a remote repository > Trigger pipelines for mirror updates**.
+
You can also go to the **Commits** page and notice the little pause icon next
to the commit SHA.
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md
index 9aa443fa69d..be114e7008e 100644
--- a/doc/ci/yaml/README.md
+++ b/doc/ci/yaml/README.md
@@ -10,6 +10,11 @@ of your repository and contains definitions of how your project should be built.
If you want a quick introduction to GitLab CI, follow our
[quick start guide](../quick_start/README.md).
+NOTE: **Note:**
+If you have a [mirrored repository where GitLab pulls from](https://docs.gitlab.com/ee/workflow/repository_mirroring.html#pulling-from-a-remote-repository),
+you may need to enable pipeline triggering in your project's
+**Settings > Repository > Pull from a remote repository > Trigger pipelines for mirror updates**.
+
## Jobs
The YAML file defines a set of jobs with constraints stating when they should
diff --git a/doc/development/ee_features.md b/doc/development/ee_features.md
index 3ba03d2d591..287143d6255 100644
--- a/doc/development/ee_features.md
+++ b/doc/development/ee_features.md
@@ -644,6 +644,7 @@ information on managing page-specific javascript within EE.
To separate EE-specific styles in SCSS files, if a component you're adding styles for
is limited to only EE, it is better to have a separate SCSS file in appropriate directory
within `app/assets/stylesheets`.
+See [backporting changes](#backporting-changes) for instructions on how to merge changes safely.
In some cases, this is not entirely possible or creating dedicated SCSS file is an overkill,
e.g. a text style of some component is different for EE. In such cases,
@@ -683,6 +684,19 @@ to avoid conflicts during CE to EE merge.
// EE-specific end
```
+### Backporting changes from EE to CE
+
+When working in EE-specific features, you might have to tweak a few files that are not EE-specific. Here is a workflow to make sure those changes end up backported safely into CE too.
+(This approach does not refer to changes introduced via [csslab](https://gitlab.com/gitlab-org/csslab/).)
+
+1. **Make your changes in the EE branch.** If possible, keep a separated commit (to be squashed) to help backporting and review.
+1. **Open merge request to EE project.**
+1. **Apply the changes you made to CE files in a branch of the CE project.** (Tip: Use `patch` with the diff from your commit in EE branch)
+1. **Open merge request to CE project**, referring it's a backport of EE changes and link to MR open in EE.
+1. Once EE MR is merged, the MR towards CE can be merged. **But not before**.
+
+**Note:** regarding SCSS, make sure the files living outside `/ee/` don't diverge between CE and EE projects.
+
## gitlab-svgs
Conflicts in `app/assets/images/icons.json` or `app/assets/images/icons.svg` can
diff --git a/doc/workflow/lfs/lfs_administration.md b/doc/workflow/lfs/lfs_administration.md
index cac3cb599dd..f824756c10c 100644
--- a/doc/workflow/lfs/lfs_administration.md
+++ b/doc/workflow/lfs/lfs_administration.md
@@ -19,7 +19,7 @@ There are various configuration options to help GitLab server administrators:
* Changing the location of LFS object storage
* Setting up AWS S3 compatible object storage
-### Omnibus packages
+### Configuration for Omnibus installations
In `/etc/gitlab/gitlab.rb`:
@@ -33,7 +33,7 @@ gitlab_rails['lfs_enabled'] = false
gitlab_rails['lfs_storage_path'] = "/mnt/storage/lfs-objects"
```
-### Installations from source
+### Configuration for installations from source
In `config/gitlab.yml`:
@@ -44,20 +44,21 @@ In `config/gitlab.yml`:
storage_path: /mnt/storage/lfs-objects
```
-## Setting up S3 compatible object storage
+## Storing the LFS objects in an S3-compatible object storage
-> **Note:** [Introduced][ee-2760] in [GitLab Premium][eep] 10.0.
-> Available in [GitLab CE][ce] 10.7
+> [Introduced][ee-2760] in [GitLab Premium][eep] 10.0. Brought to GitLab Core
+in 10.7.
-It is possible to store LFS objects on remote object storage instead of on a local disk.
+It is possible to store LFS objects on a remote object storage which allows you
+to offload storage to an external AWS S3 compatible service, freeing up disk
+space locally. You can also host your own S3 compatible storage decoupled from
+GitLab, with with a service such as [Minio](https://www.minio.io/).
-This allows you to offload storage to an external AWS S3 compatible service, freeing up disk space locally. You can also host your own S3 compatible storage decoupled from GitLab, with with a service such as [Minio](https://www.minio.io/).
+Object storage currently transfers files first to GitLab, and then on the
+object storage in a second stage. This can be done either by using a rake task
+to transfer existing objects, or in a background job after each file is received.
-Object storage currently transfers files first to GitLab, and then on the object storage in a second stage. This can be done either by using a rake task to transfer existing objects, or in a background job after each file is received.
-
-### Object Storage Settings
-
-For source installations the following settings are nested under `lfs:` and then `object_store:`. On omnibus installs they are prefixed by `lfs_object_store_`.
+The following general settings are supported.
| Setting | Description | Default |
|---------|-------------|---------|
@@ -68,9 +69,7 @@ For source installations the following settings are nested under `lfs:` and then
| `proxy_download` | Set to true to enable proxying all files served. Option allows to reduce egress traffic as this allows clients to download directly from remote storage instead of proxying all data | `false` |
| `connection` | Various connection options described below | |
-#### S3 compatible connection settings
-
-The connection settings match those provided by [Fog](https://github.com/fog), and are as follows:
+The `connection` settings match those provided by [Fog](https://github.com/fog).
| Setting | Description | Default |
|---------|-------------|---------|
@@ -82,8 +81,43 @@ The connection settings match those provided by [Fog](https://github.com/fog), a
| `endpoint` | Can be used when configuring an S3 compatible service such as [Minio](https://www.minio.io), by entering a URL such as `http://127.0.0.1:9000` | (optional) |
| `path_style` | Set to true to use `host/bucket_name/object` style paths instead of `bucket_name.host/object`. Leave as false for AWS S3 | false |
+### S3 for Omnibus installations
+
+On Omnibus installations, the settings are prefixed by `lfs_object_store_`:
+
+1. Edit `/etc/gitlab/gitlab.rb` and add the following lines by replacing with
+ the values you want:
+
+ ```ruby
+ gitlab_rails['lfs_object_store_enabled'] = true
+ gitlab_rails['lfs_object_store_remote_directory'] = "lfs-objects"
+ gitlab_rails['lfs_object_store_connection'] = {
+ 'provider' => 'AWS',
+ 'region' => 'eu-central-1',
+ 'aws_access_key_id' => '1ABCD2EFGHI34JKLM567N',
+ 'aws_secret_access_key' => 'abcdefhijklmnopQRSTUVwxyz0123456789ABCDE',
+ # The below options configure an S3 compatible host instead of AWS
+ 'host' => 'localhost',
+ 'endpoint' => 'http://127.0.0.1:9000',
+ 'path_style' => true
+ }
+ ```
+
+1. Save the file and [reconfigure GitLab]s for the changes to take effect.
+1. Migrate any existing local LFS objects to the object storage:
+
+ ```bash
+ gitlab-rake gitlab:lfs:migrate
+ ```
+
+ This will migrate existing LFS objects to object storage. New LFS objects
+ will be forwarded to object storage unless
+ `gitlab_rails['lfs_object_store_background_upload']` is set to false.
-### From source
+### S3 for installations from source
+
+For source installations the settings are nested under `lfs:` and then
+`object_store:`:
1. Edit `/home/git/gitlab/config/gitlab.yml` and add or amend the following
lines:
@@ -108,44 +142,13 @@ The connection settings match those provided by [Fog](https://github.com/fog), a
1. Save the file and [restart GitLab][] for the changes to take effect.
1. Migrate any existing local LFS objects to the object storage:
- ```bash
- sudo -u git -H bundle exec rake gitlab:lfs:migrate RAILS_ENV=production
- ```
-
- This will migrate existing LFS objects to object storage. New LFS objects
- will be forwarded to object storage unless
- `gitlab_rails['lfs_object_store_background_upload']` is set to false.
-
-### In Omnibus
-
-1. Edit `/etc/gitlab/gitlab.rb` and add the following lines by replacing with
- the values you want:
-
- ```ruby
- gitlab_rails['lfs_object_store_enabled'] = true
- gitlab_rails['lfs_object_store_remote_directory'] = "lfs-objects"
- gitlab_rails['lfs_object_store_connection'] = {
- 'provider' => 'AWS',
- 'region' => 'eu-central-1',
- 'aws_access_key_id' => '1ABCD2EFGHI34JKLM567N',
- 'aws_secret_access_key' => 'abcdefhijklmnopQRSTUVwxyz0123456789ABCDE',
- # The below options configure an S3 compatible host instead of AWS
- 'host' => 'localhost',
- 'endpoint' => 'http://127.0.0.1:9000',
- 'path_style' => true
- }
- ```
-
-1. Save the file and [reconfigure GitLab]s for the changes to take effect.
-1. Migrate any existing local LFS objects to the object storage:
-
- ```bash
- gitlab-rake gitlab:lfs:migrate
- ```
+ ```bash
+ sudo -u git -H bundle exec rake gitlab:lfs:migrate RAILS_ENV=production
+ ```
- This will migrate existing LFS objects to object storage. New LFS objects
- will be forwarded to object storage unless
- `gitlab_rails['lfs_object_store_background_upload']` is set to false.
+ This will migrate existing LFS objects to object storage. New LFS objects
+ will be forwarded to object storage unless `background_upload` is set to
+ false.
## Storage statistics
diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature
deleted file mode 100644
index 819354bb780..00000000000
--- a/features/project/issues/issues.feature
+++ /dev/null
@@ -1,180 +0,0 @@
-@project_issues
-Feature: Project Issues
- Background:
- Given I sign in as a user
- And I own project "Shop"
- And project "Shop" have "Release 0.4" open issue
- And project "Shop" have "Tweet control" open issue
- And project "Shop" have "Release 0.3" closed issue
- And I visit project "Shop" issues page
-
- Scenario: I should see open issues
- Given I should see "Release 0.4" in issues
- And I should not see "Release 0.3" in issues
-
- @javascript
- Scenario: I should see closed issues
- Given I click link "Closed"
- Then I should see "Release 0.3" in issues
- And I should not see "Release 0.4" in issues
-
- @javascript
- Scenario: I should see all issues
- Given I click link "All"
- Then I should see "Release 0.3" in issues
- And I should see "Release 0.4" in issues
-
- Scenario: I visit issue page
- Given I click link "Release 0.4"
- Then I should see issue "Release 0.4"
-
- Scenario: I submit new unassigned issue
- Given I click link "New Issue"
- And I submit new issue "500 error on profile"
- Then I should see issue "500 error on profile"
-
- @javascript
- Scenario: I submit new unassigned issue with labels
- Given project "Shop" has labels: "bug", "feature", "enhancement"
- And I click link "New Issue"
- And I submit new issue "500 error on profile" with label 'bug'
- Then I should see issue "500 error on profile"
- And I should see label 'bug' with issue
-
- @javascript
- Scenario: I comment issue
- Given I visit issue page "Release 0.4"
- And I leave a comment like "XML attached"
- Then I should see comment "XML attached"
- And I should see an error alert section within the comment form
-
- @javascript
- Scenario: Visiting Issues after being sorted the list
- Given I visit project "Shop" issues page
- And I sort the list by "Last updated"
- And I visit my project's home page
- And I visit project "Shop" issues page
- Then The list should be sorted by "Last updated"
-
- @javascript
- Scenario: Visiting Merge Requests after being sorted the list
- Given project "Shop" has a "Bugfix MR" merge request open
- And I visit project "Shop" issues page
- And I sort the list by "Last updated"
- And I visit project "Shop" merge requests page
- Then The list should be sorted by "Last updated"
-
- @javascript
- Scenario: Visiting Merge Requests from a differente Project after sorting
- Given project "Shop" has a "Bugfix MR" merge request open
- And I visit project "Shop" merge requests page
- And I sort the list by "Last updated"
- And I visit dashboard merge requests page
- Then The list should be sorted by "Last updated"
-
- @javascript
- Scenario: Sort issues by upvotes/downvotes
- Given project "Shop" have "Bugfix" open issue
- And issue "Release 0.4" have 2 upvotes and 1 downvote
- And issue "Tweet control" have 1 upvote and 2 downvotes
- And I sort the list by "Popularity"
- Then The list should be sorted by "Popularity"
-
- # Markdown
-
- @javascript
- Scenario: Headers inside the description should have ids generated for them.
- Given I visit issue page "Release 0.4"
- Then Header "Description header" should have correct id and link
-
- @javascript
- Scenario: Headers inside comments should not have ids generated for them.
- Given I visit issue page "Release 0.4"
- And I leave a comment with a header containing "Comment with a header"
- Then The comment with the header should not have an ID
-
- @javascript
- Scenario: Blocks inside comments should not build relative links
- Given I visit issue page "Release 0.4"
- And I leave a comment with code block
- Then The code block should be unchanged
-
- Scenario: Issues on empty project
- Given empty project "Empty Project"
- And I have an ssh key
- When I visit empty project page
- And I see empty project details with ssh clone info
- When I visit empty project's issues page
- Given I click link "New Issue"
- And I submit new issue "500 error on profile"
- Then I should see issue "500 error on profile"
-
- Scenario: Clickable labels
- Given issue 'Release 0.4' has label 'bug'
- And I visit project "Shop" issues page
- When I click label 'bug'
- And I should see "Release 0.4" in issues
- And I should not see "Tweet control" in issues
-
- @javascript
- Scenario: Issue notes should be editable with +1
- Given project "Shop" have "Release 0.4" open issue
- When I visit issue page "Release 0.4"
- And I leave a comment with a header containing "Comment with a header"
- Then The comment with the header should not have an ID
- And I edit the last comment with a +1
- Then I should see +1 in the description
-
- # Issue description preview
-
- @javascript
- Scenario: I can't preview without text
- Given I click link "New Issue"
- And I haven't written any description text
- Then The Markdown preview tab should say there is nothing to do
-
- @javascript
- Scenario: I can preview with text
- Given I click link "New Issue"
- And I write a description like ":+1: Nice"
- Then The Markdown preview tab should display rendered Markdown
-
- @javascript
- Scenario: I preview an issue description
- Given I click link "New Issue"
- And I preview a description text like "Bug fixed :smile:"
- Then I should see the Markdown preview
- And I should not see the Markdown text field
-
- @javascript
- Scenario: I can edit after preview
- Given I click link "New Issue"
- And I preview a description text like "Bug fixed :smile:"
- Then I should see the Markdown write tab
-
- @javascript
- Scenario: I can preview when editing an existing issue
- Given I click link "Release 0.4"
- And I click link "Edit" for the issue
- And I preview a description text like "Bug fixed :smile:"
- Then I should see the Markdown write tab
-
- @javascript
- Scenario: I can unsubscribe from issue
- Given project "Shop" have "Release 0.4" open issue
- When I visit issue page "Release 0.4"
- Then I should see that I am subscribed
- When I click the subscription toggle
- Then I should see that I am unsubscribed
-
- @javascript
- Scenario: I submit new unassigned issue as guest
- Given public project "Community"
- When I visit project "Community" page
- And I visit project "Community" issues page
- And I click link "New Issue"
- And I should not see assignee field
- And I should not see milestone field
- And I should not see labels field
- And I submit new issue "500 error on profile"
- Then I should see issue "500 error on profile"
diff --git a/features/project/issues/labels.feature b/features/project/issues/labels.feature
deleted file mode 100644
index 45de57f18e3..00000000000
--- a/features/project/issues/labels.feature
+++ /dev/null
@@ -1,48 +0,0 @@
-@project_issues
-Feature: Project Issues Labels
- Background:
- Given I sign in as a user
- And I own project "Shop"
- And project "Shop" has labels: "bug", "feature", "enhancement"
- Given I visit project "Shop" labels page
-
- Scenario: I should see labels list
- Then I should see label 'bug'
- And I should see label 'feature'
-
- Scenario: I create new label
- Given I visit project "Shop" new label page
- When I submit new label 'support'
- Then I should see label 'support'
-
- Scenario: I edit label
- Given I visit 'bug' label edit page
- When I change label 'bug' to 'fix'
- Then I should not see label 'bug'
- Then I should see label 'fix'
-
- Scenario: I remove label
- When I remove label 'bug'
- Then I should not see label 'bug'
-
- @javascript
- Scenario: I remove all labels
- When I delete all labels
- Then I should see labels help message
-
- Scenario: I create a label with invalid color
- Given I visit project "Shop" new label page
- When I submit new label with invalid color
- Then I should see label color error message
-
- Scenario: I create a label that already exists
- Given I visit project "Shop" new label page
- When I submit new label 'bug'
- Then I should see label label exist error message
-
- Scenario: I create the same label on another project
- Given I own project "Forum"
- And I visit project "Forum" labels page
- And I visit project "Forum" new label page
- When I submit new label 'bug'
- Then I should see label 'bug'
diff --git a/features/project/issues/milestones.feature b/features/project/issues/milestones.feature
index d121222308d..77c8ed6e5bf 100644
--- a/features/project/issues/milestones.feature
+++ b/features/project/issues/milestones.feature
@@ -39,4 +39,5 @@ Feature: Project Issues Milestones
Scenario: Headers inside the description should have ids generated for them.
Given I click link "v2.2"
+ # PLEASE USE the `have_header_with_correct_id_and_link(level, text, id, parent)` matcher on migrating this spec to rspec.
Then Header "Description header" should have correct id and link
diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb
index 3cd26bb429b..baa78c23203 100644
--- a/features/steps/project/issues/issues.rb
+++ b/features/steps/project/issues/issues.rb
@@ -7,36 +7,14 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
include SharedMarkdown
include SharedUser
- step 'I should see "Release 0.4" in issues' do
- expect(page).to have_content "Release 0.4"
- end
-
step 'I should not see "Release 0.3" in issues' do
expect(page).not_to have_content "Release 0.3"
end
- step 'I should not see "Tweet control" in issues' do
- expect(page).not_to have_content "Tweet control"
- end
-
- step 'I should see that I am subscribed' do
- wait_for_requests
- expect(find('.js-issuable-subscribe-button')).to have_css 'button.is-checked'
- end
-
- step 'I should see that I am unsubscribed' do
- wait_for_requests
- expect(find('.js-issuable-subscribe-button')).to have_css 'button:not(.is-checked)'
- end
-
step 'I click link "Closed"' do
find('.issues-state-filters [data-state="closed"] span', text: 'Closed').click
end
- step 'I click the subscription toggle' do
- find('.js-issuable-subscribe-button button').click
- end
-
step 'I should see "Release 0.3" in issues' do
expect(page).to have_content "Release 0.3"
end
@@ -51,24 +29,10 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect(find('.issues-state-filters > .active')).to have_content 'All'
end
- step 'I click link "Release 0.4"' do
- click_link "Release 0.4"
- end
-
- step 'I should see issue "Release 0.4"' do
- expect(page).to have_content "Release 0.4"
- end
-
step 'I should see issue "Tweet control"' do
expect(page).to have_content "Tweet control"
end
- step 'I click link "New issue"' do
- page.within '#content-body' do
- page.has_link?('New Issue') ? click_link('New Issue') : click_link('New issue')
- end
- end
-
step 'I click "author" dropdown' do
page.find('.js-author-search').click
sleep 1
@@ -81,18 +45,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect(users[1].text).to eq "#{current_user.name} #{current_user.to_reference}"
end
- step 'I submit new issue "500 error on profile"' do
- fill_in "issue_title", with: "500 error on profile"
- click_button "Submit issue"
- end
-
- step 'I submit new issue "500 error on profile" with label \'bug\'' do
- fill_in "issue_title", with: "500 error on profile"
- click_button "Label"
- click_link "bug"
- click_button "Submit issue"
- end
-
step 'I click link "500 error on profile"' do
click_link "500 error on profile"
end
@@ -103,13 +55,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
end
- step 'I should see issue "500 error on profile"' do
- issue = Issue.find_by(title: "500 error on profile")
- expect(page).to have_content issue.title
- expect(page).to have_content issue.author_name
- expect(page).to have_content issue.project.name
- end
-
step 'I fill in issue search with "Re"' do
filter_issue "Re"
end
@@ -163,49 +108,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect(find(issues_assignee_selector)).to have_content(assignee_name)
end
- step 'project "Shop" have "Release 0.4" open issue' do
- create(:issue,
- title: "Release 0.4",
- project: project,
- author: project.users.first,
- description: "# Description header"
- )
- wait_for_requests
- end
-
- step 'project "Shop" have "Tweet control" open issue' do
- create(:issue,
- title: "Tweet control",
- project: project,
- author: project.users.first)
- end
-
- step 'project "Shop" have "Bugfix" open issue' do
- create(:issue,
- title: "Bugfix",
- project: project,
- author: project.users.first)
- end
-
- step 'project "Shop" have "Release 0.3" closed issue' do
- create(:closed_issue,
- title: "Release 0.3",
- project: project,
- author: project.users.first)
- end
-
- step 'issue "Release 0.4" have 2 upvotes and 1 downvote' do
- awardable = Issue.find_by(title: 'Release 0.4')
- create_list(:award_emoji, 2, awardable: awardable)
- create(:award_emoji, :downvote, awardable: awardable)
- end
-
- step 'issue "Tweet control" have 1 upvote and 2 downvotes' do
- awardable = Issue.find_by(title: 'Tweet control')
- create(:award_emoji, :upvote, awardable: awardable)
- create_list(:award_emoji, 2, awardable: awardable, name: 'thumbsdown')
- end
-
step 'The list should be sorted by "Least popular"' do
page.within '.issues-list' do
page.within 'li.issue:nth-child(1)' do
@@ -225,69 +127,16 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
end
- step 'The list should be sorted by "Popularity"' do
- page.within '.issues-list' do
- page.within 'li.issue:nth-child(1)' do
- expect(page).to have_content 'Release 0.4'
- expect(page).to have_content '2 1'
- end
-
- page.within 'li.issue:nth-child(2)' do
- expect(page).to have_content 'Tweet control'
- expect(page).to have_content '1 2'
- end
-
- page.within 'li.issue:nth-child(3)' do
- expect(page).to have_content 'Bugfix'
- expect(page).not_to have_content '0 0'
- end
- end
- end
-
- step 'empty project "Empty Project"' do
- create :project_empty_repo, name: 'Empty Project', namespace: @user.namespace
- end
-
When 'I visit empty project page' do
project = Project.find_by(name: 'Empty Project')
visit project_path(project)
end
- step 'I see empty project details with ssh clone info' do
- project = Project.find_by(name: 'Empty Project')
- page.all(:css, '.git-empty .clone').each do |element|
- expect(element.text).to include(project.url_to_repo)
- end
- end
-
When "I visit project \"Community\" issues page" do
project = Project.find_by(name: 'Community')
visit project_issues_path(project)
end
- When "I visit empty project's issues page" do
- project = Project.find_by(name: 'Empty Project')
- visit project_issues_path(project)
- end
-
- step 'I leave a comment with code block' do
- page.within(".js-main-target-form") do
- fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```"
- click_button "Comment"
- sleep 0.05
- end
- end
-
- step 'I should see an error alert section within the comment form' do
- page.within(".js-main-target-form") do
- find(".error-alert")
- end
- end
-
- step 'The code block should be unchanged' do
- expect(page).to have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```")
- end
-
step 'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\'' do
create(:issue, title: 'Bugfix1', description: 'Description for issue1', project: project)
end
@@ -320,36 +169,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect(page).not_to have_content 'Bugfix1'
end
- step 'issue \'Release 0.4\' has label \'bug\'' do
- label = project.labels.create!(name: 'bug', color: '#990000')
- issue = Issue.find_by!(title: 'Release 0.4')
- issue.labels << label
- end
-
- step 'I click label \'bug\'' do
- page.within ".issues-list" do
- click_link 'bug'
- end
- end
-
- step 'I should not see labels field' do
- page.within '.issue-form' do
- expect(page).not_to have_content("Labels")
- end
- end
-
- step 'I should not see milestone field' do
- page.within '.issue-form' do
- expect(page).not_to have_content("Milestone")
- end
- end
-
- step 'I should not see assignee field' do
- page.within '.issue-form' do
- expect(page).not_to have_content("Assign to")
- end
- end
-
def filter_issue(text)
fill_in 'issuable_search', with: text
end
diff --git a/features/steps/project/issues/labels.rb b/features/steps/project/issues/labels.rb
deleted file mode 100644
index 4df96e081f9..00000000000
--- a/features/steps/project/issues/labels.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedProject
- include SharedPaths
-
- step 'I visit \'bug\' label edit page' do
- visit edit_project_label_path(project, bug_label)
- end
-
- step 'I remove label \'bug\'' do
- page.within "#project_label_#{bug_label.id}" do
- first(:link, 'Delete').click
- end
- end
-
- step 'I delete all labels' do
- page.within '.labels' do
- page.all('.label-list-item').each do
- first('.remove-row').click
- first(:link, 'Delete label').click
- end
- end
- end
-
- step 'I should see labels help message' do
- page.within '.labels' do
- expect(page).to have_content 'Generate a default set of labels'
- expect(page).to have_content 'New label'
- end
- end
-
- step 'I submit new label \'support\'' do
- fill_in 'Title', with: 'support'
- fill_in 'Background color', with: '#F95610'
- click_button 'Create label'
- end
-
- step 'I submit new label \'bug\'' do
- fill_in 'Title', with: 'bug'
- fill_in 'Background color', with: '#F95610'
- click_button 'Create label'
- end
-
- step 'I submit new label with invalid color' do
- fill_in 'Title', with: 'support'
- fill_in 'Background color', with: '#12'
- click_button 'Create label'
- end
-
- step 'I should see label label exist error message' do
- page.within '.label-form' do
- expect(page).to have_content 'Title has already been taken'
- end
- end
-
- step 'I should see label color error message' do
- page.within '.label-form' do
- expect(page).to have_content 'Color must be a valid color code'
- end
- end
-
- step 'I should see label \'feature\'' do
- page.within '.other-labels .manage-labels-list' do
- expect(page).to have_content 'feature'
- end
- end
-
- step 'I should see label \'bug\'' do
- page.within '.other-labels .manage-labels-list' do
- expect(page).to have_content 'bug'
- end
- end
-
- step 'I should not see label \'bug\'' do
- page.within '.other-labels .manage-labels-list' do
- expect(page).not_to have_content 'bug'
- end
- end
-
- step 'I should see label \'support\'' do
- page.within '.other-labels .manage-labels-list' do
- expect(page).to have_content 'support'
- end
- end
-
- step 'I change label \'bug\' to \'fix\'' do
- fill_in 'Title', with: 'fix'
- fill_in 'Background color', with: '#F15610'
- click_button 'Save changes'
- end
-
- step 'I should see label \'fix\'' do
- page.within '.other-labels .manage-labels-list' do
- expect(page).to have_content 'fix'
- end
- end
-
- def bug_label
- project.labels.find_or_create_by(title: 'bug')
- end
-end
diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb
index f90247c3fe8..a9174efd334 100644
--- a/features/steps/shared/issuable.rb
+++ b/features/steps/shared/issuable.rb
@@ -105,17 +105,6 @@ module SharedIssuable
edit_issuable
end
- step 'I click link "Edit" for the issue' do
- edit_issuable
- end
-
- step 'I sort the list by "Last updated"' do
- find('button.dropdown-toggle').click
- page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do
- click_link "Last updated"
- end
- end
-
step 'I sort the list by "Least popular"' do
find('button.dropdown-toggle').click
@@ -124,18 +113,6 @@ module SharedIssuable
end
end
- step 'I sort the list by "Popularity"' do
- find('button.dropdown-toggle').click
-
- page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do
- click_link 'Popularity'
- end
- end
-
- step 'The list should be sorted by "Last updated"' do
- expect(find('.issues-filters')).to have_content('Last updated')
- end
-
step 'I click link "Next" in the sidebar' do
page.within '.issuable-sidebar' do
click_link 'Next'
diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb
index c2bec2a6320..c66280127e9 100644
--- a/features/steps/shared/markdown.rb
+++ b/features/steps/shared/markdown.rb
@@ -18,43 +18,6 @@ module SharedMarkdown
expect(find('.gfm-form .js-md-preview')).not_to be_visible
end
- step 'The Markdown preview tab should say there is nothing to do' do
- page.within('.gfm-form') do
- find('.js-md-preview-button').click
- expect(find('.js-md-preview')).to have_content('Nothing to preview.')
- end
- end
-
- step 'I should not see the Markdown text field' do
- expect(find('.gfm-form textarea')).not_to be_visible
- end
-
- step 'I should see the Markdown write tab' do
- expect(first('.gfm-form')).to have_link('Write', visible: true)
- end
-
- step 'I should see the Markdown preview' do
- expect(find('.gfm-form')).to have_css('.js-md-preview', visible: true)
- end
-
- step 'The Markdown preview tab should display rendered Markdown' do
- page.within('.gfm-form') do
- find('.js-md-preview-button').click
- expect(find('.js-md-preview')).to have_css('gl-emoji', visible: true)
- end
- end
-
- step 'I write a description like ":+1: Nice"' do
- find('.gfm-form').fill_in 'Description', with: ':+1: Nice'
- end
-
- step 'I preview a description text like "Bug fixed :smile:"' do
- page.within(first('.gfm-form')) do
- fill_in 'Description', with: 'Bug fixed :smile:'
- click_link 'Preview'
- end
- end
-
step 'I haven\'t written any description text' do
find('.gfm-form').fill_in 'Description', with: ''
end
diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb
index 95f0cd2156e..cbe1cae096e 100644
--- a/features/steps/shared/note.rb
+++ b/features/steps/shared/note.rb
@@ -114,34 +114,12 @@ module SharedNote
end
end
- step 'I should see comment "XML attached"' do
- page.within(".note") do
- expect(page).to have_content("XML attached")
- end
- end
-
step 'I should see no notes at all' do
expect(page).not_to have_css('.note')
end
# Markdown
- step 'I leave a comment with a header containing "Comment with a header"' do
- page.within(".js-main-target-form") do
- fill_in "note[note]", with: "# Comment with a header"
- click_button "Comment"
- end
-
- wait_for_requests
- end
-
- step 'The comment with the header should not have an ID' do
- page.within(".note-body > .note-text") do
- expect(page).to have_content("Comment with a header")
- expect(page).not_to have_css("#comment-with-a-header")
- end
- end
-
step 'I edit the last comment with a +1' do
page.within(".main-notes-list") do
note = find('.note')
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index bff0d58aaf4..cc893b8391e 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -96,10 +96,6 @@ module SharedPaths
visit assigned_issues_dashboard_path
end
- step 'I visit dashboard merge requests page' do
- visit assigned_mrs_dashboard_path
- end
-
step 'I visit dashboard search page' do
visit search_path
end
@@ -200,10 +196,6 @@ module SharedPaths
# Generic Project
# ----------------------------------------
- step "I visit my project's home page" do
- visit project_path(@project)
- end
-
step "I visit my project's settings page" do
visit edit_project_path(@project)
end
@@ -339,20 +331,11 @@ module SharedPaths
visit project_commit_path(@project, sample_commit.id)
end
- step 'I visit project "Shop" issues page' do
- visit project_issues_path(project)
- end
-
step 'I visit issue page "Release 0.4"' do
issue = Issue.find_by(title: "Release 0.4")
visit project_issue_path(issue.project, issue)
end
- step 'I visit project "Shop" labels page' do
- project = Project.find_by(name: 'Shop')
- visit project_labels_path(project)
- end
-
step 'I visit project "Forum" labels page' do
project = Project.find_by(name: 'Forum')
visit project_labels_path(project)
@@ -394,10 +377,6 @@ module SharedPaths
wait_for_requests
end
- step 'I visit project "Shop" merge requests page' do
- visit project_merge_requests_path(project)
- end
-
step 'I visit forked project "Shop" merge requests page' do
visit project_merge_requests_path(project)
end
@@ -418,11 +397,6 @@ module SharedPaths
# Visibility Projects
# ----------------------------------------
- step 'I visit project "Community" page' do
- project = Project.find_by(name: "Community")
- visit project_path(project)
- end
-
step 'I visit project "Community" source page' do
project = Project.find_by(name: 'Community')
visit project_tree_path(project, root_ref)
@@ -442,11 +416,6 @@ module SharedPaths
# Empty Projects
# ----------------------------------------
- step "I visit empty project page" do
- project = Project.find_by(name: "Empty Public Project")
- visit project_path(project)
- end
-
step "I should not see command line instructions" do
expect(page).not_to have_css('.empty_wrapper')
end
diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb
index 07a0e2e072c..be848ebafa0 100644
--- a/features/steps/shared/project.rb
+++ b/features/steps/shared/project.rb
@@ -236,10 +236,6 @@ module SharedProject
@project.update(public_builds: false)
end
- step 'project "Shop" has a "Bugfix MR" merge request open' do
- create(:merge_request, title: "Bugfix MR", target_project: project, source_project: project, author: project.users.first)
- end
-
def user_owns_project(user_name:, project_name:, visibility: :private)
user = user_exists(user_name, username: user_name.gsub(/\s/, '').underscore)
project = Project.find_by(name: project_name)
diff --git a/features/steps/shared/user.rb b/features/steps/shared/user.rb
index 9856c510aa0..9cadc91769d 100644
--- a/features/steps/shared/user.rb
+++ b/features/steps/shared/user.rb
@@ -19,10 +19,6 @@ module SharedUser
User.find_by(name: name) || create(:user, { name: name, admin: false }.merge(options))
end
- step 'I have an ssh key' do
- create(:personal_key, user: @user)
- end
-
step 'I have no ssh keys' do
@user.keys.delete_all
end
diff --git a/lib/api/runner.rb b/lib/api/runner.rb
index 57c0a729535..834253d8e94 100644
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -208,6 +208,7 @@ module API
optional 'file.sha256', type: String, desc: %q(sha256 checksum of the file)
optional 'metadata.path', type: String, desc: %q(path to locally stored body (generated by Workhorse))
optional 'metadata.name', type: String, desc: %q(filename (generated by Workhorse))
+ optional 'metadata.sha256', type: String, desc: %q(sha256 checksum of the file)
end
post '/:id/artifacts' do
not_allowed! unless Gitlab.config.artifacts.enabled
@@ -227,7 +228,7 @@ module API
Gitlab::CurrentSettings.current_application_settings.default_artifacts_expire_in
job.build_job_artifacts_archive(project: job.project, file_type: :archive, file: artifacts, file_sha256: params['file.sha256'], expire_in: expire_in)
- job.build_job_artifacts_metadata(project: job.project, file_type: :metadata, file: metadata, expire_in: expire_in) if metadata
+ job.build_job_artifacts_metadata(project: job.project, file_type: :metadata, file: metadata, file_sha256: params['metadata.sha256'], expire_in: expire_in) if metadata
job.artifacts_expire_in = expire_in
if job.save
diff --git a/lib/banzai/filter/emoji_filter.rb b/lib/banzai/filter/emoji_filter.rb
index b82c6ca6393..e1261e7bbbe 100644
--- a/lib/banzai/filter/emoji_filter.rb
+++ b/lib/banzai/filter/emoji_filter.rb
@@ -11,7 +11,7 @@ module Banzai
IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set
def call
- search_text_nodes(doc).each do |node|
+ doc.search(".//text()").each do |node|
content = node.to_html
next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS)
diff --git a/lib/banzai/filter/gollum_tags_filter.rb b/lib/banzai/filter/gollum_tags_filter.rb
index c2b42673376..f2e9a5a1116 100644
--- a/lib/banzai/filter/gollum_tags_filter.rb
+++ b/lib/banzai/filter/gollum_tags_filter.rb
@@ -57,7 +57,7 @@ module Banzai
ALLOWED_IMAGE_EXTENSIONS = /.+(jpg|png|gif|svg|bmp)\z/i.freeze
def call
- search_text_nodes(doc).each do |node|
+ doc.search(".//text()").each do |node|
# A Gollum ToC tag is `[[_TOC_]]`, but due to MarkdownFilter running
# before this one, it will be converted into `[[<em>TOC</em>]]`, so it
# needs special-case handling
diff --git a/lib/banzai/filter/inline_diff_filter.rb b/lib/banzai/filter/inline_diff_filter.rb
index beb21b19ab3..73e82a4d7e3 100644
--- a/lib/banzai/filter/inline_diff_filter.rb
+++ b/lib/banzai/filter/inline_diff_filter.rb
@@ -4,7 +4,7 @@ module Banzai
IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set
def call
- search_text_nodes(doc).each do |node|
+ doc.search(".//text()").each do |node|
next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS)
content = node.to_html
diff --git a/lib/gitlab/git/checksum.rb b/lib/gitlab/git/checksum.rb
new file mode 100644
index 00000000000..3ef0f0a8854
--- /dev/null
+++ b/lib/gitlab/git/checksum.rb
@@ -0,0 +1,82 @@
+module Gitlab
+ module Git
+ class Checksum
+ include Gitlab::Git::Popen
+
+ EMPTY_REPOSITORY_CHECKSUM = '0000000000000000000000000000000000000000'.freeze
+
+ Failure = Class.new(StandardError)
+
+ attr_reader :path, :relative_path, :storage, :storage_path
+
+ def initialize(storage, relative_path)
+ @storage = storage
+ @storage_path = Gitlab.config.repositories.storages[storage].legacy_disk_path
+ @relative_path = "#{relative_path}.git"
+ @path = File.join(storage_path, @relative_path)
+ end
+
+ def calculate
+ unless repository_exists?
+ failure!(Gitlab::Git::Repository::NoRepository, 'No repository for such path')
+ end
+
+ calculate_checksum_by_shelling_out
+ end
+
+ private
+
+ def repository_exists?
+ raw_repository.exists?
+ end
+
+ def calculate_checksum_by_shelling_out
+ args = %W(--git-dir=#{path} show-ref --heads --tags)
+ output, status = run_git(args)
+
+ if status&.zero?
+ refs = output.split("\n")
+
+ result = refs.inject(nil) do |checksum, ref|
+ value = Digest::SHA1.hexdigest(ref).hex
+
+ if checksum.nil?
+ value
+ else
+ checksum ^ value
+ end
+ end
+
+ result.to_s(16)
+ else
+ # Empty repositories return with a non-zero status and an empty output.
+ if output&.empty?
+ EMPTY_REPOSITORY_CHECKSUM
+ else
+ failure!(Gitlab::Git::Checksum::Failure, output)
+ end
+ end
+ end
+
+ def failure!(klass, message)
+ Gitlab::GitLogger.error("'git show-ref --heads --tags' in #{path}: #{message}")
+
+ raise klass.new("Could not calculate the checksum for #{path}: #{message}")
+ end
+
+ def circuit_breaker
+ @circuit_breaker ||= Gitlab::Git::Storage::CircuitBreaker.for_storage(storage)
+ end
+
+ def raw_repository
+ Gitlab::Git::Repository.new(storage, relative_path, nil)
+ end
+
+ def run_git(args)
+ circuit_breaker.perform do
+ popen([Gitlab.config.git.bin_path, *args], path)
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/git/gitmodules_parser.rb b/lib/gitlab/git/gitmodules_parser.rb
index 4a43b9b444d..4b505312f60 100644
--- a/lib/gitlab/git/gitmodules_parser.rb
+++ b/lib/gitlab/git/gitmodules_parser.rb
@@ -46,6 +46,8 @@ module Gitlab
iterator = State.new
@content.split("\n").each_with_object(iterator) do |text, iterator|
+ text.chomp!
+
next if text =~ /^\s*#/
if text =~ /\A\[submodule "(?<name>[^"]+)"\]\z/
@@ -55,7 +57,7 @@ module Gitlab
next unless text =~ /\A\s*(?<key>\w+)\s*=\s*(?<value>.*)\z/
- value = $~[:value].chomp
+ value = $~[:value]
iterator.set_attribute($~[:key], value)
end
end
diff --git a/lib/gitlab/http.rb b/lib/gitlab/http.rb
index 96558872a37..9aca3b0fb26 100644
--- a/lib/gitlab/http.rb
+++ b/lib/gitlab/http.rb
@@ -4,6 +4,8 @@
# calling internal IP or services.
module Gitlab
class HTTP
+ BlockedUrlError = Class.new(StandardError)
+
include HTTParty # rubocop:disable Gitlab/HTTParty
connection_adapter ProxyHTTPConnectionAdapter
diff --git a/lib/gitlab/metrics/sidekiq_metrics_exporter.rb b/lib/gitlab/metrics/sidekiq_metrics_exporter.rb
index db8bdde74b2..47b4af5d649 100644
--- a/lib/gitlab/metrics/sidekiq_metrics_exporter.rb
+++ b/lib/gitlab/metrics/sidekiq_metrics_exporter.rb
@@ -4,6 +4,8 @@ require 'prometheus/client/rack/exporter'
module Gitlab
module Metrics
class SidekiqMetricsExporter < Daemon
+ LOG_FILENAME = File.join(Rails.root, 'log', 'sidekiq_exporter.log')
+
def enabled?
Gitlab::Metrics.metrics_folder_present? && settings.enabled
end
@@ -17,7 +19,13 @@ module Gitlab
attr_reader :server
def start_working
- @server = ::WEBrick::HTTPServer.new(Port: settings.port, BindAddress: settings.address)
+ logger = WEBrick::Log.new(LOG_FILENAME)
+ access_log = [
+ [logger, WEBrick::AccessLog::COMBINED_LOG_FORMAT]
+ ]
+
+ @server = ::WEBrick::HTTPServer.new(Port: settings.port, BindAddress: settings.address,
+ Logger: logger, AccessLog: access_log)
server.mount "/", Rack::Handler::WEBrick, rack_app
server.start
end
diff --git a/lib/gitlab/performance_bar.rb b/lib/gitlab/performance_bar.rb
index 6c2b2036074..92a308a12dc 100644
--- a/lib/gitlab/performance_bar.rb
+++ b/lib/gitlab/performance_bar.rb
@@ -5,6 +5,7 @@ module Gitlab
def self.enabled?(user = nil)
return true if Rails.env.development?
+ return true if user&.admin?
return false unless user && allowed_group_id
allowed_user_ids.include?(user.id)
diff --git a/lib/gitlab/proxy_http_connection_adapter.rb b/lib/gitlab/proxy_http_connection_adapter.rb
index c70d6f4cd84..d682289b632 100644
--- a/lib/gitlab/proxy_http_connection_adapter.rb
+++ b/lib/gitlab/proxy_http_connection_adapter.rb
@@ -10,8 +10,12 @@
module Gitlab
class ProxyHTTPConnectionAdapter < HTTParty::ConnectionAdapter
def connection
- if !allow_local_requests? && blocked_url?
- raise URI::InvalidURIError
+ unless allow_local_requests?
+ begin
+ Gitlab::UrlBlocker.validate!(uri, allow_local_network: false)
+ rescue Gitlab::UrlBlocker::BlockedUrlError => e
+ raise Gitlab::HTTP::BlockedUrlError, "URL '#{uri}' is blocked: #{e.message}"
+ end
end
super
@@ -19,10 +23,6 @@ module Gitlab
private
- def blocked_url?
- Gitlab::UrlBlocker.blocked_url?(uri, allow_private_networks: false)
- end
-
def allow_local_requests?
options.fetch(:allow_local_requests, allow_settings_local_requests?)
end
diff --git a/lib/gitlab/url_blocker.rb b/lib/gitlab/url_blocker.rb
index 0f9f939e204..db97f65bd54 100644
--- a/lib/gitlab/url_blocker.rb
+++ b/lib/gitlab/url_blocker.rb
@@ -2,48 +2,84 @@ require 'resolv'
module Gitlab
class UrlBlocker
- class << self
- def blocked_url?(url, allow_private_networks: true, valid_ports: [])
- return false if url.nil?
+ BlockedUrlError = Class.new(StandardError)
- blocked_ips = ["127.0.0.1", "::1", "0.0.0.0"]
- blocked_ips.concat(Socket.ip_address_list.map(&:ip_address))
+ class << self
+ def validate!(url, allow_localhost: false, allow_local_network: true, valid_ports: [])
+ return true if url.nil?
begin
uri = Addressable::URI.parse(url)
- # Allow imports from the GitLab instance itself but only from the configured ports
- return false if internal?(uri)
+ rescue Addressable::URI::InvalidURIError
+ raise BlockedUrlError, "URI is invalid"
+ end
- return true if blocked_port?(uri.port, valid_ports)
- return true if blocked_user_or_hostname?(uri.user)
- return true if blocked_user_or_hostname?(uri.hostname)
+ # Allow imports from the GitLab instance itself but only from the configured ports
+ return true if internal?(uri)
- addrs_info = Addrinfo.getaddrinfo(uri.hostname, 80, nil, :STREAM)
- server_ips = addrs_info.map(&:ip_address)
+ port = uri.port || uri.default_port
+ validate_port!(port, valid_ports) if valid_ports.any?
+ validate_user!(uri.user)
+ validate_hostname!(uri.hostname)
- return true if (blocked_ips & server_ips).any?
- return true if !allow_private_networks && private_network?(addrs_info)
- rescue Addressable::URI::InvalidURIError
- return true
+ begin
+ addrs_info = Addrinfo.getaddrinfo(uri.hostname, port, nil, :STREAM)
rescue SocketError
- return false
+ return true
end
+ validate_localhost!(addrs_info) unless allow_localhost
+ validate_local_network!(addrs_info) unless allow_local_network
+
+ true
+ end
+
+ def blocked_url?(*args)
+ validate!(*args)
+
false
+ rescue BlockedUrlError
+ true
end
private
- def blocked_port?(port, valid_ports)
- return false if port.blank? || valid_ports.blank?
+ def validate_port!(port, valid_ports)
+ return if port.blank?
+ # Only ports under 1024 are restricted
+ return if port >= 1024
+ return if valid_ports.include?(port)
- port < 1024 && !valid_ports.include?(port)
+ raise BlockedUrlError, "Only allowed ports are #{valid_ports.join(', ')}, and any over 1024"
end
- def blocked_user_or_hostname?(value)
- return false if value.blank?
+ def validate_user!(value)
+ return if value.blank?
+ return if value =~ /\A\p{Alnum}/
- value !~ /\A\p{Alnum}/
+ raise BlockedUrlError, "Username needs to start with an alphanumeric character"
+ end
+
+ def validate_hostname!(value)
+ return if value.blank?
+ return if value =~ /\A\p{Alnum}/
+
+ raise BlockedUrlError, "Hostname needs to start with an alphanumeric character"
+ end
+
+ def validate_localhost!(addrs_info)
+ local_ips = ["127.0.0.1", "::1", "0.0.0.0"]
+ local_ips.concat(Socket.ip_address_list.map(&:ip_address))
+
+ return if (local_ips & addrs_info.map(&:ip_address)).empty?
+
+ raise BlockedUrlError, "Requests to localhost are not allowed"
+ end
+
+ def validate_local_network!(addrs_info)
+ return unless addrs_info.any? { |addr| addr.ipv4_private? || addr.ipv6_sitelocal? }
+
+ raise BlockedUrlError, "Requests to the local network are not allowed"
end
def internal?(uri)
@@ -60,10 +96,6 @@ module Gitlab
(uri.port.blank? || uri.port == config.gitlab_shell.ssh_port)
end
- def private_network?(addrs_info)
- addrs_info.any? { |addr| addr.ipv4_private? || addr.ipv6_sitelocal? }
- end
-
def config
Gitlab.config
end
diff --git a/lib/tasks/gitlab/two_factor.rake b/lib/tasks/gitlab/two_factor.rake
index 7728c485e8d..6b22499a5c8 100644
--- a/lib/tasks/gitlab/two_factor.rake
+++ b/lib/tasks/gitlab/two_factor.rake
@@ -1,7 +1,7 @@
namespace :gitlab do
namespace :two_factor do
desc "GitLab | Disable Two-factor authentication (2FA) for all users"
- task disable_for_all_users: :environment do
+ task disable_for_all_users: :gitlab_environment do
scope = User.with_two_factor
count = scope.count
diff --git a/lib/tasks/gitlab/uploads/migrate.rake b/lib/tasks/gitlab/uploads/migrate.rake
index e7e656a911b..78e18992a8e 100644
--- a/lib/tasks/gitlab/uploads/migrate.rake
+++ b/lib/tasks/gitlab/uploads/migrate.rake
@@ -13,6 +13,7 @@ namespace :gitlab do
def enqueue_batch(batch, index)
job = ObjectStorage::MigrateUploadsWorker.enqueue!(batch,
+ @model_class,
@mounted_as,
@to_store)
puts "Enqueued job ##{index}: #{job}"
diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake
index 3e01f91d32c..b52af81fc16 100644
--- a/lib/tasks/test.rake
+++ b/lib/tasks/test.rake
@@ -4,8 +4,3 @@ desc "GitLab | Run all tests"
task :test do
Rake::Task["gitlab:test"].invoke
end
-
-unless Rails.env.production?
- desc "GitLab | Run all tests on CI with simplecov"
- task test_ci: [:rubocop, :brakeman, :karma, :spinach, :spec]
-end
diff --git a/scripts/trigger-build-omnibus b/scripts/trigger-build-omnibus
index 85ea4aa74ac..95f35b44f5a 100755
--- a/scripts/trigger-build-omnibus
+++ b/scripts/trigger-build-omnibus
@@ -9,6 +9,7 @@ module Omnibus
class Trigger
TOKEN = ENV['BUILD_TRIGGER_TOKEN']
+ TRIGGERER = ENV['CI_PROJECT_NAME']
def initialize
@uri = URI("https://gitlab.com/api/v4/projects/#{CGI.escape(Omnibus::PROJECT_PATH)}/trigger/pipeline")
@@ -32,7 +33,7 @@ module Omnibus
private
def ee?
- File.exist?('CHANGELOG-EE.md')
+ TRIGGERER == 'gitlab-ee' || File.exist?('CHANGELOG-EE.md')
end
def env_params
diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb
index 3b9e06cb5ad..16fb377b002 100644
--- a/spec/controllers/projects/branches_controller_spec.rb
+++ b/spec/controllers/projects/branches_controller_spec.rb
@@ -398,6 +398,22 @@ describe Projects::BranchesController do
end
end
+ # We need :request_store because Gitaly only counts the queries whenever
+ # `RequestStore.active?` in GitalyClient.enforce_gitaly_request_limits
+ # And the main goal of this test is making sure TooManyInvocationsError
+ # was not raised whenever the cache is enabled yet cold.
+ context 'when cache is enabled yet cold', :request_store do
+ it 'return with a status 200' do
+ get :index,
+ namespace_id: project.namespace,
+ project_id: project,
+ state: 'all',
+ format: :html
+
+ expect(response).to have_gitlab_http_status(200)
+ end
+ end
+
context 'when branch contains an invalid UTF-8 sequence' do
before do
project.repository.create_branch("wrong-\xE5-utf8-sequence")
@@ -414,7 +430,7 @@ describe Projects::BranchesController do
end
end
- context 'when depreated sort/search/page parameters are specified' do
+ context 'when deprecated sort/search/page parameters are specified' do
it 'returns with a status 301 when sort specified' do
get :index,
namespace_id: project.namespace,
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
index 9918d52e402..01b5506b64b 100644
--- a/spec/controllers/projects/issues_controller_spec.rb
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -974,7 +974,7 @@ describe Projects::IssuesController do
it 'returns discussion json' do
get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
- expect(json_response.first.keys).to match_array(%w[id reply_id expanded notes diff_discussion individual_note resolvable resolve_with_issue_path resolved])
+ expect(json_response.first.keys).to match_array(%w[id reply_id expanded notes diff_discussion individual_note resolvable resolved])
end
context 'with cross-reference system note', :request_store do
diff --git a/spec/features/dashboard/issues_filter_spec.rb b/spec/features/dashboard/issues_filter_spec.rb
index 8759950e013..029fc45c791 100644
--- a/spec/features/dashboard/issues_filter_spec.rb
+++ b/spec/features/dashboard/issues_filter_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
feature 'Dashboard Issues filtering', :js do
- include SortingHelper
+ include Spec::Support::Helpers::Features::SortingHelpers
let(:user) { create(:user) }
let(:project) { create(:project) }
@@ -90,14 +90,14 @@ feature 'Dashboard Issues filtering', :js do
context 'sorting' do
it 'shows sorted issues' do
- sorting_by('Created date')
+ sort_by('Created date')
visit_issues
expect(find('.issues-filters')).to have_content('Created date')
end
it 'keeps sorting issues after visiting Projects Issues page' do
- sorting_by('Created date')
+ sort_by('Created date')
visit project_issues_path(project)
expect(find('.issues-filters')).to have_content('Created date')
diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb
index c8f3a8449f5..4a9344115d2 100644
--- a/spec/features/dashboard/merge_requests_spec.rb
+++ b/spec/features/dashboard/merge_requests_spec.rb
@@ -1,8 +1,8 @@
require 'spec_helper'
feature 'Dashboard Merge Requests' do
+ include Spec::Support::Helpers::Features::SortingHelpers
include FilterItemSelectHelper
- include SortingHelper
include ProjectForksHelper
let(:current_user) { create :user }
@@ -115,7 +115,7 @@ feature 'Dashboard Merge Requests' do
end
it 'shows sorted merge requests' do
- sorting_by('Created date')
+ sort_by('Created date')
visit merge_requests_dashboard_path(assignee_id: current_user.id)
@@ -123,7 +123,7 @@ feature 'Dashboard Merge Requests' do
end
it 'keeps sorting merge requests after visiting Projects MR page' do
- sorting_by('Created date')
+ sort_by('Created date')
visit project_merge_requests_path(project)
diff --git a/spec/features/issuables/discussion_lock_spec.rb b/spec/features/issuables/discussion_lock_spec.rb
index ecbe51a7bc2..7ea29ff252b 100644
--- a/spec/features/issuables/discussion_lock_spec.rb
+++ b/spec/features/issuables/discussion_lock_spec.rb
@@ -14,7 +14,7 @@ describe 'Discussion Lock', :js do
project.add_developer(user)
end
- context 'when the discussion is unlocked' do
+ context 'when the discussion is unlocked' do
it 'the user can lock the issue' do
visit project_issue_path(project, issue)
diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb
index b835558b142..27551bb70ee 100644
--- a/spec/features/issues/issue_sidebar_spec.rb
+++ b/spec/features/issues/issue_sidebar_spec.rb
@@ -161,6 +161,50 @@ feature 'Issue Sidebar' do
end
end
end
+
+ context 'interacting with collapsed sidebar', :js do
+ collapsed_sidebar_selector = 'aside.right-sidebar.right-sidebar-collapsed'
+ expanded_sidebar_selector = 'aside.right-sidebar.right-sidebar-expanded'
+ confidentiality_sidebar_block = '.block.confidentiality'
+ lock_sidebar_block = '.block.lock'
+ collapsed_sidebar_block_icon = '.sidebar-collapsed-icon'
+
+ before do
+ resize_screen_sm
+ end
+
+ it 'confidentiality block expands then collapses sidebar' do
+ expect(page).to have_css(collapsed_sidebar_selector)
+
+ page.within(confidentiality_sidebar_block) do
+ find(collapsed_sidebar_block_icon).click
+ end
+
+ expect(page).to have_css(expanded_sidebar_selector)
+
+ page.within(confidentiality_sidebar_block) do
+ page.find('button', text: 'Cancel').click
+ end
+
+ expect(page).to have_css(collapsed_sidebar_selector)
+ end
+
+ it 'lock block expands then collapses sidebar' do
+ expect(page).to have_css(collapsed_sidebar_selector)
+
+ page.within(lock_sidebar_block) do
+ find(collapsed_sidebar_block_icon).click
+ end
+
+ expect(page).to have_css(expanded_sidebar_selector)
+
+ page.within(lock_sidebar_block) do
+ page.find('button', text: 'Cancel').click
+ end
+
+ expect(page).to have_css(collapsed_sidebar_selector)
+ end
+ end
end
context 'as a guest' do
diff --git a/spec/features/issues/user_uses_slash_commands_spec.rb b/spec/features/issues/user_uses_slash_commands_spec.rb
index ea7a97d02a0..ff2a0e15719 100644
--- a/spec/features/issues/user_uses_slash_commands_spec.rb
+++ b/spec/features/issues/user_uses_slash_commands_spec.rb
@@ -1,7 +1,7 @@
require 'rails_helper'
feature 'Issues > User uses quick actions', :js do
- include QuickActionsHelpers
+ include Spec::Support::Helpers::Features::NotesHelpers
it_behaves_like 'issuable record that supports quick actions in its description and notes', :issue do
let(:issuable) { create(:issue, project: project) }
@@ -36,7 +36,7 @@ feature 'Issues > User uses quick actions', :js do
context 'when the current user can update the due date' do
it 'does not create a note, and sets the due date accordingly' do
- write_note("/due 2016-08-28")
+ add_note("/due 2016-08-28")
expect(page).not_to have_content '/due 2016-08-28'
expect(page).to have_content 'Commands applied'
@@ -57,7 +57,7 @@ feature 'Issues > User uses quick actions', :js do
end
it 'does not create a note, and sets the due date accordingly' do
- write_note("/due 2016-08-28")
+ add_note("/due 2016-08-28")
expect(page).not_to have_content 'Commands applied'
@@ -75,7 +75,7 @@ feature 'Issues > User uses quick actions', :js do
it 'does not create a note, and removes the due date accordingly' do
expect(issue.due_date).to eq Date.new(2016, 8, 28)
- write_note("/remove_due_date")
+ add_note("/remove_due_date")
expect(page).not_to have_content '/remove_due_date'
expect(page).to have_content 'Commands applied'
@@ -96,7 +96,7 @@ feature 'Issues > User uses quick actions', :js do
end
it 'does not create a note, and sets the due date accordingly' do
- write_note("/remove_due_date")
+ add_note("/remove_due_date")
expect(page).not_to have_content 'Commands applied'
@@ -111,7 +111,7 @@ feature 'Issues > User uses quick actions', :js do
let(:issue) { create(:issue, project: project) }
it 'does not recognize the command nor create a note' do
- write_note("/wip")
+ add_note("/wip")
expect(page).not_to have_content '/wip'
end
@@ -123,7 +123,7 @@ feature 'Issues > User uses quick actions', :js do
context 'when the current user can update issues' do
it 'does not create a note, and marks the issue as a duplicate' do
- write_note("/duplicate ##{original_issue.to_reference}")
+ add_note("/duplicate ##{original_issue.to_reference}")
expect(page).not_to have_content "/duplicate #{original_issue.to_reference}"
expect(page).to have_content 'Commands applied'
@@ -143,7 +143,7 @@ feature 'Issues > User uses quick actions', :js do
end
it 'does not create a note, and does not mark the issue as a duplicate' do
- write_note("/duplicate ##{original_issue.to_reference}")
+ add_note("/duplicate ##{original_issue.to_reference}")
expect(page).not_to have_content 'Commands applied'
expect(page).not_to have_content "marked this issue as a duplicate of #{original_issue.to_reference}"
@@ -166,7 +166,7 @@ feature 'Issues > User uses quick actions', :js do
end
it 'moves the issue' do
- write_note("/move #{target_project.full_path}")
+ add_note("/move #{target_project.full_path}")
expect(page).to have_content 'Commands applied'
expect(issue.reload).to be_closed
@@ -186,7 +186,7 @@ feature 'Issues > User uses quick actions', :js do
end
it 'does not move the issue' do
- write_note("/move #{project_unauthorized.full_path}")
+ add_note("/move #{project_unauthorized.full_path}")
expect(page).not_to have_content 'Commands applied'
expect(issue.reload).to be_open
@@ -200,7 +200,7 @@ feature 'Issues > User uses quick actions', :js do
end
it 'does not move the issue' do
- write_note("/move not/valid")
+ add_note("/move not/valid")
expect(page).not_to have_content 'Commands applied'
expect(issue.reload).to be_open
@@ -223,7 +223,7 @@ feature 'Issues > User uses quick actions', :js do
end
it 'applies the commands to both issues and moves the issue' do
- write_note("/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"\n\n/move #{target_project.full_path}")
+ add_note("/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"\n\n/move #{target_project.full_path}")
expect(page).to have_content 'Commands applied'
expect(issue.reload).to be_closed
@@ -242,7 +242,7 @@ feature 'Issues > User uses quick actions', :js do
end
it 'moves the issue and applies the commands to both issues' do
- write_note("/move #{target_project.full_path}\n\n/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"")
+ add_note("/move #{target_project.full_path}\n\n/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"")
expect(page).to have_content 'Commands applied'
expect(issue.reload).to be_closed
diff --git a/spec/features/merge_request/user_uses_slash_commands_spec.rb b/spec/features/merge_request/user_uses_slash_commands_spec.rb
index bd739e69d6c..7f261b580f7 100644
--- a/spec/features/merge_request/user_uses_slash_commands_spec.rb
+++ b/spec/features/merge_request/user_uses_slash_commands_spec.rb
@@ -1,7 +1,7 @@
require 'rails_helper'
describe 'Merge request > User uses quick actions', :js do
- include QuickActionsHelpers
+ include Spec::Support::Helpers::Features::NotesHelpers
let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator }
@@ -33,7 +33,7 @@ describe 'Merge request > User uses quick actions', :js do
describe 'toggling the WIP prefix in the title from note' do
context 'when the current user can toggle the WIP prefix' do
it 'adds the WIP: prefix to the title' do
- write_note("/wip")
+ add_note("/wip")
expect(page).not_to have_content '/wip'
expect(page).to have_content 'Commands applied'
@@ -44,7 +44,7 @@ describe 'Merge request > User uses quick actions', :js do
it 'removes the WIP: prefix from the title' do
merge_request.title = merge_request.wip_title
merge_request.save
- write_note("/wip")
+ add_note("/wip")
expect(page).not_to have_content '/wip'
expect(page).to have_content 'Commands applied'
@@ -62,7 +62,7 @@ describe 'Merge request > User uses quick actions', :js do
end
it 'does not change the WIP prefix' do
- write_note("/wip")
+ add_note("/wip")
expect(page).not_to have_content '/wip'
expect(page).not_to have_content 'Commands applied'
@@ -75,7 +75,7 @@ describe 'Merge request > User uses quick actions', :js do
describe 'merging the MR from the note' do
context 'when the current user can merge the MR' do
it 'merges the MR' do
- write_note("/merge")
+ add_note("/merge")
expect(page).to have_content 'Commands applied'
@@ -90,7 +90,7 @@ describe 'Merge request > User uses quick actions', :js do
end
it 'does not merge the MR' do
- write_note("/merge")
+ add_note("/merge")
expect(page).not_to have_content 'Your commands have been executed!'
@@ -107,7 +107,7 @@ describe 'Merge request > User uses quick actions', :js do
end
it 'does not merge the MR' do
- write_note("/merge")
+ add_note("/merge")
expect(page).not_to have_content 'Your commands have been executed!'
@@ -118,7 +118,7 @@ describe 'Merge request > User uses quick actions', :js do
describe 'adding a due date from note' do
it 'does not recognize the command nor create a note' do
- write_note('/due 2016-08-28')
+ add_note('/due 2016-08-28')
expect(page).not_to have_content '/due 2016-08-28'
end
@@ -162,7 +162,7 @@ describe 'Merge request > User uses quick actions', :js do
describe '/target_branch command from note' do
context 'when the current user can change target branch' do
it 'changes target branch from a note' do
- write_note("message start \n/target_branch merge-test\n message end.")
+ add_note("message start \n/target_branch merge-test\n message end.")
wait_for_requests
expect(page).not_to have_content('/target_branch')
@@ -173,7 +173,7 @@ describe 'Merge request > User uses quick actions', :js do
end
it 'does not fail when target branch does not exists' do
- write_note('/target_branch totally_not_existing_branch')
+ add_note('/target_branch totally_not_existing_branch')
expect(page).not_to have_content('/target_branch')
@@ -190,7 +190,7 @@ describe 'Merge request > User uses quick actions', :js do
end
it 'does not change target branch' do
- write_note('/target_branch merge-test')
+ add_note('/target_branch merge-test')
expect(page).not_to have_content '/target_branch merge-test'
diff --git a/spec/features/projects/issues/user_comments_on_issue_spec.rb b/spec/features/projects/issues/user_comments_on_issue_spec.rb
new file mode 100644
index 00000000000..c45fdc7642f
--- /dev/null
+++ b/spec/features/projects/issues/user_comments_on_issue_spec.rb
@@ -0,0 +1,73 @@
+require "spec_helper"
+
+describe "User comments on issue", :js do
+ include Spec::Support::Helpers::Features::NotesHelpers
+
+ let(:project) { create(:project_empty_repo, :public) }
+ let(:issue) { create(:issue, project: project) }
+ let(:user) { create(:user) }
+
+ before do
+ project.add_guest(user)
+ sign_in(user)
+
+ visit(project_issue_path(project, issue))
+ end
+
+ context "when adding comments" do
+ it "adds comment" do
+ content = "XML attached"
+ target_form = ".js-main-target-form"
+
+ add_note(content)
+
+ page.within(".note") do
+ expect(page).to have_content(content)
+ end
+
+ page.within(target_form) do
+ find(".error-alert", visible: false)
+ end
+ end
+
+ it "adds comment with code block" do
+ comment = "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```"
+
+ add_note(comment)
+
+ expect(page).to have_content(comment)
+ end
+ end
+
+ context "when editing comments" do
+ it "edits comment" do
+ add_note("# Comment with a header")
+
+ page.within(".note-body > .note-text") do
+ expect(page).to have_content("Comment with a header").and have_no_css("#comment-with-a-header")
+ end
+
+ page.within(".main-notes-list") do
+ note = find(".note")
+
+ note.hover
+ note.find(".js-note-edit").click
+ end
+
+ expect(page).to have_css(".current-note-edit-form textarea")
+
+ comment = "+1 Awesome!"
+
+ page.within(".current-note-edit-form") do
+ fill_in("note[note]", with: comment)
+ click_button("Save comment")
+ end
+
+ wait_for_requests
+
+ page.within(".note") do
+ expect(page).to have_content(comment)
+ end
+ end
+ end
+end
diff --git a/spec/features/projects/issues/user_creates_issue_spec.rb b/spec/features/projects/issues/user_creates_issue_spec.rb
new file mode 100644
index 00000000000..e76f7c5589d
--- /dev/null
+++ b/spec/features/projects/issues/user_creates_issue_spec.rb
@@ -0,0 +1,87 @@
+require "spec_helper"
+
+describe "User creates issue" do
+ let(:project) { create(:project_empty_repo, :public) }
+ let(:user) { create(:user) }
+
+ context "when signed in as guest" do
+ before do
+ project.add_guest(user)
+ sign_in(user)
+
+ visit(new_project_issue_path(project))
+ end
+
+ it "creates issue" do
+ page.within(".issue-form") do
+ expect(page).to have_no_content("Assign to")
+ .and have_no_content("Labels")
+ .and have_no_content("Milestone")
+ end
+
+ issue_title = "500 error on profile"
+
+ fill_in("Title", with: issue_title)
+ click_button("Submit issue")
+
+ expect(page).to have_content(issue_title)
+ .and have_content(user.name)
+ .and have_content(project.name)
+ end
+ end
+
+ context "when signed in as developer", :js do
+ before do
+ project.add_developer(user)
+ sign_in(user)
+
+ visit(new_project_issue_path(project))
+ end
+
+ context "when previewing" do
+ it "previews content" do
+ form = first(".gfm-form")
+ textarea = first(".gfm-form textarea")
+
+ page.within(form) do
+ click_link("Preview")
+
+ preview = find(".js-md-preview") # this element is findable only when the "Preview" link is clicked.
+
+ expect(preview).to have_content("Nothing to preview.")
+
+ click_link("Write")
+ fill_in("Description", with: "Bug fixed :smile:")
+ click_link("Preview")
+
+ expect(preview).to have_css("gl-emoji")
+ expect(textarea).not_to be_visible
+ end
+ end
+ end
+
+ context "with labels" do
+ LABEL_TITLES = %w(bug feature enhancement).freeze
+
+ before do
+ LABEL_TITLES.each do |title|
+ create(:label, project: project, title: title)
+ end
+ end
+
+ it "creates issue" do
+ issue_title = "500 error on profile"
+
+ fill_in("Title", with: issue_title)
+ click_button("Label")
+ click_link(LABEL_TITLES.first)
+ click_button("Submit issue")
+
+ expect(page).to have_content(issue_title)
+ .and have_content(user.name)
+ .and have_content(project.name)
+ .and have_content(LABEL_TITLES.first)
+ end
+ end
+ end
+end
diff --git a/spec/features/projects/issues/user_edits_issue_spec.rb b/spec/features/projects/issues/user_edits_issue_spec.rb
new file mode 100644
index 00000000000..1d9c3abc20f
--- /dev/null
+++ b/spec/features/projects/issues/user_edits_issue_spec.rb
@@ -0,0 +1,25 @@
+require "spec_helper"
+
+describe "User edits issue", :js do
+ set(:project) { create(:project_empty_repo, :public) }
+ set(:user) { create(:user) }
+ set(:issue) { create(:issue, project: project, author: user) }
+
+ before do
+ project.add_developer(user)
+ sign_in(user)
+
+ visit(edit_project_issue_path(project, issue))
+ end
+
+ it "previews content" do
+ form = first(".gfm-form")
+
+ page.within(form) do
+ fill_in("Description", with: "Bug fixed :smile:")
+ click_link("Preview")
+ end
+
+ expect(form).to have_link("Write")
+ end
+end
diff --git a/spec/features/projects/issues/user_sorts_issues_spec.rb b/spec/features/projects/issues/user_sorts_issues_spec.rb
new file mode 100644
index 00000000000..34148ae0116
--- /dev/null
+++ b/spec/features/projects/issues/user_sorts_issues_spec.rb
@@ -0,0 +1,42 @@
+require "spec_helper"
+
+describe "User sorts issues" do
+ set(:project) { create(:project_empty_repo, :public) }
+ set(:issue1) { create(:issue, project: project) }
+ set(:issue2) { create(:issue, project: project) }
+ set(:issue3) { create(:issue, project: project) }
+
+ before do
+ create_list(:award_emoji, 2, :upvote, awardable: issue1)
+ create_list(:award_emoji, 2, :downvote, awardable: issue2)
+ create(:award_emoji, :downvote, awardable: issue1)
+ create(:award_emoji, :upvote, awardable: issue2)
+
+ visit(project_issues_path(project))
+ end
+
+ it "sorts by popularity" do
+ find("button.dropdown-toggle").click
+
+ page.within(".content ul.dropdown-menu.dropdown-menu-align-right li") do
+ click_link("Popularity")
+ end
+
+ page.within(".issues-list") do
+ page.within("li.issue:nth-child(1)") do
+ expect(page).to have_content(issue1.title)
+ expect(page).to have_content("2 1")
+ end
+
+ page.within("li.issue:nth-child(2)") do
+ expect(page).to have_content(issue2.title)
+ expect(page).to have_content("1 2")
+ end
+
+ page.within("li.issue:nth-child(3)") do
+ expect(page).to have_content(issue3.title)
+ expect(page).not_to have_content("0 0")
+ end
+ end
+ end
+end
diff --git a/spec/features/projects/issues/user_toggles_subscription_spec.rb b/spec/features/projects/issues/user_toggles_subscription_spec.rb
new file mode 100644
index 00000000000..117a614b980
--- /dev/null
+++ b/spec/features/projects/issues/user_toggles_subscription_spec.rb
@@ -0,0 +1,28 @@
+require "spec_helper"
+
+describe "User toggles subscription", :js do
+ set(:project) { create(:project_empty_repo, :public) }
+ set(:user) { create(:user) }
+ set(:issue) { create(:issue, project: project, author: user) }
+
+ before do
+ project.add_developer(user)
+ sign_in(user)
+
+ visit(project_issue_path(project, issue))
+ end
+
+ it "unsibscribes from issue" do
+ subscription_button = find(".js-issuable-subscribe-button")
+
+ # Check we're subscribed.
+ expect(subscription_button).to have_css("button.is-checked")
+
+ # Toggle subscription.
+ find(".js-issuable-subscribe-button button").click
+ wait_for_requests
+
+ # Check we're unsubscribed.
+ expect(subscription_button).to have_css("button:not(.is-checked)")
+ end
+end
diff --git a/spec/features/projects/issues/user_views_issue_spec.rb b/spec/features/projects/issues/user_views_issue_spec.rb
new file mode 100644
index 00000000000..f7f2cde3d64
--- /dev/null
+++ b/spec/features/projects/issues/user_views_issue_spec.rb
@@ -0,0 +1,16 @@
+require "spec_helper"
+
+describe "User views issue" do
+ set(:project) { create(:project_empty_repo, :public) }
+ set(:user) { create(:user) }
+ set(:issue) { create(:issue, project: project, description: "# Description header", author: user) }
+
+ before do
+ project.add_guest(user)
+ sign_in(user)
+
+ visit(project_issue_path(project, issue))
+ end
+
+ it { expect(page).to have_header_with_correct_id_and_link(1, "Description header", "description-header") }
+end
diff --git a/spec/features/projects/issues/user_views_issues_spec.rb b/spec/features/projects/issues/user_views_issues_spec.rb
index d35009b8974..58afb4efb86 100644
--- a/spec/features/projects/issues/user_views_issues_spec.rb
+++ b/spec/features/projects/issues/user_views_issues_spec.rb
@@ -1,56 +1,116 @@
-require 'spec_helper'
+require "spec_helper"
-describe 'User views issues' do
+describe "User views issues" do
+ let!(:closed_issue) { create(:closed_issue, project: project) }
+ let!(:open_issue1) { create(:issue, project: project) }
+ let!(:open_issue2) { create(:issue, project: project) }
set(:user) { create(:user) }
- shared_examples_for 'shows issues' do
- it 'shows issues' do
- expect(page).to have_content(project.name)
- .and have_content(issue1.title)
- .and have_content(issue2.title)
- .and have_no_selector('.js-new-board-list')
+ shared_examples "opens issue from list" do
+ it "opens issue" do
+ click_link(issue.title)
+
+ expect(page).to have_content(issue.title)
end
end
- context 'when project is public' do
- set(:project) { create(:project_empty_repo, :public) }
- set(:issue1) { create(:issue, project: project) }
- set(:issue2) { create(:issue, project: project) }
+ shared_examples "open issues" do
+ context "open issues" do
+ let(:label) { create(:label, project: project, title: "bug") }
- context 'when signed in' do
before do
- project.add_developer(user)
- sign_in(user)
+ open_issue1.labels << label
+
+ visit(project_issues_path(project, state: :opened))
+ end
- visit(project_issues_path(project))
+ it "shows open issues" do
+ expect(page).to have_content(project.name)
+ .and have_content(open_issue1.title)
+ .and have_content(open_issue2.title)
+ .and have_no_content(closed_issue.title)
+ .and have_no_selector(".js-new-board-list")
end
- include_examples 'shows issues'
+ it "opens issues by label" do
+ page.within(".issues-list") do
+ click_link(label.title)
+ end
+
+ expect(page).to have_content(open_issue1.title)
+ .and have_no_content(open_issue2.title)
+ .and have_no_content(closed_issue.title)
+ end
+
+ include_examples "opens issue from list" do
+ let(:issue) { open_issue1 }
+ end
end
+ end
- context 'when not signed in' do
+ shared_examples "closed issues" do
+ context "closed issues" do
before do
- visit(project_issues_path(project))
+ visit(project_issues_path(project, state: :closed))
+ end
+
+ it "shows closed issues" do
+ expect(page).to have_content(project.name)
+ .and have_content(closed_issue.title)
+ .and have_no_content(open_issue1.title)
+ .and have_no_content(open_issue2.title)
+ .and have_no_selector(".js-new-board-list")
end
- include_examples 'shows issues'
+ include_examples "opens issue from list" do
+ let(:issue) { closed_issue }
+ end
end
end
- context 'when project is internal' do
- set(:project) { create(:project_empty_repo, :internal) }
- set(:issue1) { create(:issue, project: project) }
- set(:issue2) { create(:issue, project: project) }
-
- context 'when signed in' do
+ shared_examples "all issues" do
+ context "all issues" do
before do
- project.add_developer(user)
- sign_in(user)
+ visit(project_issues_path(project, state: :all))
+ end
- visit(project_issues_path(project))
+ it "shows all issues" do
+ expect(page).to have_content(project.name)
+ .and have_content(closed_issue.title)
+ .and have_content(open_issue1.title)
+ .and have_content(open_issue2.title)
+ .and have_no_selector(".js-new-board-list")
end
- include_examples 'shows issues'
+ include_examples "opens issue from list" do
+ let(:issue) { closed_issue }
+ end
+ end
+ end
+
+ %w[internal public].each do |visibility|
+ shared_examples "#{visibility} project" do
+ context "when project is #{visibility}" do
+ let(:project) { create(:project_empty_repo, :"#{visibility}") }
+
+ include_examples "open issues"
+ include_examples "closed issues"
+ include_examples "all issues"
+ end
end
end
+
+ context "when signed in as developer" do
+ before do
+ project.add_developer(user)
+ sign_in(user)
+ end
+
+ include_examples "public project"
+ include_examples "internal project"
+ end
+
+ context "when not signed in" do
+ include_examples "public project"
+ end
end
diff --git a/spec/features/projects/labels/user_creates_labels_spec.rb b/spec/features/projects/labels/user_creates_labels_spec.rb
new file mode 100644
index 00000000000..9fd7f3ee775
--- /dev/null
+++ b/spec/features/projects/labels/user_creates_labels_spec.rb
@@ -0,0 +1,88 @@
+require "spec_helper"
+
+describe "User creates labels" do
+ set(:project) { create(:project_empty_repo, :public) }
+ set(:user) { create(:user) }
+
+ shared_examples_for "label creation" do
+ it "creates new label" do
+ title = "bug"
+
+ create_label(title)
+
+ page.within(".other-labels .manage-labels-list") do
+ expect(page).to have_content(title)
+ end
+ end
+ end
+
+ context "in project" do
+ before do
+ project.add_master(user)
+ sign_in(user)
+
+ visit(new_project_label_path(project))
+ end
+
+ context "when data is valid" do
+ include_examples "label creation"
+ end
+
+ context "when data is invalid" do
+ context "when title is invalid" do
+ it "shows error message" do
+ create_label("")
+
+ page.within(".label-form") do
+ expect(page).to have_content("Title can't be blank")
+ end
+ end
+ end
+
+ context "when color is invalid" do
+ it "shows error message" do
+ create_label("feature", "#12")
+
+ page.within(".label-form") do
+ expect(page).to have_content("Color must be a valid color code")
+ end
+ end
+ end
+ end
+
+ context "when label already exists" do
+ let!(:label) { create(:label, project: project) }
+
+ it "shows error message" do
+ create_label(label.title)
+
+ page.within(".label-form") do
+ expect(page).to have_content("Title has already been taken")
+ end
+ end
+ end
+ end
+
+ context "in another project" do
+ set(:another_project) { create(:project_empty_repo, :public) }
+
+ before do
+ create(:label, project: project, title: "bug") # Create label for `project` (not `another_project`) project.
+
+ another_project.add_master(user)
+ sign_in(user)
+
+ visit(new_project_label_path(another_project))
+ end
+
+ include_examples "label creation"
+ end
+
+ private
+
+ def create_label(title, color = "#F95610")
+ fill_in("Title", with: title)
+ fill_in("Background color", with: color)
+ click_button("Create label")
+ end
+end
diff --git a/spec/features/projects/labels/user_edits_labels_spec.rb b/spec/features/projects/labels/user_edits_labels_spec.rb
new file mode 100644
index 00000000000..d1041ff5c1e
--- /dev/null
+++ b/spec/features/projects/labels/user_edits_labels_spec.rb
@@ -0,0 +1,25 @@
+require "spec_helper"
+
+describe "User edits labels" do
+ set(:project) { create(:project_empty_repo, :public) }
+ set(:label) { create(:label, project: project) }
+ set(:user) { create(:user) }
+
+ before do
+ project.add_master(user)
+ sign_in(user)
+
+ visit(edit_project_label_path(project, label))
+ end
+
+ it "updates label's title" do
+ new_title = "fix"
+
+ fill_in("Title", with: new_title)
+ click_button("Save changes")
+
+ page.within(".other-labels .manage-labels-list") do
+ expect(page).to have_content(new_title).and have_no_content(label.title)
+ end
+ end
+end
diff --git a/spec/features/projects/labels/user_removes_labels_spec.rb b/spec/features/projects/labels/user_removes_labels_spec.rb
new file mode 100644
index 00000000000..f4fda6de465
--- /dev/null
+++ b/spec/features/projects/labels/user_removes_labels_spec.rb
@@ -0,0 +1,52 @@
+require "spec_helper"
+
+describe "User removes labels" do
+ let(:project) { create(:project_empty_repo, :public) }
+ let(:user) { create(:user) }
+
+ before do
+ project.add_master(user)
+ sign_in(user)
+ end
+
+ context "when one label" do
+ let!(:label) { create(:label, project: project) }
+
+ before do
+ visit(project_labels_path(project))
+ end
+
+ it "removes label" do
+ page.within(".labels") do
+ page.first(".label-list-item") do
+ first(".remove-row").click
+ first(:link, "Delete label").click
+ end
+ end
+
+ expect(page).to have_content("Label was removed").and have_no_content(label.title)
+ end
+ end
+
+ context "when many labels", :js do
+ before do
+ create_list(:label, 3, project: project)
+
+ visit(project_labels_path(project))
+ end
+
+ it "removes all labels" do
+ page.within(".labels") do
+ loop do
+ li = page.first(".label-list-item")
+ break unless li
+
+ li.click_link("Delete")
+ click_link("Delete label")
+ end
+
+ expect(page).to have_content("Generate a default set of labels").and have_content("New label")
+ end
+ end
+ end
+end
diff --git a/spec/features/projects/labels/user_views_labels_spec.rb b/spec/features/projects/labels/user_views_labels_spec.rb
new file mode 100644
index 00000000000..0cbeca4e392
--- /dev/null
+++ b/spec/features/projects/labels/user_views_labels_spec.rb
@@ -0,0 +1,23 @@
+require "spec_helper"
+
+describe "User views labels" do
+ set(:project) { create(:project_empty_repo, :public) }
+ set(:user) { create(:user) }
+
+ LABEL_TITLES = %w[bug enhancement feature].freeze
+
+ before do
+ LABEL_TITLES.each { |title| create(:label, project: project, title: title) }
+
+ project.add_guest(user)
+ sign_in(user)
+
+ visit(project_labels_path(project))
+ end
+
+ it "shows all labels" do
+ page.within('.other-labels .manage-labels-list') do
+ LABEL_TITLES.each { |title| expect(page).to have_content(title) }
+ end
+ end
+end
diff --git a/spec/features/projects/milestones/milestones_sorting_spec.rb b/spec/features/projects/milestones/milestones_sorting_spec.rb
index c531b81e04d..b64786d4eec 100644
--- a/spec/features/projects/milestones/milestones_sorting_spec.rb
+++ b/spec/features/projects/milestones/milestones_sorting_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
feature 'Milestones sorting', :js do
- include SortingHelper
let(:user) { create(:user) }
let(:project) { create(:project, name: 'test', namespace: user.namespace) }
diff --git a/spec/features/user_sorts_things_spec.rb b/spec/features/user_sorts_things_spec.rb
new file mode 100644
index 00000000000..69ebdddaeec
--- /dev/null
+++ b/spec/features/user_sorts_things_spec.rb
@@ -0,0 +1,57 @@
+require "spec_helper"
+
+# The main goal of this spec is not to check whether the sorting UI works, but
+# to check if the sorting option set by user is being kept persisted while going through pages.
+# The `it`s are named here by convention `starting point -> some pages -> final point`.
+# All those specs are moved out to this spec intentionally to keep them all in one place.
+describe "User sorts things" do
+ include Spec::Support::Helpers::Features::SortingHelpers
+ include Helpers::DashboardHelper
+
+ set(:project) { create(:project_empty_repo, :public) }
+ set(:current_user) { create(:user) } # Using `current_user` instead of just `user` because of the hardoced call in `assigned_mrs_dashboard_path` which is used below.
+ set(:issue) { create(:issue, project: project, author: current_user) }
+ set(:merge_request) { create(:merge_request, target_project: project, source_project: project, author: current_user) }
+
+ before do
+ project.add_developer(current_user)
+ sign_in(current_user)
+ end
+
+ it "issues -> project home page -> issues" do
+ sort_option = "Last updated"
+
+ visit(project_issues_path(project))
+
+ sort_by(sort_option)
+
+ visit(project_path(project))
+ visit(project_issues_path(project))
+
+ expect(find(".issues-filters")).to have_content(sort_option)
+ end
+
+ it "issues -> merge requests" do
+ sort_option = "Last updated"
+
+ visit(project_issues_path(project))
+
+ sort_by(sort_option)
+
+ visit(project_merge_requests_path(project))
+
+ expect(find(".issues-filters")).to have_content(sort_option)
+ end
+
+ it "merge requests -> dashboard merge requests" do
+ sort_option = "Last updated"
+
+ visit(project_merge_requests_path(project))
+
+ sort_by(sort_option)
+
+ visit(assigned_mrs_dashboard_path)
+
+ expect(find(".issues-filters")).to have_content(sort_option)
+ end
+end
diff --git a/spec/javascripts/boards/mock_data.js b/spec/javascripts/boards/mock_data.js
index 0671facb285..81f1a97112f 100644
--- a/spec/javascripts/boards/mock_data.js
+++ b/spec/javascripts/boards/mock_data.js
@@ -1,7 +1,4 @@
/* global BoardService */
-/* eslint-disable comma-dangle, no-unused-vars, quote-props */
-import _ from 'underscore';
-
export const listObj = {
id: 300,
position: 0,
@@ -11,8 +8,8 @@ export const listObj = {
id: 5000,
title: 'Testing',
color: 'red',
- description: 'testing;'
- }
+ description: 'testing;',
+ },
};
export const listObjDuplicate = {
@@ -24,35 +21,37 @@ export const listObjDuplicate = {
id: listObj.label.id,
title: 'Testing',
color: 'red',
- description: 'testing;'
- }
+ description: 'testing;',
+ },
};
export const BoardsMockData = {
- 'GET': {
+ GET: {
'/test/-/boards/1/lists/300/issues?id=300&page=1&=': {
- issues: [{
- title: 'Testing',
- id: 1,
- iid: 1,
- confidential: false,
- labels: [],
- assignees: [],
- }],
- }
+ issues: [
+ {
+ title: 'Testing',
+ id: 1,
+ iid: 1,
+ confidential: false,
+ labels: [],
+ assignees: [],
+ },
+ ],
+ },
+ },
+ POST: {
+ '/test/-/boards/1/lists': listObj,
},
- 'POST': {
- '/test/-/boards/1/lists': listObj
+ PUT: {
+ '/test/issue-boards/board/1/lists{/id}': {},
},
- 'PUT': {
- '/test/issue-boards/board/1/lists{/id}': {}
+ DELETE: {
+ '/test/issue-boards/board/1/lists{/id}': {},
},
- 'DELETE': {
- '/test/issue-boards/board/1/lists{/id}': {}
- }
};
-export const boardsMockInterceptor = (config) => {
+export const boardsMockInterceptor = config => {
const body = BoardsMockData[config.method.toUpperCase()][config.url];
return [200, body];
};
diff --git a/spec/javascripts/droplab/constants_spec.js b/spec/javascripts/droplab/constants_spec.js
index b9d28db74cc..23b69defec6 100644
--- a/spec/javascripts/droplab/constants_spec.js
+++ b/spec/javascripts/droplab/constants_spec.js
@@ -1,39 +1,37 @@
-/* eslint-disable */
-
import * as constants from '~/droplab/constants';
-describe('constants', function () {
- describe('DATA_TRIGGER', function () {
+describe('constants', function() {
+ describe('DATA_TRIGGER', function() {
it('should be `data-dropdown-trigger`', function() {
expect(constants.DATA_TRIGGER).toBe('data-dropdown-trigger');
});
});
- describe('DATA_DROPDOWN', function () {
+ describe('DATA_DROPDOWN', function() {
it('should be `data-dropdown`', function() {
expect(constants.DATA_DROPDOWN).toBe('data-dropdown');
});
});
- describe('SELECTED_CLASS', function () {
+ describe('SELECTED_CLASS', function() {
it('should be `droplab-item-selected`', function() {
expect(constants.SELECTED_CLASS).toBe('droplab-item-selected');
});
});
- describe('ACTIVE_CLASS', function () {
+ describe('ACTIVE_CLASS', function() {
it('should be `droplab-item-active`', function() {
expect(constants.ACTIVE_CLASS).toBe('droplab-item-active');
});
});
- describe('TEMPLATE_REGEX', function () {
+ describe('TEMPLATE_REGEX', function() {
it('should be a handlebars templating syntax regex', function() {
expect(constants.TEMPLATE_REGEX).toEqual(/\{\{(.+?)\}\}/g);
});
});
- describe('IGNORE_CLASS', function () {
+ describe('IGNORE_CLASS', function() {
it('should be `droplab-item-ignore`', function() {
expect(constants.IGNORE_CLASS).toBe('droplab-item-ignore');
});
diff --git a/spec/javascripts/notes/mock_data.js b/spec/javascripts/notes/mock_data.js
index 5be13ed0dfe..2d88cee61f1 100644
--- a/spec/javascripts/notes/mock_data.js
+++ b/spec/javascripts/notes/mock_data.js
@@ -1,4 +1,3 @@
-/* eslint-disable */
export const notesDataMock = {
discussionsPath: '/gitlab-org/gitlab-ce/issues/26/discussions.json',
lastFetchedAt: 1501862675,
@@ -43,7 +42,8 @@ export const noteableDataMock = {
milestone: null,
milestone_id: null,
moved_to_id: null,
- preview_note_path: '/gitlab-org/gitlab-ce/preview_markdown?quick_actions_target_id=98&quick_actions_target_type=Issue',
+ preview_note_path:
+ '/gitlab-org/gitlab-ce/preview_markdown?quick_actions_target_id=98&quick_actions_target_type=Issue',
project_id: 2,
state: 'opened',
time_estimate: 0,
@@ -60,465 +60,504 @@ export const individualNote = {
expanded: true,
id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd',
individual_note: true,
- notes: [{
- id: 1390,
- attachment: {
- url: null,
- filename: null,
- image: false,
- },
- author: {
- id: 1,
- name: 'Root',
- username: 'root',
- state: 'active',
- avatar_url: 'test',
- path: '/root',
+ notes: [
+ {
+ id: 1390,
+ attachment: {
+ url: null,
+ filename: null,
+ image: false,
+ },
+ author: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: 'test',
+ path: '/root',
+ },
+ created_at: '2017-08-01T17: 09: 33.762Z',
+ updated_at: '2017-08-01T17: 09: 33.762Z',
+ system: false,
+ noteable_id: 98,
+ noteable_type: 'Issue',
+ type: null,
+ human_access: 'Owner',
+ note: 'sdfdsaf',
+ note_html: "<p dir='auto'>sdfdsaf</p>",
+ current_user: { can_edit: true },
+ discussion_id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd',
+ emoji_awardable: true,
+ award_emoji: [
+ { name: 'baseball', user: { id: 1, name: 'Root', username: 'root' } },
+ { name: 'art', user: { id: 1, name: 'Root', username: 'root' } },
+ ],
+ toggle_award_path: '/gitlab-org/gitlab-ce/notes/1390/toggle_award_emoji',
+ report_abuse_path:
+ '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1390&user_id=1',
+ path: '/gitlab-org/gitlab-ce/notes/1390',
},
- created_at: '2017-08-01T17: 09: 33.762Z',
- updated_at: '2017-08-01T17: 09: 33.762Z',
- system: false,
- noteable_id: 98,
- noteable_type: 'Issue',
- type: null,
- human_access: 'Owner',
- note: 'sdfdsaf',
- note_html: '<p dir=\'auto\'>sdfdsaf</p>',
- current_user: { can_edit: true },
- discussion_id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd',
- emoji_awardable: true,
- award_emoji: [
- { name: 'baseball', user: { id: 1, name: 'Root', username: 'root' } },
- { name: 'art', user: { id: 1, name: 'Root', username: 'root' } },
- ],
- toggle_award_path: '/gitlab-org/gitlab-ce/notes/1390/toggle_award_emoji',
- report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1390&user_id=1',
- path: '/gitlab-org/gitlab-ce/notes/1390',
- }],
+ ],
reply_id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd',
};
export const note = {
- "id": 546,
- "attachment": {
- "url": null,
- "filename": null,
- "image": false
+ id: 546,
+ attachment: {
+ url: null,
+ filename: null,
+ image: false,
},
- "author": {
- "id": 1,
- "name": "Administrator",
- "username": "root",
- "state": "active",
- "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
- "path": "/root"
+ author: {
+ id: 1,
+ name: 'Administrator',
+ username: 'root',
+ state: 'active',
+ avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
+ path: '/root',
},
- "created_at": "2017-08-10T15:24:03.087Z",
- "updated_at": "2017-08-10T15:24:03.087Z",
- "system": false,
- "noteable_id": 67,
- "noteable_type": "Issue",
- "noteable_iid": 7,
- "type": null,
- "human_access": "Owner",
- "note": "Vel id placeat reprehenderit sit numquam.",
- "note_html": "<p dir=\"auto\">Vel id placeat reprehenderit sit numquam.</p>",
- "current_user": {
- "can_edit": true
+ created_at: '2017-08-10T15:24:03.087Z',
+ updated_at: '2017-08-10T15:24:03.087Z',
+ system: false,
+ noteable_id: 67,
+ noteable_type: 'Issue',
+ noteable_iid: 7,
+ type: null,
+ human_access: 'Owner',
+ note: 'Vel id placeat reprehenderit sit numquam.',
+ note_html: '<p dir="auto">Vel id placeat reprehenderit sit numquam.</p>',
+ current_user: {
+ can_edit: true,
},
- "discussion_id": "d3842a451b7f3d9a5dfce329515127b2d29a4cd0",
- "emoji_awardable": true,
- "award_emoji": [{
- "name": "baseball",
- "user": {
- "id": 1,
- "name": "Administrator",
- "username": "root"
- }
- }, {
- "name": "bath_tone3",
- "user": {
- "id": 1,
- "name": "Administrator",
- "username": "root"
- }
- }],
- "toggle_award_path": "/gitlab-org/gitlab-ce/notes/546/toggle_award_emoji",
- "report_abuse_path": "/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F7%23note_546&user_id=1",
- "path": "/gitlab-org/gitlab-ce/notes/546"
- }
+ discussion_id: 'd3842a451b7f3d9a5dfce329515127b2d29a4cd0',
+ emoji_awardable: true,
+ award_emoji: [
+ {
+ name: 'baseball',
+ user: {
+ id: 1,
+ name: 'Administrator',
+ username: 'root',
+ },
+ },
+ {
+ name: 'bath_tone3',
+ user: {
+ id: 1,
+ name: 'Administrator',
+ username: 'root',
+ },
+ },
+ ],
+ toggle_award_path: '/gitlab-org/gitlab-ce/notes/546/toggle_award_emoji',
+ report_abuse_path:
+ '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F7%23note_546&user_id=1',
+ path: '/gitlab-org/gitlab-ce/notes/546',
+};
export const discussionMock = {
id: '9e3bd2f71a01de45fd166e6719eb380ad9f270b1',
reply_id: '9e3bd2f71a01de45fd166e6719eb380ad9f270b1',
expanded: true,
- notes: [{
- id: 1395,
- attachment: {
- url: null,
- filename: null,
- image: false,
- },
- author: {
- id: 1,
- name: 'Root',
- username: 'root',
- state: 'active',
- avatar_url: null,
- path: '/root',
- },
- created_at: '2017-08-02T10:51:58.559Z',
- updated_at: '2017-08-02T10:51:58.559Z',
- system: false,
- noteable_id: 98,
- noteable_type: 'Issue',
- type: 'DiscussionNote',
- human_access: 'Owner',
- note: 'THIS IS A DICUSSSION!',
- note_html: '<p dir=\'auto\'>THIS IS A DICUSSSION!</p>',
- current_user: {
- can_edit: true,
- },
- discussion_id: '9e3bd2f71a01de45fd166e6719eb380ad9f270b1',
- emoji_awardable: true,
- award_emoji: [],
- toggle_award_path: '/gitlab-org/gitlab-ce/notes/1395/toggle_award_emoji',
- report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1395&user_id=1',
- path: '/gitlab-org/gitlab-ce/notes/1395',
- }, {
- id: 1396,
- attachment: {
- url: null,
- filename: null,
- image: false,
- },
- author: {
- id: 1,
- name: 'Root',
- username: 'root',
- state: 'active',
- avatar_url: null,
- path: '/root',
- },
- created_at: '2017-08-02T10:56:50.980Z',
- updated_at: '2017-08-03T14:19:35.691Z',
- system: false,
- noteable_id: 98,
- noteable_type: 'Issue',
- type: 'DiscussionNote',
- human_access: 'Owner',
- note: 'sadfasdsdgdsf',
- note_html: '<p dir=\'auto\'>sadfasdsdgdsf</p>',
- last_edited_at: '2017-08-03T14:19:35.691Z',
- last_edited_by: {
- id: 1,
- name: 'Root',
- username: 'root',
- state: 'active',
- avatar_url: null,
- path: '/root',
- },
- current_user: {
- can_edit: true,
+ notes: [
+ {
+ id: 1395,
+ attachment: {
+ url: null,
+ filename: null,
+ image: false,
+ },
+ author: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: null,
+ path: '/root',
+ },
+ created_at: '2017-08-02T10:51:58.559Z',
+ updated_at: '2017-08-02T10:51:58.559Z',
+ system: false,
+ noteable_id: 98,
+ noteable_type: 'Issue',
+ type: 'DiscussionNote',
+ human_access: 'Owner',
+ note: 'THIS IS A DICUSSSION!',
+ note_html: "<p dir='auto'>THIS IS A DICUSSSION!</p>",
+ current_user: {
+ can_edit: true,
+ },
+ discussion_id: '9e3bd2f71a01de45fd166e6719eb380ad9f270b1',
+ emoji_awardable: true,
+ award_emoji: [],
+ toggle_award_path: '/gitlab-org/gitlab-ce/notes/1395/toggle_award_emoji',
+ report_abuse_path:
+ '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1395&user_id=1',
+ path: '/gitlab-org/gitlab-ce/notes/1395',
},
- discussion_id: '9e3bd2f71a01de45fd166e6719eb380ad9f270b1',
- emoji_awardable: true,
- award_emoji: [],
- toggle_award_path: '/gitlab-org/gitlab-ce/notes/1396/toggle_award_emoji',
- report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1396&user_id=1',
- path: '/gitlab-org/gitlab-ce/notes/1396',
- }, {
- id: 1437,
- attachment: {
- url: null,
- filename: null,
- image: false,
+ {
+ id: 1396,
+ attachment: {
+ url: null,
+ filename: null,
+ image: false,
+ },
+ author: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: null,
+ path: '/root',
+ },
+ created_at: '2017-08-02T10:56:50.980Z',
+ updated_at: '2017-08-03T14:19:35.691Z',
+ system: false,
+ noteable_id: 98,
+ noteable_type: 'Issue',
+ type: 'DiscussionNote',
+ human_access: 'Owner',
+ note: 'sadfasdsdgdsf',
+ note_html: "<p dir='auto'>sadfasdsdgdsf</p>",
+ last_edited_at: '2017-08-03T14:19:35.691Z',
+ last_edited_by: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: null,
+ path: '/root',
+ },
+ current_user: {
+ can_edit: true,
+ },
+ discussion_id: '9e3bd2f71a01de45fd166e6719eb380ad9f270b1',
+ emoji_awardable: true,
+ award_emoji: [],
+ toggle_award_path: '/gitlab-org/gitlab-ce/notes/1396/toggle_award_emoji',
+ report_abuse_path:
+ '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1396&user_id=1',
+ path: '/gitlab-org/gitlab-ce/notes/1396',
},
- author: {
- id: 1,
- name: 'Root',
- username: 'root',
- state: 'active',
- avatar_url: null,
- path: '/root',
+ {
+ id: 1437,
+ attachment: {
+ url: null,
+ filename: null,
+ image: false,
+ },
+ author: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: null,
+ path: '/root',
+ },
+ created_at: '2017-08-03T18:11:18.780Z',
+ updated_at: '2017-08-04T09:52:31.062Z',
+ system: false,
+ noteable_id: 98,
+ noteable_type: 'Issue',
+ type: 'DiscussionNote',
+ human_access: 'Owner',
+ note: 'adsfasf Should disappear',
+ note_html: "<p dir='auto'>adsfasf Should disappear</p>",
+ last_edited_at: '2017-08-04T09:52:31.062Z',
+ last_edited_by: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: null,
+ path: '/root',
+ },
+ current_user: {
+ can_edit: true,
+ },
+ discussion_id: '9e3bd2f71a01de45fd166e6719eb380ad9f270b1',
+ emoji_awardable: true,
+ award_emoji: [],
+ toggle_award_path: '/gitlab-org/gitlab-ce/notes/1437/toggle_award_emoji',
+ report_abuse_path:
+ '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1437&user_id=1',
+ path: '/gitlab-org/gitlab-ce/notes/1437',
},
- created_at: '2017-08-03T18:11:18.780Z',
- updated_at: '2017-08-04T09:52:31.062Z',
- system: false,
- noteable_id: 98,
- noteable_type: 'Issue',
- type: 'DiscussionNote',
- human_access: 'Owner',
- note: 'adsfasf Should disappear',
- note_html: '<p dir=\'auto\'>adsfasf Should disappear</p>',
- last_edited_at: '2017-08-04T09:52:31.062Z',
- last_edited_by: {
+ ],
+ individual_note: false,
+};
+
+export const loggedOutnoteableData = {
+ id: 98,
+ iid: 26,
+ author_id: 1,
+ description: '',
+ lock_version: 1,
+ milestone_id: null,
+ state: 'opened',
+ title: 'asdsa',
+ updated_by_id: 1,
+ created_at: '2017-02-07T10:11:18.395Z',
+ updated_at: '2017-08-08T10:22:51.564Z',
+ time_estimate: 0,
+ total_time_spent: 0,
+ human_time_estimate: null,
+ human_total_time_spent: null,
+ milestone: null,
+ labels: [],
+ branch_name: null,
+ confidential: false,
+ assignees: [
+ {
id: 1,
name: 'Root',
username: 'root',
state: 'active',
avatar_url: null,
- path: '/root',
+ web_url: 'http://localhost:3000/root',
},
- current_user: {
- can_edit: true,
- },
- discussion_id: '9e3bd2f71a01de45fd166e6719eb380ad9f270b1',
- emoji_awardable: true,
- award_emoji: [],
- toggle_award_path: '/gitlab-org/gitlab-ce/notes/1437/toggle_award_emoji',
- report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1437&user_id=1',
- path: '/gitlab-org/gitlab-ce/notes/1437',
- }],
- individual_note: false,
-};
-
-export const loggedOutnoteableData = {
- "id": 98,
- "iid": 26,
- "author_id": 1,
- "description": "",
- "lock_version": 1,
- "milestone_id": null,
- "state": "opened",
- "title": "asdsa",
- "updated_by_id": 1,
- "created_at": "2017-02-07T10:11:18.395Z",
- "updated_at": "2017-08-08T10:22:51.564Z",
- "time_estimate": 0,
- "total_time_spent": 0,
- "human_time_estimate": null,
- "human_total_time_spent": null,
- "milestone": null,
- "labels": [],
- "branch_name": null,
- "confidential": false,
- "assignees": [{
- "id": 1,
- "name": "Root",
- "username": "root",
- "state": "active",
- "avatar_url": null,
- "web_url": "http://localhost:3000/root"
- }],
- "due_date": null,
- "moved_to_id": null,
- "project_id": 2,
- "web_url": "/gitlab-org/gitlab-ce/issues/26",
- "current_user": {
- "can_create_note": false,
- "can_update": false
+ ],
+ due_date: null,
+ moved_to_id: null,
+ project_id: 2,
+ web_url: '/gitlab-org/gitlab-ce/issues/26',
+ current_user: {
+ can_create_note: false,
+ can_update: false,
},
- "create_note_path": "/gitlab-org/gitlab-ce/notes?target_id=98&target_type=issue",
- "preview_note_path": "/gitlab-org/gitlab-ce/preview_markdown?quick_actions_target_id=98&quick_actions_target_type=Issue"
-}
+ create_note_path: '/gitlab-org/gitlab-ce/notes?target_id=98&target_type=issue',
+ preview_note_path:
+ '/gitlab-org/gitlab-ce/preview_markdown?quick_actions_target_id=98&quick_actions_target_type=Issue',
+};
export const INDIVIDUAL_NOTE_RESPONSE_MAP = {
- 'GET': {
- '/gitlab-org/gitlab-ce/issues/26/discussions.json': [{
- "id": "0fb4e0e3f9276e55ff32eb4195add694aece4edd",
- "reply_id": "0fb4e0e3f9276e55ff32eb4195add694aece4edd",
- "expanded": true,
- "notes": [{
- "id": 1390,
- "attachment": {
- "url": null,
- "filename": null,
- "image": false
- },
- "author": {
- "id": 1,
- "name": "Root",
- "username": "root",
- "state": "active",
- "avatar_url": null,
- "path": "/root"
- },
- "created_at": "2017-08-01T17:09:33.762Z",
- "updated_at": "2017-08-01T17:09:33.762Z",
- "system": false,
- "noteable_id": 98,
- "noteable_type": "Issue",
- "type": null,
- "human_access": "Owner",
- "note": "sdfdsaf",
- "note_html": "\u003cp dir=\"auto\"\u003esdfdsaf\u003c/p\u003e",
- "current_user": {
- "can_edit": true
- },
- "discussion_id": "0fb4e0e3f9276e55ff32eb4195add694aece4edd",
- "emoji_awardable": true,
- "award_emoji": [{
- "name": "baseball",
- "user": {
- "id": 1,
- "name": "Root",
- "username": "root"
- }
- }, {
- "name": "art",
- "user": {
- "id": 1,
- "name": "Root",
- "username": "root"
- }
- }],
- "toggle_award_path": "/gitlab-org/gitlab-ce/notes/1390/toggle_award_emoji",
- "report_abuse_path": "/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1390\u0026user_id=1",
- "path": "/gitlab-org/gitlab-ce/notes/1390"
- }],
- "individual_note": true
- }, {
- "id": "70d5c92a4039a36c70100c6691c18c27e4b0a790",
- "reply_id": "70d5c92a4039a36c70100c6691c18c27e4b0a790",
- "expanded": true,
- "notes": [{
- "id": 1391,
- "attachment": {
- "url": null,
- "filename": null,
- "image": false
- },
- "author": {
- "id": 1,
- "name": "Root",
- "username": "root",
- "state": "active",
- "avatar_url": null,
- "path": "/root"
- },
- "created_at": "2017-08-02T10:51:38.685Z",
- "updated_at": "2017-08-02T10:51:38.685Z",
- "system": false,
- "noteable_id": 98,
- "noteable_type": "Issue",
- "type": null,
- "human_access": "Owner",
- "note": "New note!",
- "note_html": "\u003cp dir=\"auto\"\u003eNew note!\u003c/p\u003e",
- "current_user": {
- "can_edit": true
- },
- "discussion_id": "70d5c92a4039a36c70100c6691c18c27e4b0a790",
- "emoji_awardable": true,
- "award_emoji": [],
- "toggle_award_path": "/gitlab-org/gitlab-ce/notes/1391/toggle_award_emoji",
- "report_abuse_path": "/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1391\u0026user_id=1",
- "path": "/gitlab-org/gitlab-ce/notes/1391"
- }],
- "individual_note": true
- }],
+ GET: {
+ '/gitlab-org/gitlab-ce/issues/26/discussions.json': [
+ {
+ id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd',
+ reply_id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd',
+ expanded: true,
+ notes: [
+ {
+ id: 1390,
+ attachment: {
+ url: null,
+ filename: null,
+ image: false,
+ },
+ author: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: null,
+ path: '/root',
+ },
+ created_at: '2017-08-01T17:09:33.762Z',
+ updated_at: '2017-08-01T17:09:33.762Z',
+ system: false,
+ noteable_id: 98,
+ noteable_type: 'Issue',
+ type: null,
+ human_access: 'Owner',
+ note: 'sdfdsaf',
+ note_html: '\u003cp dir="auto"\u003esdfdsaf\u003c/p\u003e',
+ current_user: {
+ can_edit: true,
+ },
+ discussion_id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd',
+ emoji_awardable: true,
+ award_emoji: [
+ {
+ name: 'baseball',
+ user: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ },
+ },
+ {
+ name: 'art',
+ user: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ },
+ },
+ ],
+ toggle_award_path: '/gitlab-org/gitlab-ce/notes/1390/toggle_award_emoji',
+ report_abuse_path:
+ '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1390\u0026user_id=1',
+ path: '/gitlab-org/gitlab-ce/notes/1390',
+ },
+ ],
+ individual_note: true,
+ },
+ {
+ id: '70d5c92a4039a36c70100c6691c18c27e4b0a790',
+ reply_id: '70d5c92a4039a36c70100c6691c18c27e4b0a790',
+ expanded: true,
+ notes: [
+ {
+ id: 1391,
+ attachment: {
+ url: null,
+ filename: null,
+ image: false,
+ },
+ author: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: null,
+ path: '/root',
+ },
+ created_at: '2017-08-02T10:51:38.685Z',
+ updated_at: '2017-08-02T10:51:38.685Z',
+ system: false,
+ noteable_id: 98,
+ noteable_type: 'Issue',
+ type: null,
+ human_access: 'Owner',
+ note: 'New note!',
+ note_html: '\u003cp dir="auto"\u003eNew note!\u003c/p\u003e',
+ current_user: {
+ can_edit: true,
+ },
+ discussion_id: '70d5c92a4039a36c70100c6691c18c27e4b0a790',
+ emoji_awardable: true,
+ award_emoji: [],
+ toggle_award_path: '/gitlab-org/gitlab-ce/notes/1391/toggle_award_emoji',
+ report_abuse_path:
+ '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1391\u0026user_id=1',
+ path: '/gitlab-org/gitlab-ce/notes/1391',
+ },
+ ],
+ individual_note: true,
+ },
+ ],
'/gitlab-org/gitlab-ce/noteable/issue/98/notes': {
last_fetched_at: 1512900838,
notes: [],
},
},
- 'PUT': {
+ PUT: {
'/gitlab-org/gitlab-ce/notes/1471': {
- "commands_changes": null,
- "valid": true,
- "id": 1471,
- "attachment": null,
- "author": {
- "id": 1,
- "name": "Root",
- "username": "root",
- "state": "active",
- "avatar_url": null,
- "path": "/root"
+ commands_changes: null,
+ valid: true,
+ id: 1471,
+ attachment: null,
+ author: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: null,
+ path: '/root',
},
- "created_at": "2017-08-08T16:53:00.666Z",
- "updated_at": "2017-12-10T11:03:21.876Z",
- "system": false,
- "noteable_id": 124,
- "noteable_type": "Issue",
- "noteable_iid": 29,
- "type": "DiscussionNote",
- "human_access": "Owner",
- "note": "Adding a comment",
- "note_html": "\u003cp dir=\"auto\"\u003eAdding a comment\u003c/p\u003e",
- "last_edited_at": "2017-12-10T11:03:21.876Z",
- "last_edited_by": {
- "id": 1,
- "name": 'Root',
- "username": 'root',
- "state": 'active',
- "avatar_url": null,
- "path": '/root',
+ created_at: '2017-08-08T16:53:00.666Z',
+ updated_at: '2017-12-10T11:03:21.876Z',
+ system: false,
+ noteable_id: 124,
+ noteable_type: 'Issue',
+ noteable_iid: 29,
+ type: 'DiscussionNote',
+ human_access: 'Owner',
+ note: 'Adding a comment',
+ note_html: '\u003cp dir="auto"\u003eAdding a comment\u003c/p\u003e',
+ last_edited_at: '2017-12-10T11:03:21.876Z',
+ last_edited_by: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: null,
+ path: '/root',
},
- "current_user": {
- "can_edit": true
+ current_user: {
+ can_edit: true,
},
- "discussion_id": "a3ed36e29b1957efb3b68c53e2d7a2b24b1df052",
- "emoji_awardable": true,
- "award_emoji": [],
- "toggle_award_path": "/gitlab-org/gitlab-ce/notes/1471/toggle_award_emoji",
- "report_abuse_path": "/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F29%23note_1471\u0026user_id=1",
- "path": "/gitlab-org/gitlab-ce/notes/1471"
+ discussion_id: 'a3ed36e29b1957efb3b68c53e2d7a2b24b1df052',
+ emoji_awardable: true,
+ award_emoji: [],
+ toggle_award_path: '/gitlab-org/gitlab-ce/notes/1471/toggle_award_emoji',
+ report_abuse_path:
+ '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F29%23note_1471\u0026user_id=1',
+ path: '/gitlab-org/gitlab-ce/notes/1471',
},
- }
+ },
};
export const DISCUSSION_NOTE_RESPONSE_MAP = {
...INDIVIDUAL_NOTE_RESPONSE_MAP,
- 'GET': {
+ GET: {
...INDIVIDUAL_NOTE_RESPONSE_MAP.GET,
- '/gitlab-org/gitlab-ce/issues/26/discussions.json': [{
- "id": "a3ed36e29b1957efb3b68c53e2d7a2b24b1df052",
- "reply_id": "a3ed36e29b1957efb3b68c53e2d7a2b24b1df052",
- "expanded": true,
- "notes": [{
- "id": 1471,
- "attachment": {
- "url": null,
- "filename": null,
- "image": false
- },
- "author": {
- "id": 1,
- "name": "Root",
- "username": "root",
- "state": "active",
- "avatar_url": null,
- "path": "/root"
- },
- "created_at": "2017-08-08T16:53:00.666Z",
- "updated_at": "2017-08-08T16:53:00.666Z",
- "system": false,
- "noteable_id": 124,
- "noteable_type": "Issue",
- "noteable_iid": 29,
- "type": "DiscussionNote",
- "human_access": "Owner",
- "note": "Adding a comment",
- "note_html": "\u003cp dir=\"auto\"\u003eAdding a comment\u003c/p\u003e",
- "current_user": {
- "can_edit": true
- },
- "discussion_id": "a3ed36e29b1957efb3b68c53e2d7a2b24b1df052",
- "emoji_awardable": true,
- "award_emoji": [],
- "toggle_award_path": "/gitlab-org/gitlab-ce/notes/1471/toggle_award_emoji",
- "report_abuse_path": "/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F29%23note_1471\u0026user_id=1",
- "path": "/gitlab-org/gitlab-ce/notes/1471"
- }],
- "individual_note": false
- }],
+ '/gitlab-org/gitlab-ce/issues/26/discussions.json': [
+ {
+ id: 'a3ed36e29b1957efb3b68c53e2d7a2b24b1df052',
+ reply_id: 'a3ed36e29b1957efb3b68c53e2d7a2b24b1df052',
+ expanded: true,
+ notes: [
+ {
+ id: 1471,
+ attachment: {
+ url: null,
+ filename: null,
+ image: false,
+ },
+ author: {
+ id: 1,
+ name: 'Root',
+ username: 'root',
+ state: 'active',
+ avatar_url: null,
+ path: '/root',
+ },
+ created_at: '2017-08-08T16:53:00.666Z',
+ updated_at: '2017-08-08T16:53:00.666Z',
+ system: false,
+ noteable_id: 124,
+ noteable_type: 'Issue',
+ noteable_iid: 29,
+ type: 'DiscussionNote',
+ human_access: 'Owner',
+ note: 'Adding a comment',
+ note_html: '\u003cp dir="auto"\u003eAdding a comment\u003c/p\u003e',
+ current_user: {
+ can_edit: true,
+ },
+ discussion_id: 'a3ed36e29b1957efb3b68c53e2d7a2b24b1df052',
+ emoji_awardable: true,
+ award_emoji: [],
+ toggle_award_path: '/gitlab-org/gitlab-ce/notes/1471/toggle_award_emoji',
+ report_abuse_path:
+ '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F29%23note_1471\u0026user_id=1',
+ path: '/gitlab-org/gitlab-ce/notes/1471',
+ },
+ ],
+ individual_note: false,
+ },
+ ],
},
};
export function individualNoteInterceptor(request, next) {
const body = INDIVIDUAL_NOTE_RESPONSE_MAP[request.method.toUpperCase()][request.url];
- next(request.respondWith(JSON.stringify(body), {
- status: 200,
- }));
+ next(
+ request.respondWith(JSON.stringify(body), {
+ status: 200,
+ }),
+ );
}
export function discussionNoteInterceptor(request, next) {
const body = DISCUSSION_NOTE_RESPONSE_MAP[request.method.toUpperCase()][request.url];
- next(request.respondWith(JSON.stringify(body), {
- status: 200,
- }));
+ next(
+ request.respondWith(JSON.stringify(body), {
+ status: 200,
+ }),
+ );
}
diff --git a/spec/javascripts/pipelines/graph/mock_data.js b/spec/javascripts/pipelines/graph/mock_data.js
index b9494f86d74..70eba98e939 100644
--- a/spec/javascripts/pipelines/graph/mock_data.js
+++ b/spec/javascripts/pipelines/graph/mock_data.js
@@ -1,232 +1,261 @@
-/* eslint-disable quote-props, quotes, comma-dangle */
export default {
- "id": 123,
- "user": {
- "name": "Root",
- "username": "root",
- "id": 1,
- "state": "active",
- "avatar_url": null,
- "web_url": "http://localhost:3000/root"
+ id: 123,
+ user: {
+ name: 'Root',
+ username: 'root',
+ id: 1,
+ state: 'active',
+ avatar_url: null,
+ web_url: 'http://localhost:3000/root',
},
- "active": false,
- "coverage": null,
- "path": "/root/ci-mock/pipelines/123",
- "details": {
- "status": {
- "icon": "icon_status_success",
- "text": "passed",
- "label": "passed",
- "group": "success",
- "has_details": true,
- "details_path": "/root/ci-mock/pipelines/123",
- "favicon": "/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico"
+ active: false,
+ coverage: null,
+ path: '/root/ci-mock/pipelines/123',
+ details: {
+ status: {
+ icon: 'icon_status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ has_details: true,
+ details_path: '/root/ci-mock/pipelines/123',
+ favicon:
+ '/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico',
},
- "duration": 9,
- "finished_at": "2017-04-19T14:30:27.542Z",
- "stages": [{
- "name": "test",
- "title": "test: passed",
- "groups": [{
- "name": "test",
- "size": 1,
- "status": {
- "icon": "icon_status_success",
- "text": "passed",
- "label": "passed",
- "group": "success",
- "has_details": true,
- "details_path": "/root/ci-mock/builds/4153",
- "favicon": "/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico",
- "action": {
- "icon": "retry",
- "title": "Retry",
- "path": "/root/ci-mock/builds/4153/retry",
- "method": "post"
- }
+ duration: 9,
+ finished_at: '2017-04-19T14:30:27.542Z',
+ stages: [
+ {
+ name: 'test',
+ title: 'test: passed',
+ groups: [
+ {
+ name: 'test',
+ size: 1,
+ status: {
+ icon: 'icon_status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ has_details: true,
+ details_path: '/root/ci-mock/builds/4153',
+ favicon:
+ '/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico',
+ action: {
+ icon: 'retry',
+ title: 'Retry',
+ path: '/root/ci-mock/builds/4153/retry',
+ method: 'post',
+ },
+ },
+ jobs: [
+ {
+ id: 4153,
+ name: 'test',
+ build_path: '/root/ci-mock/builds/4153',
+ retry_path: '/root/ci-mock/builds/4153/retry',
+ playable: false,
+ created_at: '2017-04-13T09:25:18.959Z',
+ updated_at: '2017-04-13T09:25:23.118Z',
+ status: {
+ icon: 'icon_status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ has_details: true,
+ details_path: '/root/ci-mock/builds/4153',
+ favicon:
+ '/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico',
+ action: {
+ icon: 'retry',
+ title: 'Retry',
+ path: '/root/ci-mock/builds/4153/retry',
+ method: 'post',
+ },
+ },
+ },
+ ],
+ },
+ ],
+ status: {
+ icon: 'icon_status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ has_details: true,
+ details_path: '/root/ci-mock/pipelines/123#test',
+ favicon:
+ '/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico',
},
- "jobs": [{
- "id": 4153,
- "name": "test",
- "build_path": "/root/ci-mock/builds/4153",
- "retry_path": "/root/ci-mock/builds/4153/retry",
- "playable": false,
- "created_at": "2017-04-13T09:25:18.959Z",
- "updated_at": "2017-04-13T09:25:23.118Z",
- "status": {
- "icon": "icon_status_success",
- "text": "passed",
- "label": "passed",
- "group": "success",
- "has_details": true,
- "details_path": "/root/ci-mock/builds/4153",
- "favicon": "/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico",
- "action": {
- "icon": "retry",
- "title": "Retry",
- "path": "/root/ci-mock/builds/4153/retry",
- "method": "post"
- }
- }
- }]
- }],
- "status": {
- "icon": "icon_status_success",
- "text": "passed",
- "label": "passed",
- "group": "success",
- "has_details": true,
- "details_path": "/root/ci-mock/pipelines/123#test",
- "favicon": "/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico"
+ path: '/root/ci-mock/pipelines/123#test',
+ dropdown_path: '/root/ci-mock/pipelines/123/stage.json?stage=test',
},
- "path": "/root/ci-mock/pipelines/123#test",
- "dropdown_path": "/root/ci-mock/pipelines/123/stage.json?stage=test"
- }, {
- "name": "deploy",
- "title": "deploy: passed",
- "groups": [{
- "name": "deploy to production",
- "size": 1,
- "status": {
- "icon": "icon_status_success",
- "text": "passed",
- "label": "passed",
- "group": "success",
- "has_details": true,
- "details_path": "/root/ci-mock/builds/4166",
- "favicon": "/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico",
- "action": {
- "icon": "retry",
- "title": "Retry",
- "path": "/root/ci-mock/builds/4166/retry",
- "method": "post"
- }
+ {
+ name: 'deploy',
+ title: 'deploy: passed',
+ groups: [
+ {
+ name: 'deploy to production',
+ size: 1,
+ status: {
+ icon: 'icon_status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ has_details: true,
+ details_path: '/root/ci-mock/builds/4166',
+ favicon:
+ '/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico',
+ action: {
+ icon: 'retry',
+ title: 'Retry',
+ path: '/root/ci-mock/builds/4166/retry',
+ method: 'post',
+ },
+ },
+ jobs: [
+ {
+ id: 4166,
+ name: 'deploy to production',
+ build_path: '/root/ci-mock/builds/4166',
+ retry_path: '/root/ci-mock/builds/4166/retry',
+ playable: false,
+ created_at: '2017-04-19T14:29:46.463Z',
+ updated_at: '2017-04-19T14:30:27.498Z',
+ status: {
+ icon: 'icon_status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ has_details: true,
+ details_path: '/root/ci-mock/builds/4166',
+ favicon:
+ '/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico',
+ action: {
+ icon: 'retry',
+ title: 'Retry',
+ path: '/root/ci-mock/builds/4166/retry',
+ method: 'post',
+ },
+ },
+ },
+ ],
+ },
+ {
+ name: 'deploy to staging',
+ size: 1,
+ status: {
+ icon: 'icon_status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ has_details: true,
+ details_path: '/root/ci-mock/builds/4159',
+ favicon:
+ '/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico',
+ action: {
+ icon: 'retry',
+ title: 'Retry',
+ path: '/root/ci-mock/builds/4159/retry',
+ method: 'post',
+ },
+ },
+ jobs: [
+ {
+ id: 4159,
+ name: 'deploy to staging',
+ build_path: '/root/ci-mock/builds/4159',
+ retry_path: '/root/ci-mock/builds/4159/retry',
+ playable: false,
+ created_at: '2017-04-18T16:32:08.420Z',
+ updated_at: '2017-04-18T16:32:12.631Z',
+ status: {
+ icon: 'icon_status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ has_details: true,
+ details_path: '/root/ci-mock/builds/4159',
+ favicon:
+ '/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico',
+ action: {
+ icon: 'retry',
+ title: 'Retry',
+ path: '/root/ci-mock/builds/4159/retry',
+ method: 'post',
+ },
+ },
+ },
+ ],
+ },
+ ],
+ status: {
+ icon: 'icon_status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ has_details: true,
+ details_path: '/root/ci-mock/pipelines/123#deploy',
+ favicon:
+ '/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico',
},
- "jobs": [{
- "id": 4166,
- "name": "deploy to production",
- "build_path": "/root/ci-mock/builds/4166",
- "retry_path": "/root/ci-mock/builds/4166/retry",
- "playable": false,
- "created_at": "2017-04-19T14:29:46.463Z",
- "updated_at": "2017-04-19T14:30:27.498Z",
- "status": {
- "icon": "icon_status_success",
- "text": "passed",
- "label": "passed",
- "group": "success",
- "has_details": true,
- "details_path": "/root/ci-mock/builds/4166",
- "favicon": "/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico",
- "action": {
- "icon": "retry",
- "title": "Retry",
- "path": "/root/ci-mock/builds/4166/retry",
- "method": "post"
- }
- }
- }]
- }, {
- "name": "deploy to staging",
- "size": 1,
- "status": {
- "icon": "icon_status_success",
- "text": "passed",
- "label": "passed",
- "group": "success",
- "has_details": true,
- "details_path": "/root/ci-mock/builds/4159",
- "favicon": "/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico",
- "action": {
- "icon": "retry",
- "title": "Retry",
- "path": "/root/ci-mock/builds/4159/retry",
- "method": "post"
- }
- },
- "jobs": [{
- "id": 4159,
- "name": "deploy to staging",
- "build_path": "/root/ci-mock/builds/4159",
- "retry_path": "/root/ci-mock/builds/4159/retry",
- "playable": false,
- "created_at": "2017-04-18T16:32:08.420Z",
- "updated_at": "2017-04-18T16:32:12.631Z",
- "status": {
- "icon": "icon_status_success",
- "text": "passed",
- "label": "passed",
- "group": "success",
- "has_details": true,
- "details_path": "/root/ci-mock/builds/4159",
- "favicon": "/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico",
- "action": {
- "icon": "retry",
- "title": "Retry",
- "path": "/root/ci-mock/builds/4159/retry",
- "method": "post"
- }
- }
- }]
- }],
- "status": {
- "icon": "icon_status_success",
- "text": "passed",
- "label": "passed",
- "group": "success",
- "has_details": true,
- "details_path": "/root/ci-mock/pipelines/123#deploy",
- "favicon": "/assets/ci_favicons/dev/favicon_status_success-308b4fc054cdd1b68d0865e6cfb7b02e92e3472f201507418f8eddb74ac11a59.ico"
+ path: '/root/ci-mock/pipelines/123#deploy',
+ dropdown_path: '/root/ci-mock/pipelines/123/stage.json?stage=deploy',
+ },
+ ],
+ artifacts: [],
+ manual_actions: [
+ {
+ name: 'deploy to production',
+ path: '/root/ci-mock/builds/4166/play',
+ playable: false,
},
- "path": "/root/ci-mock/pipelines/123#deploy",
- "dropdown_path": "/root/ci-mock/pipelines/123/stage.json?stage=deploy"
- }],
- "artifacts": [],
- "manual_actions": [{
- "name": "deploy to production",
- "path": "/root/ci-mock/builds/4166/play",
- "playable": false
- }]
+ ],
},
- "flags": {
- "latest": true,
- "triggered": false,
- "stuck": false,
- "yaml_errors": false,
- "retryable": false,
- "cancelable": false
+ flags: {
+ latest: true,
+ triggered: false,
+ stuck: false,
+ yaml_errors: false,
+ retryable: false,
+ cancelable: false,
},
- "ref": {
- "name": "master",
- "path": "/root/ci-mock/tree/master",
- "tag": false,
- "branch": true
+ ref: {
+ name: 'master',
+ path: '/root/ci-mock/tree/master',
+ tag: false,
+ branch: true,
},
- "commit": {
- "id": "798e5f902592192afaba73f4668ae30e56eae492",
- "short_id": "798e5f90",
- "title": "Merge branch 'new-branch' into 'master'\r",
- "created_at": "2017-04-13T10:25:17.000+01:00",
- "parent_ids": ["54d483b1ed156fbbf618886ddf7ab023e24f8738", "c8e2d38a6c538822e81c57022a6e3a0cfedebbcc"],
- "message": "Merge branch 'new-branch' into 'master'\r\n\r\nAdd new file\r\n\r\nSee merge request !1",
- "author_name": "Root",
- "author_email": "admin@example.com",
- "authored_date": "2017-04-13T10:25:17.000+01:00",
- "committer_name": "Root",
- "committer_email": "admin@example.com",
- "committed_date": "2017-04-13T10:25:17.000+01:00",
- "author": {
- "name": "Root",
- "username": "root",
- "id": 1,
- "state": "active",
- "avatar_url": null,
- "web_url": "http://localhost:3000/root"
+ commit: {
+ id: '798e5f902592192afaba73f4668ae30e56eae492',
+ short_id: '798e5f90',
+ title: "Merge branch 'new-branch' into 'master'\r",
+ created_at: '2017-04-13T10:25:17.000+01:00',
+ parent_ids: [
+ '54d483b1ed156fbbf618886ddf7ab023e24f8738',
+ 'c8e2d38a6c538822e81c57022a6e3a0cfedebbcc',
+ ],
+ message:
+ "Merge branch 'new-branch' into 'master'\r\n\r\nAdd new file\r\n\r\nSee merge request !1",
+ author_name: 'Root',
+ author_email: 'admin@example.com',
+ authored_date: '2017-04-13T10:25:17.000+01:00',
+ committer_name: 'Root',
+ committer_email: 'admin@example.com',
+ committed_date: '2017-04-13T10:25:17.000+01:00',
+ author: {
+ name: 'Root',
+ username: 'root',
+ id: 1,
+ state: 'active',
+ avatar_url: null,
+ web_url: 'http://localhost:3000/root',
},
- "author_gravatar_url": null,
- "commit_url": "http://localhost:3000/root/ci-mock/commit/798e5f902592192afaba73f4668ae30e56eae492",
- "commit_path": "/root/ci-mock/commit/798e5f902592192afaba73f4668ae30e56eae492"
+ author_gravatar_url: null,
+ commit_url:
+ 'http://localhost:3000/root/ci-mock/commit/798e5f902592192afaba73f4668ae30e56eae492',
+ commit_path: '/root/ci-mock/commit/798e5f902592192afaba73f4668ae30e56eae492',
},
- "created_at": "2017-04-13T09:25:18.881Z",
- "updated_at": "2017-04-19T14:30:27.561Z"
+ created_at: '2017-04-13T09:25:18.881Z',
+ updated_at: '2017-04-19T14:30:27.561Z',
};
diff --git a/spec/javascripts/sidebar/confidential_issue_sidebar_spec.js b/spec/javascripts/sidebar/confidential_issue_sidebar_spec.js
index 88a33caf2e3..0c173062835 100644
--- a/spec/javascripts/sidebar/confidential_issue_sidebar_spec.js
+++ b/spec/javascripts/sidebar/confidential_issue_sidebar_spec.js
@@ -62,4 +62,22 @@ describe('Confidential Issue Sidebar Block', () => {
done();
});
});
+
+ it('displays the edit form when opened from collapsed state', (done) => {
+ expect(vm1.edit).toBe(false);
+
+ vm1.$el.querySelector('.sidebar-collapsed-icon').click();
+
+ expect(vm1.edit).toBe(true);
+
+ setTimeout(() => {
+ expect(
+ vm1.$el
+ .innerHTML
+ .includes('You are going to turn off the confidentiality.'),
+ ).toBe(true);
+
+ done();
+ });
+ });
});
diff --git a/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js b/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js
index 696fca516bc..9abc3daf221 100644
--- a/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js
+++ b/spec/javascripts/sidebar/lock/lock_issue_sidebar_spec.js
@@ -68,4 +68,22 @@ describe('LockIssueSidebar', () => {
done();
});
});
+
+ it('displays the edit form when opened from collapsed state', (done) => {
+ expect(vm1.isLockDialogOpen).toBe(false);
+
+ vm1.$el.querySelector('.sidebar-collapsed-icon').click();
+
+ expect(vm1.isLockDialogOpen).toBe(true);
+
+ setTimeout(() => {
+ expect(
+ vm1.$el
+ .innerHTML
+ .includes('Unlock this issue?'),
+ ).toBe(true);
+
+ done();
+ });
+ });
});
diff --git a/spec/javascripts/sidebar/mock_data.js b/spec/javascripts/sidebar/mock_data.js
index d9e84e35f69..8b6e8b24f00 100644
--- a/spec/javascripts/sidebar/mock_data.js
+++ b/spec/javascripts/sidebar/mock_data.js
@@ -1,7 +1,5 @@
-/* eslint-disable quote-props*/
-
const RESPONSE_MAP = {
- 'GET': {
+ GET: {
'/gitlab-org/gitlab-shell/issues/5.json': {
id: 45,
iid: 5,
@@ -27,7 +25,8 @@ const RESPONSE_MAP = {
username: 'user0',
id: 22,
state: 'active',
- avatar_url: 'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
web_url: 'http: //localhost:3001/user0',
},
{
@@ -35,7 +34,8 @@ const RESPONSE_MAP = {
username: 'tajuana',
id: 18,
state: 'active',
- avatar_url: 'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
web_url: 'http: //localhost:3001/tajuana',
},
{
@@ -43,7 +43,8 @@ const RESPONSE_MAP = {
username: 'michaele.will',
id: 16,
state: 'active',
- avatar_url: 'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
web_url: 'http: //localhost:3001/michaele.will',
},
],
@@ -72,7 +73,8 @@ const RESPONSE_MAP = {
username: 'user0',
id: 22,
state: 'active',
- avatar_url: 'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/user0',
},
{
@@ -80,7 +82,8 @@ const RESPONSE_MAP = {
username: 'tajuana',
id: 18,
state: 'active',
- avatar_url: 'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/tajuana',
},
{
@@ -88,7 +91,8 @@ const RESPONSE_MAP = {
username: 'michaele.will',
id: 16,
state: 'active',
- avatar_url: 'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/michaele.will',
},
],
@@ -100,7 +104,8 @@ const RESPONSE_MAP = {
username: 'user0',
id: 22,
state: 'active',
- avatar_url: 'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/52e4ce24a915fb7e51e1ad3b57f4b00a?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/user0',
},
{
@@ -108,7 +113,8 @@ const RESPONSE_MAP = {
username: 'tajuana',
id: 18,
state: 'active',
- avatar_url: 'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/4852a41fb41616bf8f140d3701673f53?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/tajuana',
},
{
@@ -116,7 +122,8 @@ const RESPONSE_MAP = {
username: 'michaele.will',
id: 16,
state: 'active',
- avatar_url: 'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/e301827eb03be955c9c172cb9a8e4e8a?s=80\u0026d=identicon',
web_url: 'http://localhost:3001/michaele.will',
},
],
@@ -126,20 +133,21 @@ const RESPONSE_MAP = {
},
'/autocomplete/projects?project_id=15': [
{
- 'id': 0,
- 'name_with_namespace': 'No project',
- }, {
- 'id': 20,
- 'name_with_namespace': 'foo / bar',
+ id: 0,
+ name_with_namespace: 'No project',
+ },
+ {
+ id: 20,
+ name_with_namespace: 'foo / bar',
},
],
},
- 'PUT': {
+ PUT: {
'/gitlab-org/gitlab-shell/issues/5.json': {
data: {},
},
},
- 'POST': {
+ POST: {
'/gitlab-org/gitlab-shell/issues/5/move': {
id: 123,
iid: 5,
@@ -182,7 +190,8 @@ const mockData = {
id: 1,
name: 'Administrator',
username: 'root',
- avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
},
rootPath: '/',
fullPath: '/gitlab-org/gitlab-shell',
@@ -201,12 +210,14 @@ const mockData = {
},
};
-mockData.sidebarMockInterceptor = function (request, next) {
+mockData.sidebarMockInterceptor = function(request, next) {
const body = this.responseMap[request.method.toUpperCase()][request.url];
- next(request.respondWith(JSON.stringify(body), {
- status: 200,
- }));
+ next(
+ request.respondWith(JSON.stringify(body), {
+ status: 200,
+ }),
+ );
}.bind(mockData);
export default mockData;
diff --git a/spec/javascripts/vue_mr_widget/mock_data.js b/spec/javascripts/vue_mr_widget/mock_data.js
index 3dd75307484..3fc7663b9c2 100644
--- a/spec/javascripts/vue_mr_widget/mock_data.js
+++ b/spec/javascripts/vue_mr_widget/mock_data.js
@@ -1,213 +1,218 @@
-/* eslint-disable */
-
export default {
- "id": 132,
- "iid": 22,
- "assignee_id": null,
- "author_id": 1,
- "description": "",
- "lock_version": null,
- "milestone_id": null,
- "position": 0,
- "state": "merged",
- "title": "Update README.md",
- "updated_by_id": null,
- "created_at": "2017-04-07T12:27:26.718Z",
- "updated_at": "2017-04-07T15:39:25.852Z",
- "time_estimate": 0,
- "total_time_spent": 0,
- "human_time_estimate": null,
- "human_total_time_spent": null,
- "in_progress_merge_commit_sha": null,
- "merge_commit_sha": "53027d060246c8f47e4a9310fb332aa52f221775",
- "merge_error": null,
- "merge_params": {
- "force_remove_source_branch": null
+ id: 132,
+ iid: 22,
+ assignee_id: null,
+ author_id: 1,
+ description: '',
+ lock_version: null,
+ milestone_id: null,
+ position: 0,
+ state: 'merged',
+ title: 'Update README.md',
+ updated_by_id: null,
+ created_at: '2017-04-07T12:27:26.718Z',
+ updated_at: '2017-04-07T15:39:25.852Z',
+ time_estimate: 0,
+ total_time_spent: 0,
+ human_time_estimate: null,
+ human_total_time_spent: null,
+ in_progress_merge_commit_sha: null,
+ merge_commit_sha: '53027d060246c8f47e4a9310fb332aa52f221775',
+ merge_error: null,
+ merge_params: {
+ force_remove_source_branch: null,
},
- "merge_status": "can_be_merged",
- "merge_user_id": null,
- "merge_when_pipeline_succeeds": false,
- "source_branch": "daaaa",
- "source_branch_link": "daaaa",
- "source_project_id": 19,
- "target_branch": "master",
- "target_project_id": 19,
- "metrics": {
- "merged_by": {
- "name": "Administrator",
- "username": "root",
- "id": 1,
- "state": "active",
- "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
- "web_url": "http://localhost:3000/root"
+ merge_status: 'can_be_merged',
+ merge_user_id: null,
+ merge_when_pipeline_succeeds: false,
+ source_branch: 'daaaa',
+ source_branch_link: 'daaaa',
+ source_project_id: 19,
+ target_branch: 'master',
+ target_project_id: 19,
+ metrics: {
+ merged_by: {
+ name: 'Administrator',
+ username: 'root',
+ id: 1,
+ state: 'active',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
+ web_url: 'http://localhost:3000/root',
},
- "merged_at": "2017-04-07T15:39:25.696Z",
- "closed_by": null,
- "closed_at": null
+ merged_at: '2017-04-07T15:39:25.696Z',
+ closed_by: null,
+ closed_at: null,
},
- "author": {
- "name": "Administrator",
- "username": "root",
- "id": 1,
- "state": "active",
- "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
- "web_url": "http://localhost:3000/root"
+ author: {
+ name: 'Administrator',
+ username: 'root',
+ id: 1,
+ state: 'active',
+ avatar_url: 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
+ web_url: 'http://localhost:3000/root',
},
- "merge_user": null,
- "diff_head_sha": "104096c51715e12e7ae41f9333e9fa35b73f385d",
- "diff_head_commit_short_id": "104096c5",
- "merge_commit_message": "Merge branch 'daaaa' into 'master'\n\nUpdate README.md\n\nSee merge request !22",
- "pipeline": {
- "id": 172,
- "user": {
- "name": "Administrator",
- "username": "root",
- "id": 1,
- "state": "active",
- "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
- "web_url": "http://localhost:3000/root"
+ merge_user: null,
+ diff_head_sha: '104096c51715e12e7ae41f9333e9fa35b73f385d',
+ diff_head_commit_short_id: '104096c5',
+ merge_commit_message:
+ "Merge branch 'daaaa' into 'master'\n\nUpdate README.md\n\nSee merge request !22",
+ pipeline: {
+ id: 172,
+ user: {
+ name: 'Administrator',
+ username: 'root',
+ id: 1,
+ state: 'active',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
+ web_url: 'http://localhost:3000/root',
},
- "active": false,
- "coverage": "92.16",
- "path": "/root/acets-app/pipelines/172",
- "details": {
- "status": {
- "icon": "icon_status_success",
- "favicon": "favicon_status_success",
- "text": "passed",
- "label": "passed",
- "group": "success",
- "has_details": true,
- "details_path": "/root/acets-app/pipelines/172"
+ active: false,
+ coverage: '92.16',
+ path: '/root/acets-app/pipelines/172',
+ details: {
+ status: {
+ icon: 'icon_status_success',
+ favicon: 'favicon_status_success',
+ text: 'passed',
+ label: 'passed',
+ group: 'success',
+ has_details: true,
+ details_path: '/root/acets-app/pipelines/172',
},
- "duration": null,
- "finished_at": "2017-04-07T14:00:14.256Z",
- "stages": [
+ duration: null,
+ finished_at: '2017-04-07T14:00:14.256Z',
+ stages: [
{
- "name": "build",
- "title": "build: failed",
- "status": {
- "icon": "icon_status_failed",
- "favicon": "favicon_status_failed",
- "text": "failed",
- "label": "failed",
- "group": "failed",
- "has_details": true,
- "details_path": "/root/acets-app/pipelines/172#build"
+ name: 'build',
+ title: 'build: failed',
+ status: {
+ icon: 'icon_status_failed',
+ favicon: 'favicon_status_failed',
+ text: 'failed',
+ label: 'failed',
+ group: 'failed',
+ has_details: true,
+ details_path: '/root/acets-app/pipelines/172#build',
},
- "path": "/root/acets-app/pipelines/172#build",
- "dropdown_path": "/root/acets-app/pipelines/172/stage.json?stage=build"
+ path: '/root/acets-app/pipelines/172#build',
+ dropdown_path: '/root/acets-app/pipelines/172/stage.json?stage=build',
},
{
- "name": "review",
- "title": "review: skipped",
- "status": {
- "icon": "icon_status_skipped",
- "favicon": "favicon_status_skipped",
- "text": "skipped",
- "label": "skipped",
- "group": "skipped",
- "has_details": true,
- "details_path": "/root/acets-app/pipelines/172#review"
+ name: 'review',
+ title: 'review: skipped',
+ status: {
+ icon: 'icon_status_skipped',
+ favicon: 'favicon_status_skipped',
+ text: 'skipped',
+ label: 'skipped',
+ group: 'skipped',
+ has_details: true,
+ details_path: '/root/acets-app/pipelines/172#review',
},
- "path": "/root/acets-app/pipelines/172#review",
- "dropdown_path": "/root/acets-app/pipelines/172/stage.json?stage=review"
- }
- ],
- "artifacts": [
-
+ path: '/root/acets-app/pipelines/172#review',
+ dropdown_path: '/root/acets-app/pipelines/172/stage.json?stage=review',
+ },
],
- "manual_actions": [
+ artifacts: [],
+ manual_actions: [
{
- "name": "stop_review",
- "path": "/root/acets-app/builds/1427/play",
- "playable": false
- }
- ]
+ name: 'stop_review',
+ path: '/root/acets-app/builds/1427/play',
+ playable: false,
+ },
+ ],
},
- "flags": {
- "latest": false,
- "triggered": false,
- "stuck": false,
- "yaml_errors": false,
- "retryable": true,
- "cancelable": false
+ flags: {
+ latest: false,
+ triggered: false,
+ stuck: false,
+ yaml_errors: false,
+ retryable: true,
+ cancelable: false,
},
- "ref": {
- "name": "daaaa",
- "path": "/root/acets-app/tree/daaaa",
- "tag": false,
- "branch": true
+ ref: {
+ name: 'daaaa',
+ path: '/root/acets-app/tree/daaaa',
+ tag: false,
+ branch: true,
},
- "commit": {
- "id": "104096c51715e12e7ae41f9333e9fa35b73f385d",
- "short_id": "104096c5",
- "title": "Update README.md",
- "created_at": "2017-04-07T15:27:18.000+03:00",
- "parent_ids": [
- "2396536178668d8930c29d904e53bd4d06228b32"
- ],
- "message": "Update README.md",
- "author_name": "Administrator",
- "author_email": "admin@example.com",
- "authored_date": "2017-04-07T15:27:18.000+03:00",
- "committer_name": "Administrator",
- "committer_email": "admin@example.com",
- "committed_date": "2017-04-07T15:27:18.000+03:00",
- "author": {
- "name": "Administrator",
- "username": "root",
- "id": 1,
- "state": "active",
- "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
- "web_url": "http://localhost:3000/root"
+ commit: {
+ id: '104096c51715e12e7ae41f9333e9fa35b73f385d',
+ short_id: '104096c5',
+ title: 'Update README.md',
+ created_at: '2017-04-07T15:27:18.000+03:00',
+ parent_ids: ['2396536178668d8930c29d904e53bd4d06228b32'],
+ message: 'Update README.md',
+ author_name: 'Administrator',
+ author_email: 'admin@example.com',
+ authored_date: '2017-04-07T15:27:18.000+03:00',
+ committer_name: 'Administrator',
+ committer_email: 'admin@example.com',
+ committed_date: '2017-04-07T15:27:18.000+03:00',
+ author: {
+ name: 'Administrator',
+ username: 'root',
+ id: 1,
+ state: 'active',
+ avatar_url:
+ 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
+ web_url: 'http://localhost:3000/root',
},
- "author_gravatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
- "commit_url": "http://localhost:3000/root/acets-app/commit/104096c51715e12e7ae41f9333e9fa35b73f385d",
- "commit_path": "/root/acets-app/commit/104096c51715e12e7ae41f9333e9fa35b73f385d"
+ author_gravatar_url:
+ 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
+ commit_url:
+ 'http://localhost:3000/root/acets-app/commit/104096c51715e12e7ae41f9333e9fa35b73f385d',
+ commit_path: '/root/acets-app/commit/104096c51715e12e7ae41f9333e9fa35b73f385d',
},
- "retry_path": "/root/acets-app/pipelines/172/retry",
- "created_at": "2017-04-07T12:27:19.520Z",
- "updated_at": "2017-04-07T15:28:44.800Z"
+ retry_path: '/root/acets-app/pipelines/172/retry',
+ created_at: '2017-04-07T12:27:19.520Z',
+ updated_at: '2017-04-07T15:28:44.800Z',
},
- "work_in_progress": false,
- "source_branch_exists": false,
- "mergeable_discussions_state": true,
- "conflicts_can_be_resolved_in_ui": false,
- "branch_missing": true,
- "commits_count": 1,
- "has_conflicts": false,
- "can_be_merged": true,
- "has_ci": true,
- "ci_status": "success",
- "pipeline_status_path": "/root/acets-app/merge_requests/22/pipeline_status",
- "issues_links": {
- "closing": "",
- "mentioned_but_not_closing": ""
+ work_in_progress: false,
+ source_branch_exists: false,
+ mergeable_discussions_state: true,
+ conflicts_can_be_resolved_in_ui: false,
+ branch_missing: true,
+ commits_count: 1,
+ has_conflicts: false,
+ can_be_merged: true,
+ has_ci: true,
+ ci_status: 'success',
+ pipeline_status_path: '/root/acets-app/merge_requests/22/pipeline_status',
+ issues_links: {
+ closing: '',
+ mentioned_but_not_closing: '',
},
- "current_user": {
- "can_resolve_conflicts": true,
- "can_remove_source_branch": false,
- "can_revert_on_current_merge_request": true,
- "can_cherry_pick_on_current_merge_request": true
+ current_user: {
+ can_resolve_conflicts: true,
+ can_remove_source_branch: false,
+ can_revert_on_current_merge_request: true,
+ can_cherry_pick_on_current_merge_request: true,
},
- "target_branch_path": "/root/acets-app/branches/master",
- "source_branch_path": "/root/acets-app/branches/daaaa",
- "conflict_resolution_ui_path": "/root/acets-app/merge_requests/22/conflicts",
- "remove_wip_path": "/root/acets-app/merge_requests/22/remove_wip",
- "cancel_merge_when_pipeline_succeeds_path": "/root/acets-app/merge_requests/22/cancel_merge_when_pipeline_succeeds",
- "create_issue_to_resolve_discussions_path": "/root/acets-app/issues/new?merge_request_to_resolve_discussions_of=22",
- "merge_path": "/root/acets-app/merge_requests/22/merge",
- "cherry_pick_in_fork_path": "/root/acets-app/forks?continue%5Bnotice%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+has+been+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.+Try+to+revert+this+commit+again.&continue%5Bnotice_now%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+is+being+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.&continue%5Bto%5D=%2Froot%2Facets-app%2Fmerge_requests%2F22&namespace_key=1",
- "revert_in_fork_path": "/root/acets-app/forks?continue%5Bnotice%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+has+been+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.+Try+to+cherry-pick+this+commit+again.&continue%5Bnotice_now%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+is+being+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.&continue%5Bto%5D=%2Froot%2Facets-app%2Fmerge_requests%2F22&namespace_key=1",
- "email_patches_path": "/root/acets-app/merge_requests/22.patch",
- "plain_diff_path": "/root/acets-app/merge_requests/22.diff",
- "status_path": "/root/acets-app/merge_requests/22.json",
- "merge_check_path": "/root/acets-app/merge_requests/22/merge_check",
- "ci_environments_status_url": "/root/acets-app/merge_requests/22/ci_environments_status",
- "project_archived": false,
- "merge_commit_message_with_description": "Merge branch 'daaaa' into 'master'\n\nUpdate README.md\n\nSee merge request !22",
- "diverged_commits_count": 0,
- "only_allow_merge_if_pipeline_succeeds": false,
- "commit_change_content_path": "/root/acets-app/merge_requests/22/commit_change_content"
-}
+ target_branch_path: '/root/acets-app/branches/master',
+ source_branch_path: '/root/acets-app/branches/daaaa',
+ conflict_resolution_ui_path: '/root/acets-app/merge_requests/22/conflicts',
+ remove_wip_path: '/root/acets-app/merge_requests/22/remove_wip',
+ cancel_merge_when_pipeline_succeeds_path:
+ '/root/acets-app/merge_requests/22/cancel_merge_when_pipeline_succeeds',
+ create_issue_to_resolve_discussions_path:
+ '/root/acets-app/issues/new?merge_request_to_resolve_discussions_of=22',
+ merge_path: '/root/acets-app/merge_requests/22/merge',
+ cherry_pick_in_fork_path:
+ '/root/acets-app/forks?continue%5Bnotice%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+has+been+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.+Try+to+revert+this+commit+again.&continue%5Bnotice_now%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+is+being+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.&continue%5Bto%5D=%2Froot%2Facets-app%2Fmerge_requests%2F22&namespace_key=1',
+ revert_in_fork_path:
+ '/root/acets-app/forks?continue%5Bnotice%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+has+been+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.+Try+to+cherry-pick+this+commit+again.&continue%5Bnotice_now%5D=You%27re+not+allowed+to+make+changes+to+this+project+directly.+A+fork+of+this+project+is+being+created+that+you+can+make+changes+in%2C+so+you+can+submit+a+merge+request.&continue%5Bto%5D=%2Froot%2Facets-app%2Fmerge_requests%2F22&namespace_key=1',
+ email_patches_path: '/root/acets-app/merge_requests/22.patch',
+ plain_diff_path: '/root/acets-app/merge_requests/22.diff',
+ status_path: '/root/acets-app/merge_requests/22.json',
+ merge_check_path: '/root/acets-app/merge_requests/22/merge_check',
+ ci_environments_status_url: '/root/acets-app/merge_requests/22/ci_environments_status',
+ project_archived: false,
+ merge_commit_message_with_description:
+ "Merge branch 'daaaa' into 'master'\n\nUpdate README.md\n\nSee merge request !22",
+ diverged_commits_count: 0,
+ only_allow_merge_if_pipeline_succeeds: false,
+ commit_change_content_path: '/root/acets-app/merge_requests/22/commit_change_content',
+};
diff --git a/spec/javascripts/vue_shared/components/mock_data.js b/spec/javascripts/vue_shared/components/mock_data.js
index 0d781bdca74..15b56c58c33 100644
--- a/spec/javascripts/vue_shared/components/mock_data.js
+++ b/spec/javascripts/vue_shared/components/mock_data.js
@@ -1,5 +1,3 @@
-/* eslint-disable */
-
export const mockMetrics = [
[1493716685, '4.30859375'],
[1493716745, '4.30859375'],
diff --git a/spec/lib/gitlab/git/checksum_spec.rb b/spec/lib/gitlab/git/checksum_spec.rb
new file mode 100644
index 00000000000..8ff310905bf
--- /dev/null
+++ b/spec/lib/gitlab/git/checksum_spec.rb
@@ -0,0 +1,38 @@
+require 'spec_helper'
+
+describe Gitlab::Git::Checksum, seed_helper: true do
+ let(:storage) { 'default' }
+
+ it 'raises Gitlab::Git::Repository::NoRepository when there is no repo' do
+ checksum = described_class.new(storage, 'nonexistent-repo')
+
+ expect { checksum.calculate }.to raise_error Gitlab::Git::Repository::NoRepository
+ end
+
+ it 'pretends that checksum is 000000... when the repo is empty' do
+ FileUtils.rm_rf(File.join(SEED_STORAGE_PATH, 'empty-repo.git'))
+
+ system(git_env, *%W(#{Gitlab.config.git.bin_path} init --bare empty-repo.git),
+ chdir: SEED_STORAGE_PATH,
+ out: '/dev/null',
+ err: '/dev/null')
+
+ checksum = described_class.new(storage, 'empty-repo')
+
+ expect(checksum.calculate).to eq '0000000000000000000000000000000000000000'
+ end
+
+ it 'raises Gitlab::Git::Repository::Failure when shelling out to git return non-zero status' do
+ checksum = described_class.new(storage, 'gitlab-git-test')
+
+ allow(checksum).to receive(:popen).and_return(['output', nil])
+
+ expect { checksum.calculate }.to raise_error Gitlab::Git::Checksum::Failure
+ end
+
+ it 'calculates the checksum when there is a repo' do
+ checksum = described_class.new(storage, 'gitlab-git-test')
+
+ expect(checksum.calculate).to eq '54f21be4c32c02f6788d72207fa03ad3bce725e4'
+ end
+end
diff --git a/spec/lib/gitlab/git/gitmodules_parser_spec.rb b/spec/lib/gitlab/git/gitmodules_parser_spec.rb
index 143aa2218c9..6fd2b33486b 100644
--- a/spec/lib/gitlab/git/gitmodules_parser_spec.rb
+++ b/spec/lib/gitlab/git/gitmodules_parser_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::Git::GitmodulesParser do
it 'should parse a .gitmodules file correctly' do
- parser = described_class.new(<<-'GITMODULES'.strip_heredoc)
+ data = <<~GITMODULES
[submodule "vendor/libgit2"]
path = vendor/libgit2
[submodule "vendor/libgit2"]
@@ -16,6 +16,7 @@ describe Gitlab::Git::GitmodulesParser do
url = https://example.com/another/project
GITMODULES
+ parser = described_class.new(data.gsub("\n", "\r\n"))
modules = parser.parse
expect(modules).to eq({
diff --git a/spec/lib/gitlab/http_spec.rb b/spec/lib/gitlab/http_spec.rb
index b0bc081a3c8..d0dadfa78da 100644
--- a/spec/lib/gitlab/http_spec.rb
+++ b/spec/lib/gitlab/http_spec.rb
@@ -12,11 +12,11 @@ describe Gitlab::HTTP do
end
it 'deny requests to localhost' do
- expect { described_class.get('http://localhost:3003') }.to raise_error(URI::InvalidURIError)
+ expect { described_class.get('http://localhost:3003') }.to raise_error(Gitlab::HTTP::BlockedUrlError)
end
it 'deny requests to private network' do
- expect { described_class.get('http://192.168.1.2:3003') }.to raise_error(URI::InvalidURIError)
+ expect { described_class.get('http://192.168.1.2:3003') }.to raise_error(Gitlab::HTTP::BlockedUrlError)
end
context 'if allow_local_requests set to true' do
@@ -41,7 +41,7 @@ describe Gitlab::HTTP do
context 'if allow_local_requests set to false' do
it 'override the global value and ban requests to localhost or private network' do
- expect { described_class.get('http://localhost:3003', allow_local_requests: false) }.to raise_error(URI::InvalidURIError)
+ expect { described_class.get('http://localhost:3003', allow_local_requests: false) }.to raise_error(Gitlab::HTTP::BlockedUrlError)
end
end
end
diff --git a/spec/lib/gitlab/metrics/sidekiq_metrics_exporter_spec.rb b/spec/lib/gitlab/metrics/sidekiq_metrics_exporter_spec.rb
index 6721e02fb85..61eb059a731 100644
--- a/spec/lib/gitlab/metrics/sidekiq_metrics_exporter_spec.rb
+++ b/spec/lib/gitlab/metrics/sidekiq_metrics_exporter_spec.rb
@@ -38,7 +38,9 @@ describe Gitlab::Metrics::SidekiqMetricsExporter do
expect(::WEBrick::HTTPServer).to have_received(:new).with(
Port: port,
- BindAddress: address
+ BindAddress: address,
+ Logger: anything,
+ AccessLog: anything
)
end
end
diff --git a/spec/lib/gitlab/performance_bar_spec.rb b/spec/lib/gitlab/performance_bar_spec.rb
index b8a2267f1a4..f480376acb4 100644
--- a/spec/lib/gitlab/performance_bar_spec.rb
+++ b/spec/lib/gitlab/performance_bar_spec.rb
@@ -25,6 +25,12 @@ describe Gitlab::PerformanceBar do
expect(described_class.enabled?(nil)).to be_falsy
end
+ it 'returns true when given user is an admin' do
+ user = build_stubbed(:user, :admin)
+
+ expect(described_class.enabled?(user)).to be_truthy
+ end
+
it 'returns false when allowed_group_id is nil' do
expect(described_class).to receive(:allowed_group_id).and_return(nil)
diff --git a/spec/lib/gitlab/url_blocker_spec.rb b/spec/lib/gitlab/url_blocker_spec.rb
index 2d35b026485..a3b3dc3be6d 100644
--- a/spec/lib/gitlab/url_blocker_spec.rb
+++ b/spec/lib/gitlab/url_blocker_spec.rb
@@ -74,13 +74,13 @@ describe Gitlab::UrlBlocker do
expect(described_class.blocked_url?('https://gitlab.com/foo/foo.git')).to be false
end
- context 'when allow_private_networks is' do
- let(:private_networks) { ['192.168.1.2', '10.0.0.2', '172.16.0.2'] }
+ context 'when allow_local_network is' do
+ let(:local_ips) { ['192.168.1.2', '10.0.0.2', '172.16.0.2'] }
let(:fake_domain) { 'www.fakedomain.fake' }
context 'true (default)' do
it 'does not block urls from private networks' do
- private_networks.each do |ip|
+ local_ips.each do |ip|
stub_domain_resolv(fake_domain, ip)
expect(described_class).not_to be_blocked_url("http://#{fake_domain}")
@@ -94,14 +94,14 @@ describe Gitlab::UrlBlocker do
context 'false' do
it 'blocks urls from private networks' do
- private_networks.each do |ip|
+ local_ips.each do |ip|
stub_domain_resolv(fake_domain, ip)
- expect(described_class).to be_blocked_url("http://#{fake_domain}", allow_private_networks: false)
+ expect(described_class).to be_blocked_url("http://#{fake_domain}", allow_local_network: false)
unstub_domain_resolv
- expect(described_class).to be_blocked_url("http://#{ip}", allow_private_networks: false)
+ expect(described_class).to be_blocked_url("http://#{ip}", allow_local_network: false)
end
end
end
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 83c33797bbc..971a88e9ee9 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -389,6 +389,36 @@ describe Notify do
end
end
end
+
+ describe 'that have new commits' do
+ let(:push_user) { create(:user) }
+
+ subject do
+ described_class.push_to_merge_request_email(recipient.id, merge_request.id, push_user.id, new_commits: merge_request.commits)
+ end
+
+ it_behaves_like 'a multiple recipients email'
+ it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
+ let(:model) { merge_request }
+ end
+ it_behaves_like 'it should show Gmail Actions View Merge request link'
+ it_behaves_like 'an unsubscribeable thread'
+
+ it 'is sent as the push user' do
+ sender = subject.header[:from].addrs[0]
+
+ expect(sender.display_name).to eq(push_user.name)
+ expect(sender.address).to eq(gitlab_sender)
+ end
+
+ it 'has the correct subject and body' do
+ aggregate_failures do
+ is_expected.to have_referable_subject(merge_request, reply: true)
+ is_expected.to have_body_text("#{push_user.name} pushed new commits")
+ is_expected.to have_body_text(project_merge_request_path(project, merge_request))
+ end
+ end
+ end
end
context 'for issue notes' do
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 96adf64bcec..fef868ac0f2 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -224,14 +224,14 @@ describe Project do
project2 = build(:project, import_url: 'http://localhost:9000/t.git')
expect(project2).to be_invalid
- expect(project2.errors[:import_url]).to include('imports are not allowed from that URL')
+ expect(project2.errors[:import_url].first).to include('Requests to localhost are not allowed')
end
it "does not allow blocked import_url port" do
project2 = build(:project, import_url: 'http://github.com:25/t.git')
expect(project2).to be_invalid
- expect(project2.errors[:import_url]).to include('imports are not allowed from that URL')
+ expect(project2.errors[:import_url].first).to include('Only allowed ports are 22, 80, 443')
end
describe 'project pending deletion' do
diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb
index 5084b36c761..4f3420cc0ad 100644
--- a/spec/requests/api/runner_spec.rb
+++ b/spec/requests/api/runner_spec.rb
@@ -1159,11 +1159,13 @@ describe API::Runner do
let!(:artifacts) { file_upload }
let!(:artifacts_sha256) { Digest::SHA256.file(artifacts.path).hexdigest }
let!(:metadata) { file_upload2 }
+ let!(:metadata_sha256) { Digest::SHA256.file(metadata.path).hexdigest }
let(:stored_artifacts_file) { job.reload.artifacts_file.file }
let(:stored_metadata_file) { job.reload.artifacts_metadata.file }
let(:stored_artifacts_size) { job.reload.artifacts_size }
let(:stored_artifacts_sha256) { job.reload.job_artifacts_archive.file_sha256 }
+ let(:stored_metadata_sha256) { job.reload.job_artifacts_metadata.file_sha256 }
before do
post(api("/jobs/#{job.id}/artifacts"), post_data, headers_with_token)
@@ -1175,7 +1177,8 @@ describe API::Runner do
'file.name' => artifacts.original_filename,
'file.sha256' => artifacts_sha256,
'metadata.path' => metadata.path,
- 'metadata.name' => metadata.original_filename }
+ 'metadata.name' => metadata.original_filename,
+ 'metadata.sha256' => metadata_sha256 }
end
it 'stores artifacts and artifacts metadata' do
@@ -1184,6 +1187,7 @@ describe API::Runner do
expect(stored_metadata_file.original_filename).to eq(metadata.original_filename)
expect(stored_artifacts_size).to eq(72821)
expect(stored_artifacts_sha256).to eq(artifacts_sha256)
+ expect(stored_metadata_sha256).to eq(metadata_sha256)
end
end
diff --git a/spec/serializers/discussion_entity_spec.rb b/spec/serializers/discussion_entity_spec.rb
index 7ee8e38af1c..7e19e74ca00 100644
--- a/spec/serializers/discussion_entity_spec.rb
+++ b/spec/serializers/discussion_entity_spec.rb
@@ -6,7 +6,7 @@ describe DiscussionEntity do
let(:user) { create(:user) }
let(:note) { create(:discussion_note_on_merge_request) }
let(:discussion) { note.discussion }
- let(:request) { double('request') }
+ let(:request) { double('request', note_entity: ProjectNoteEntity) }
let(:controller) { double('controller') }
let(:entity) { described_class.new(discussion, request: request, context: controller) }
diff --git a/spec/serializers/note_entity_spec.rb b/spec/serializers/note_entity_spec.rb
index 51a8587ace9..13cda781cda 100644
--- a/spec/serializers/note_entity_spec.rb
+++ b/spec/serializers/note_entity_spec.rb
@@ -10,53 +10,5 @@ describe NoteEntity do
let(:user) { create(:user) }
subject { entity.as_json }
- context 'basic note' do
- it 'exposes correct elements' do
- expect(subject).to include(:type, :author, :human_access, :note, :note_html, :current_user,
- :discussion_id, :emoji_awardable, :award_emoji, :toggle_award_path, :report_abuse_path, :path, :attachment)
- end
-
- it 'does not expose elements for specific notes cases' do
- expect(subject).not_to include(:last_edited_by, :last_edited_at, :system_note_icon_name)
- end
-
- it 'exposes author correctly' do
- expect(subject[:author]).to include(:id, :name, :username, :state, :avatar_url, :path)
- end
-
- it 'does not expose web_url for author' do
- expect(subject[:author]).not_to include(:web_url)
- end
- end
-
- context 'when note was edited' do
- before do
- note.update(updated_at: 1.minute.from_now, updated_by: user)
- end
-
- it 'exposes last_edited_at and last_edited_by elements' do
- expect(subject).to include(:last_edited_at, :last_edited_by)
- end
- end
-
- context 'when note is a system note' do
- before do
- note.update(system: true)
- end
-
- it 'exposes system_note_icon_name element' do
- expect(subject).to include(:system_note_icon_name)
- end
- end
-
- context 'when note is part of resolvable discussion' do
- before do
- allow(note).to receive(:part_of_discussion?).and_return(true)
- allow(note).to receive(:resolvable?).and_return(true)
- end
-
- it 'exposes paths to resolve note' do
- expect(subject).to include(:resolve_path, :resolve_with_issue_path)
- end
- end
+ it_behaves_like 'note entity'
end
diff --git a/spec/serializers/project_note_entity_spec.rb b/spec/serializers/project_note_entity_spec.rb
new file mode 100644
index 00000000000..dafd1cf603e
--- /dev/null
+++ b/spec/serializers/project_note_entity_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe ProjectNoteEntity do
+ include Gitlab::Routing
+
+ let(:request) { double('request', current_user: user, noteable: note.noteable) }
+
+ let(:entity) { described_class.new(note, request: request) }
+ let(:note) { create(:note) }
+ let(:user) { create(:user) }
+ subject { entity.as_json }
+
+ it_behaves_like 'note entity'
+
+ it 'exposes project-specific elements' do
+ expect(subject).to include(:human_access, :toggle_award_path, :path)
+ end
+
+ context 'when note is part of resolvable discussion' do
+ before do
+ allow(note).to receive(:part_of_discussion?).and_return(true)
+ allow(note).to receive(:resolvable?).and_return(true)
+ end
+
+ it 'exposes paths to resolve note' do
+ expect(subject).to include(:resolve_path, :resolve_with_issue_path)
+ end
+ end
+end
diff --git a/spec/services/projects/import_service_spec.rb b/spec/services/projects/import_service_spec.rb
index bf7facaec99..30c89ebd821 100644
--- a/spec/services/projects/import_service_spec.rb
+++ b/spec/services/projects/import_service_spec.rb
@@ -156,7 +156,7 @@ describe Projects::ImportService do
result = described_class.new(project, user).execute
expect(result[:status]).to eq :error
- expect(result[:message]).to end_with 'Blocked import URL.'
+ expect(result[:message]).to include('Requests to localhost are not allowed')
end
it 'fails with port 25' do
@@ -165,7 +165,7 @@ describe Projects::ImportService do
result = described_class.new(project, user).execute
expect(result[:status]).to eq :error
- expect(result[:message]).to end_with 'Blocked import URL.'
+ expect(result[:message]).to include('Only allowed ports are 22, 80, 443')
end
end
diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb
index 934106627a9..dd31a677dfe 100644
--- a/spec/services/projects/update_pages_service_spec.rb
+++ b/spec/services/projects/update_pages_service_spec.rb
@@ -87,7 +87,8 @@ describe Projects::UpdatePagesService do
it 'fails for empty file fails' do
build.update_attributes(legacy_artifacts_file: empty_file)
- expect(execute).not_to eq(:success)
+ expect { execute }
+ .to raise_error(Projects::UpdatePagesService::FailedToExtractError)
end
end
end
@@ -159,7 +160,8 @@ describe Projects::UpdatePagesService do
it 'fails for empty file fails' do
build.job_artifacts_archive.update_attributes(file: empty_file)
- expect(execute).not_to eq(:success)
+ expect { execute }
+ .to raise_error(Projects::UpdatePagesService::FailedToExtractError)
end
context 'when timeout happens by DNS error' do
@@ -172,7 +174,39 @@ describe Projects::UpdatePagesService do
expect { execute }.to raise_error(SocketError)
build.reload
- expect(build.artifacts?).to eq(true)
+ expect(deploy_status).to be_failed
+ expect(build.artifacts?).to be_truthy
+ end
+ end
+
+ context 'when failed to extract zip artifacts' do
+ before do
+ allow_any_instance_of(described_class)
+ .to receive(:extract_zip_archive!)
+ .and_raise(Projects::UpdatePagesService::FailedToExtractError)
+ end
+
+ it 'raises an error' do
+ expect { execute }
+ .to raise_error(Projects::UpdatePagesService::FailedToExtractError)
+
+ build.reload
+ expect(deploy_status).to be_failed
+ expect(build.artifacts?).to be_truthy
+ end
+ end
+
+ context 'when missing artifacts metadata' do
+ before do
+ allow(build).to receive(:artifacts_metadata?).and_return(false)
+ end
+
+ it 'does not raise an error and remove artifacts as failed job' do
+ execute
+
+ build.reload
+ expect(deploy_status).to be_failed
+ expect(build.artifacts?).to be_falsey
end
end
end
diff --git a/spec/support/cookie_helper.rb b/spec/support/cookie_helper.rb
index d72925e1838..5ff7b0b68c9 100644
--- a/spec/support/cookie_helper.rb
+++ b/spec/support/cookie_helper.rb
@@ -2,12 +2,25 @@
#
module CookieHelper
def set_cookie(name, value, options = {})
+ case page.driver
+ when Capybara::RackTest::Driver
+ rack_set_cookie(name, value)
+ else
+ selenium_set_cookie(name, value, options)
+ end
+ end
+
+ def selenium_set_cookie(name, value, options = {})
# Selenium driver will not set cookies for a given domain when the browser is at `about:blank`.
# It also doesn't appear to allow overriding the cookie path. loading `/` is the most inclusive.
visit options.fetch(:path, '/') unless on_a_page?
page.driver.browser.manage.add_cookie(name: name, value: value, **options)
end
+ def rack_set_cookie(name, value)
+ page.driver.browser.set_cookie("#{name}=#{value}")
+ end
+
def get_cookie(name)
page.driver.browser.manage.cookie_named(name)
end
diff --git a/spec/support/features/discussion_comments_shared_example.rb b/spec/support/features/discussion_comments_shared_example.rb
index c8662d41769..80604395adf 100644
--- a/spec/support/features/discussion_comments_shared_example.rb
+++ b/spec/support/features/discussion_comments_shared_example.rb
@@ -81,7 +81,10 @@ shared_examples 'discussion comments' do |resource_name|
# on issues page, the menu closes when clicking anywhere, on other pages it will
# remain open if clicking divider or menu padding, but should not change button action
- if resource_name == 'issue'
+ #
+ # if dropdown menu is not toggled (and also not present),
+ # it's "issue-type" dropdown
+ if first(menu_selector).nil?
expect(find(dropdown_selector)).to have_content 'Comment'
find(toggle_selector).click
@@ -107,8 +110,10 @@ shared_examples 'discussion comments' do |resource_name|
end
it 'updates the submit button text and closes the dropdown' do
+ button = find(submit_selector)
+
# on issues page, the submit input is a <button>, on other pages it is <input>
- if resource_name == 'issue'
+ if button.tag_name == 'button'
expect(find(submit_selector)).to have_content 'Start discussion'
else
expect(find(submit_selector).value).to eq 'Start discussion'
@@ -132,6 +137,8 @@ shared_examples 'discussion comments' do |resource_name|
describe 'creating a discussion' do
before do
find(submit_selector).click
+ wait_for_requests
+
find(comments_selector, match: :first)
end
@@ -197,11 +204,13 @@ shared_examples 'discussion comments' do |resource_name|
end
it 'updates the submit button text and closes the dropdown' do
+ button = find(submit_selector)
+
# on issues page, the submit input is a <button>, on other pages it is <input>
- if resource_name == 'issue'
- expect(find(submit_selector)).to have_content 'Comment'
+ if button.tag_name == 'button'
+ expect(button).to have_content 'Comment'
else
- expect(find(submit_selector).value).to eq 'Comment'
+ expect(button.value).to eq 'Comment'
end
expect(page).not_to have_selector menu_selector
diff --git a/spec/support/features/issuable_slash_commands_shared_examples.rb b/spec/support/features/issuable_slash_commands_shared_examples.rb
index f61469f673d..1bd6c25100e 100644
--- a/spec/support/features/issuable_slash_commands_shared_examples.rb
+++ b/spec/support/features/issuable_slash_commands_shared_examples.rb
@@ -2,7 +2,7 @@
# It takes a `issuable_type`, and expect an `issuable`.
shared_examples 'issuable record that supports quick actions in its description and notes' do |issuable_type|
- include QuickActionsHelpers
+ include Spec::Support::Helpers::Features::NotesHelpers
let(:master) { create(:user) }
let(:project) do
@@ -61,7 +61,7 @@ shared_examples 'issuable record that supports quick actions in its description
context 'with a note containing commands' do
it 'creates a note without the commands and interpret the commands accordingly' do
assignee = create(:user, username: 'bob')
- write_note("Awesome!\n\n/assign @bob\n\n/label ~bug\n\n/milestone %\"ASAP\"")
+ add_note("Awesome!\n\n/assign @bob\n\n/label ~bug\n\n/milestone %\"ASAP\"")
expect(page).to have_content 'Awesome!'
expect(page).not_to have_content '/assign @bob'
@@ -82,7 +82,7 @@ shared_examples 'issuable record that supports quick actions in its description
context 'with a note containing only commands' do
it 'does not create a note but interpret the commands accordingly' do
assignee = create(:user, username: 'bob')
- write_note("/assign @bob\n\n/label ~bug\n\n/milestone %\"ASAP\"")
+ add_note("/assign @bob\n\n/label ~bug\n\n/milestone %\"ASAP\"")
expect(page).not_to have_content '/assign @bob'
expect(page).not_to have_content '/label ~bug'
@@ -105,7 +105,7 @@ shared_examples 'issuable record that supports quick actions in its description
context "when current user can close #{issuable_type}" do
it "closes the #{issuable_type}" do
- write_note("/close")
+ add_note("/close")
expect(page).not_to have_content '/close'
expect(page).to have_content 'Commands applied'
@@ -125,7 +125,7 @@ shared_examples 'issuable record that supports quick actions in its description
end
it "does not close the #{issuable_type}" do
- write_note("/close")
+ add_note("/close")
expect(page).not_to have_content 'Commands applied'
@@ -142,7 +142,7 @@ shared_examples 'issuable record that supports quick actions in its description
context "when current user can reopen #{issuable_type}" do
it "reopens the #{issuable_type}" do
- write_note("/reopen")
+ add_note("/reopen")
expect(page).not_to have_content '/reopen'
expect(page).to have_content 'Commands applied'
@@ -162,7 +162,7 @@ shared_examples 'issuable record that supports quick actions in its description
end
it "does not reopen the #{issuable_type}" do
- write_note("/reopen")
+ add_note("/reopen")
expect(page).not_to have_content 'Commands applied'
@@ -174,7 +174,7 @@ shared_examples 'issuable record that supports quick actions in its description
context "with a note changing the #{issuable_type}'s title" do
context "when current user can change title of #{issuable_type}" do
it "reopens the #{issuable_type}" do
- write_note("/title Awesome new title")
+ add_note("/title Awesome new title")
expect(page).not_to have_content '/title'
expect(page).to have_content 'Commands applied'
@@ -194,7 +194,7 @@ shared_examples 'issuable record that supports quick actions in its description
end
it "does not change the #{issuable_type} title" do
- write_note("/title Awesome new title")
+ add_note("/title Awesome new title")
expect(page).not_to have_content 'Commands applied'
@@ -205,7 +205,7 @@ shared_examples 'issuable record that supports quick actions in its description
context "with a note marking the #{issuable_type} as todo" do
it "creates a new todo for the #{issuable_type}" do
- write_note("/todo")
+ add_note("/todo")
expect(page).not_to have_content '/todo'
expect(page).to have_content 'Commands applied'
@@ -236,7 +236,7 @@ shared_examples 'issuable record that supports quick actions in its description
expect(todo.author).to eq master
expect(todo.user).to eq master
- write_note("/done")
+ add_note("/done")
expect(page).not_to have_content '/done'
expect(page).to have_content 'Commands applied'
@@ -249,7 +249,7 @@ shared_examples 'issuable record that supports quick actions in its description
it "creates a new todo for the #{issuable_type}" do
expect(issuable.subscribed?(master, project)).to be_falsy
- write_note("/subscribe")
+ add_note("/subscribe")
expect(page).not_to have_content '/subscribe'
expect(page).to have_content 'Commands applied'
@@ -266,7 +266,7 @@ shared_examples 'issuable record that supports quick actions in its description
it "creates a new todo for the #{issuable_type}" do
expect(issuable.subscribed?(master, project)).to be_truthy
- write_note("/unsubscribe")
+ add_note("/unsubscribe")
expect(page).not_to have_content '/unsubscribe'
expect(page).to have_content 'Commands applied'
@@ -277,7 +277,7 @@ shared_examples 'issuable record that supports quick actions in its description
context "with a note assigning the #{issuable_type} to the current user" do
it "assigns the #{issuable_type} to the current user" do
- write_note("/assign me")
+ add_note("/assign me")
expect(page).not_to have_content '/assign me'
expect(page).to have_content 'Commands applied'
diff --git a/spec/support/helpers/features/notes_helpers.rb b/spec/support/helpers/features/notes_helpers.rb
new file mode 100644
index 00000000000..1a1d5853a7a
--- /dev/null
+++ b/spec/support/helpers/features/notes_helpers.rb
@@ -0,0 +1,27 @@
+# These helpers allow you to manipulate with notes.
+#
+# Usage:
+# describe "..." do
+# include Spec::Support::Helpers::Features::NotesHelpers
+# ...
+#
+# add_note("Hello world!")
+#
+module Spec
+ module Support
+ module Helpers
+ module Features
+ module NotesHelpers
+ def add_note(text)
+ Sidekiq::Testing.fake! do
+ page.within(".js-main-target-form") do
+ fill_in("note[note]", with: text)
+ find(".js-comment-submit-button").click
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spec/support/helpers/features/sorting_helpers.rb b/spec/support/helpers/features/sorting_helpers.rb
new file mode 100644
index 00000000000..50457b64745
--- /dev/null
+++ b/spec/support/helpers/features/sorting_helpers.rb
@@ -0,0 +1,26 @@
+# These helpers allow you to manipulate with sorting features.
+#
+# Usage:
+# describe "..." do
+# include Spec::Support::Helpers::Features::SortingHelpers
+# ...
+#
+# sort_by("Last updated")
+#
+module Spec
+ module Support
+ module Helpers
+ module Features
+ module SortingHelpers
+ def sort_by(value)
+ find('button.dropdown-toggle').click
+
+ page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do
+ click_link(value)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb
index d08183846a0..db34090e971 100644
--- a/spec/support/login_helpers.rb
+++ b/spec/support/login_helpers.rb
@@ -140,6 +140,10 @@ module LoginHelpers
end
allow(Gitlab::Auth::OAuth::Provider).to receive_messages(providers: [:saml], config_for: mock_saml_config)
stub_omniauth_setting(messages)
+ stub_saml_authorize_path_helpers
+ end
+
+ def stub_saml_authorize_path_helpers
allow_any_instance_of(Object).to receive(:user_saml_omniauth_authorize_path).and_return('/users/auth/saml')
allow_any_instance_of(Object).to receive(:omniauth_authorize_path).with(:user, "saml").and_return('/users/auth/saml')
end
diff --git a/spec/support/matchers/issuable_matchers.rb b/spec/support/matchers/issuable_matchers.rb
new file mode 100644
index 00000000000..f5d9a97051a
--- /dev/null
+++ b/spec/support/matchers/issuable_matchers.rb
@@ -0,0 +1,11 @@
+RSpec::Matchers.define :have_header_with_correct_id_and_link do |level, text, id, parent = ".wiki"|
+ match do |actual|
+ node = find("#{parent} h#{level} a#user-content-#{id}")
+
+ expect(node[:href]).to end_with("##{id}")
+
+ # Work around a weird Capybara behavior where calling `parent` on a node
+ # returns the whole document, not the node's actual parent element
+ expect(find(:xpath, "#{node.path}/..").text).to eq(text)
+ end
+end
diff --git a/spec/support/quick_actions_helpers.rb b/spec/support/quick_actions_helpers.rb
deleted file mode 100644
index 361190aa352..00000000000
--- a/spec/support/quick_actions_helpers.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-module QuickActionsHelpers
- def write_note(text)
- Sidekiq::Testing.fake! do
- page.within('.js-main-target-form') do
- fill_in 'note[note]', with: text
- find('.js-comment-submit-button').click
- end
- end
- end
-end
diff --git a/spec/support/shared_examples/serializers/note_entity_examples.rb b/spec/support/shared_examples/serializers/note_entity_examples.rb
new file mode 100644
index 00000000000..9097c8e5513
--- /dev/null
+++ b/spec/support/shared_examples/serializers/note_entity_examples.rb
@@ -0,0 +1,42 @@
+shared_examples 'note entity' do
+ subject { entity.as_json }
+
+ context 'basic note' do
+ it 'exposes correct elements' do
+ expect(subject).to include(:type, :author, :note, :note_html, :current_user,
+ :discussion_id, :emoji_awardable, :award_emoji, :report_abuse_path, :attachment)
+ end
+
+ it 'does not expose elements for specific notes cases' do
+ expect(subject).not_to include(:last_edited_by, :last_edited_at, :system_note_icon_name)
+ end
+
+ it 'exposes author correctly' do
+ expect(subject[:author]).to include(:id, :name, :username, :state, :avatar_url, :path)
+ end
+
+ it 'does not expose web_url for author' do
+ expect(subject[:author]).not_to include(:web_url)
+ end
+ end
+
+ context 'when note was edited' do
+ before do
+ note.update(updated_at: 1.minute.from_now, updated_by: user)
+ end
+
+ it 'exposes last_edited_at and last_edited_by elements' do
+ expect(subject).to include(:last_edited_at, :last_edited_by)
+ end
+ end
+
+ context 'when note is a system note' do
+ before do
+ note.update(system: true)
+ end
+
+ it 'exposes system_note_icon_name element' do
+ expect(subject).to include(:system_note_icon_name)
+ end
+ end
+end
diff --git a/spec/support/sorting_helper.rb b/spec/support/sorting_helper.rb
deleted file mode 100644
index 577518d726c..00000000000
--- a/spec/support/sorting_helper.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# Helper allows you to sort items
-#
-# Params
-# value - value for sorting
-#
-# Usage:
-# include SortingHelper
-#
-# sorting_by('Oldest updated')
-#
-module SortingHelper
- def sorting_by(value)
- find('button.dropdown-toggle').click
- page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do
- click_link value
- end
- end
-end
diff --git a/spec/tasks/gitlab/uploads/migrate_rake_spec.rb b/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
index 53b1e45ba54..6fcfae358ec 100644
--- a/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
+++ b/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
@@ -1,10 +1,9 @@
require 'rake_helper'
describe 'gitlab:uploads:migrate rake tasks' do
- let!(:projects) { create_list(:project, 10, :with_avatar) }
- let(:model_class) { Project }
- let(:uploader_class) { AvatarUploader }
- let(:mounted_as) { :avatar }
+ let(:model_class) { nil }
+ let(:uploader_class) { nil }
+ let(:mounted_as) { nil }
let(:batch_size) { 3 }
before do
@@ -30,11 +29,113 @@ describe 'gitlab:uploads:migrate rake tasks' do
end
end
- it_behaves_like 'enqueue jobs in batch', batch: 4
+ context "for AvatarUploader" do
+ let(:uploader_class) { AvatarUploader }
+ let(:mounted_as) { :avatar }
+
+ context "for Project" do
+ let(:model_class) { Project }
+ let!(:projects) { create_list(:project, 10, :with_avatar) }
+
+ it_behaves_like 'enqueue jobs in batch', batch: 4
+
+ context 'Upload has store = nil' do
+ before do
+ Upload.where(model: projects).update_all(store: nil)
+ end
+
+ it_behaves_like 'enqueue jobs in batch', batch: 4
+ end
+ end
+
+ context "for Group" do
+ let(:model_class) { Group }
+
+ before do
+ create_list(:group, 10, :with_avatar)
+ end
+
+ it_behaves_like 'enqueue jobs in batch', batch: 4
+ end
+
+ context "for User" do
+ let(:model_class) { User }
+
+ before do
+ create_list(:user, 10, :with_avatar)
+ end
+
+ it_behaves_like 'enqueue jobs in batch', batch: 4
+ end
+ end
+
+ context "for AttachmentUploader" do
+ let(:uploader_class) { AttachmentUploader }
+
+ context "for Note" do
+ let(:model_class) { Note }
+ let(:mounted_as) { :attachment }
+
+ before do
+ create_list(:note, 10, :with_attachment)
+ end
+
+ it_behaves_like 'enqueue jobs in batch', batch: 4
+ end
+
+ context "for Appearance" do
+ let(:model_class) { Appearance }
+ let(:mounted_as) { :logo }
+
+ before do
+ create(:appearance, :with_logos)
+ end
+
+ %i(logo header_logo).each do |mount|
+ it_behaves_like 'enqueue jobs in batch', batch: 1 do
+ let(:mounted_as) { mount }
+ end
+ end
+ end
+ end
+
+ context "for FileUploader" do
+ let(:uploader_class) { FileUploader }
+ let(:model_class) { Project }
+
+ before do
+ create_list(:project, 10) do |model|
+ uploader_class.new(model)
+ .store!(fixture_file_upload('spec/fixtures/doc_sample.txt'))
+ end
+ end
+
+ it_behaves_like 'enqueue jobs in batch', batch: 4
+ end
+
+ context "for PersonalFileUploader" do
+ let(:uploader_class) { PersonalFileUploader }
+ let(:model_class) { PersonalSnippet }
+
+ before do
+ create_list(:personal_snippet, 10) do |model|
+ uploader_class.new(model)
+ .store!(fixture_file_upload('spec/fixtures/doc_sample.txt'))
+ end
+ end
+
+ it_behaves_like 'enqueue jobs in batch', batch: 4
+ end
+
+ context "for NamespaceFileUploader" do
+ let(:uploader_class) { NamespaceFileUploader }
+ let(:model_class) { Snippet }
- context 'Upload has store = nil' do
before do
- Upload.where(model: projects).update_all(store: nil)
+ create_list(:snippet, 10) do |model|
+ uploader_class.new(model)
+ .store!(fixture_file_upload('spec/fixtures/doc_sample.txt'))
+ end
end
it_behaves_like 'enqueue jobs in batch', batch: 4
diff --git a/spec/uploaders/workers/object_storage/background_move_worker_spec.rb b/spec/uploaders/workers/object_storage/background_move_worker_spec.rb
new file mode 100644
index 00000000000..b34f427fd8a
--- /dev/null
+++ b/spec/uploaders/workers/object_storage/background_move_worker_spec.rb
@@ -0,0 +1,146 @@
+require 'spec_helper'
+
+describe ObjectStorage::BackgroundMoveWorker do
+ let(:local) { ObjectStorage::Store::LOCAL }
+ let(:remote) { ObjectStorage::Store::REMOTE }
+
+ def perform
+ described_class.perform_async(uploader_class.name, subject_class, file_field, subject_id)
+ end
+
+ context 'for LFS' do
+ let!(:lfs_object) { create(:lfs_object, :with_file, file_store: local) }
+ let(:uploader_class) { LfsObjectUploader }
+ let(:subject_class) { LfsObject }
+ let(:file_field) { :file }
+ let(:subject_id) { lfs_object.id }
+
+ context 'when object storage is enabled' do
+ before do
+ stub_lfs_object_storage(background_upload: true)
+ end
+
+ it 'uploads object to storage' do
+ expect { perform }.to change { lfs_object.reload.file_store }.from(local).to(remote)
+ end
+
+ context 'when background upload is disabled' do
+ before do
+ allow(Gitlab.config.lfs.object_store).to receive(:background_upload) { false }
+ end
+
+ it 'is skipped' do
+ expect { perform }.not_to change { lfs_object.reload.file_store }
+ end
+ end
+ end
+
+ context 'when object storage is disabled' do
+ before do
+ stub_lfs_object_storage(enabled: false)
+ end
+
+ it "doesn't migrate files" do
+ perform
+
+ expect(lfs_object.reload.file_store).to eq(local)
+ end
+ end
+ end
+
+ context 'for legacy artifacts' do
+ let(:build) { create(:ci_build, :legacy_artifacts) }
+ let(:uploader_class) { LegacyArtifactUploader }
+ let(:subject_class) { Ci::Build }
+ let(:file_field) { :artifacts_file }
+ let(:subject_id) { build.id }
+
+ context 'when local storage is used' do
+ let(:store) { local }
+
+ context 'and remote storage is defined' do
+ before do
+ stub_artifacts_object_storage(background_upload: true)
+ end
+
+ it "migrates file to remote storage" do
+ perform
+
+ expect(build.reload.artifacts_file_store).to eq(remote)
+ end
+
+ context 'for artifacts_metadata' do
+ let(:file_field) { :artifacts_metadata }
+
+ it 'migrates metadata to remote storage' do
+ perform
+
+ expect(build.reload.artifacts_metadata_store).to eq(remote)
+ end
+ end
+ end
+ end
+ end
+
+ context 'for job artifacts' do
+ let(:artifact) { create(:ci_job_artifact, :archive) }
+ let(:uploader_class) { JobArtifactUploader }
+ let(:subject_class) { Ci::JobArtifact }
+ let(:file_field) { :file }
+ let(:subject_id) { artifact.id }
+
+ context 'when local storage is used' do
+ let(:store) { local }
+
+ context 'and remote storage is defined' do
+ before do
+ stub_artifacts_object_storage(background_upload: true)
+ end
+
+ it "migrates file to remote storage" do
+ perform
+
+ expect(artifact.reload.file_store).to eq(remote)
+ end
+ end
+ end
+ end
+
+ context 'for uploads' do
+ let!(:project) { create(:project, :with_avatar) }
+ let(:uploader_class) { AvatarUploader }
+ let(:file_field) { :avatar }
+
+ context 'when local storage is used' do
+ let(:store) { local }
+
+ context 'and remote storage is defined' do
+ before do
+ stub_uploads_object_storage(uploader_class, background_upload: true)
+ end
+
+ describe 'supports using the model' do
+ let(:subject_class) { project.class }
+ let(:subject_id) { project.id }
+
+ it "migrates file to remote storage" do
+ perform
+
+ expect(project.reload.avatar.file_storage?).to be_falsey
+ end
+ end
+
+ describe 'supports using the Upload' do
+ let(:subject_class) { Upload }
+ let(:subject_id) { project.avatar.upload.id }
+
+ it "migrates file to remote storage" do
+ perform
+
+ expect(project.reload.avatar.file_storage?).to be_falsey
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb b/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb
new file mode 100644
index 00000000000..7a7dcb71680
--- /dev/null
+++ b/spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb
@@ -0,0 +1,119 @@
+require 'spec_helper'
+
+describe ObjectStorage::MigrateUploadsWorker, :sidekiq do
+ shared_context 'sanity_check! fails' do
+ before do
+ expect(described_class).to receive(:sanity_check!).and_raise(described_class::SanityCheckError)
+ end
+ end
+
+ let!(:projects) { create_list(:project, 10, :with_avatar) }
+ let(:uploads) { Upload.all }
+ let(:model_class) { Project }
+ let(:mounted_as) { :avatar }
+ let(:to_store) { ObjectStorage::Store::REMOTE }
+
+ before do
+ stub_uploads_object_storage(AvatarUploader)
+ end
+
+ describe '.enqueue!' do
+ def enqueue!
+ described_class.enqueue!(uploads, Project, mounted_as, to_store)
+ end
+
+ it 'is guarded by .sanity_check!' do
+ expect(described_class).to receive(:perform_async)
+ expect(described_class).to receive(:sanity_check!)
+
+ enqueue!
+ end
+
+ context 'sanity_check! fails' do
+ include_context 'sanity_check! fails'
+
+ it 'does not enqueue a job' do
+ expect(described_class).not_to receive(:perform_async)
+
+ expect { enqueue! }.to raise_error(described_class::SanityCheckError)
+ end
+ end
+ end
+
+ describe '.sanity_check!' do
+ shared_examples 'raises a SanityCheckError' do
+ let(:mount_point) { nil }
+
+ it do
+ expect { described_class.sanity_check!(uploads, model_class, mount_point) }
+ .to raise_error(described_class::SanityCheckError)
+ end
+ end
+
+ context 'uploader types mismatch' do
+ let!(:outlier) { create(:upload, uploader: 'FileUploader') }
+
+ include_examples 'raises a SanityCheckError'
+ end
+
+ context 'model types mismatch' do
+ let!(:outlier) { create(:upload, model_type: 'Potato') }
+
+ include_examples 'raises a SanityCheckError'
+ end
+
+ context 'mount point not found' do
+ include_examples 'raises a SanityCheckError' do
+ let(:mount_point) { :potato }
+ end
+ end
+ end
+
+ describe '#perform' do
+ def perform
+ described_class.new.perform(uploads.ids, model_class.to_s, mounted_as, to_store)
+ rescue ObjectStorage::MigrateUploadsWorker::Report::MigrationFailures
+ # swallow
+ end
+
+ shared_examples 'outputs correctly' do |success: 0, failures: 0|
+ total = success + failures
+
+ if success > 0
+ it 'outputs the reports' do
+ expect(Rails.logger).to receive(:info).with(%r{Migrated #{success}/#{total} files})
+
+ perform
+ end
+ end
+
+ if failures > 0
+ it 'outputs upload failures' do
+ expect(Rails.logger).to receive(:warn).with(/Error .* I am a teapot/)
+
+ perform
+ end
+ end
+ end
+
+ it_behaves_like 'outputs correctly', success: 10
+
+ it 'migrates files' do
+ perform
+
+ aggregate_failures do
+ projects.each do |project|
+ expect(project.reload.avatar.upload.local?).to be_falsey
+ end
+ end
+ end
+
+ context 'migration is unsuccessful' do
+ before do
+ allow_any_instance_of(ObjectStorage::Concern).to receive(:migrate!).and_raise(CarrierWave::UploadError, "I am a teapot.")
+ end
+
+ it_behaves_like 'outputs correctly', failures: 10
+ end
+ end
+end