summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLong Nguyen <long.polyglot@gmail.com>2016-05-11 09:14:56 +0700
committerLong Nguyen <long.polyglot@gmail.com>2016-05-11 09:14:56 +0700
commita22d559d27eda2661039ed856dc636171f4b7362 (patch)
tree4320c04451e79d01edf612ffb33d9afc2449a3fd
parentdd1ad6bf3e5a378eb8698e95b73e58f935eb0956 (diff)
parentf7d2297c86eb84c2e2fbfa6b3e007da3c7adb5ae (diff)
downloadgitlab-ce-a22d559d27eda2661039ed856dc636171f4b7362.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into issue_15572_snippets_tab_under_user_profile
-rw-r--r--CHANGELOG15
-rw-r--r--Gemfile3
-rw-r--r--Gemfile.lock10
-rw-r--r--README.md8
-rw-r--r--app/assets/javascripts/application.js.coffee1
-rw-r--r--app/assets/javascripts/ci/application.js.coffee28
-rw-r--r--app/assets/javascripts/merge_request_widget.js.coffee9
-rw-r--r--app/assets/javascripts/shortcuts_issuable.coffee4
-rw-r--r--app/assets/javascripts/sidebar.js.coffee2
-rw-r--r--app/assets/stylesheets/framework/gitlab-theme.scss4
-rw-r--r--app/assets/stylesheets/framework/header.scss54
-rw-r--r--app/assets/stylesheets/framework/nav.scss6
-rw-r--r--app/assets/stylesheets/framework/sidebar.scss50
-rw-r--r--app/assets/stylesheets/framework/variables.scss1
-rw-r--r--app/assets/stylesheets/pages/profile.scss2
-rw-r--r--app/controllers/dashboard/labels_controller.rb2
-rw-r--r--app/helpers/projects_helper.rb3
-rw-r--r--app/models/abuse_report.rb12
-rw-r--r--app/models/appearance.rb13
-rw-r--r--app/models/application_setting.rb52
-rw-r--r--app/models/audit_event.rb14
-rw-r--r--app/models/broadcast_message.rb14
-rw-r--r--app/models/ci/build.rb37
-rw-r--r--app/models/ci/commit.rb22
-rw-r--r--app/models/ci/runner.rb19
-rw-r--r--app/models/ci/runner_project.rb12
-rw-r--r--app/models/ci/trigger.rb13
-rw-r--r--app/models/ci/trigger_request.rb12
-rw-r--r--app/models/ci/variable.rb14
-rw-r--r--app/models/commit_status.rb37
-rw-r--r--app/models/concerns/issuable.rb8
-rw-r--r--app/models/concerns/mentionable.rb4
-rw-r--r--app/models/deploy_key.rb15
-rw-r--r--app/models/deploy_keys_project.rb11
-rw-r--r--app/models/email.rb11
-rw-r--r--app/models/event.rb16
-rw-r--r--app/models/forked_project_link.rb11
-rw-r--r--app/models/generic_commit_status.rb37
-rw-r--r--app/models/group.rb17
-rw-r--r--app/models/hooks/project_hook.rb22
-rw-r--r--app/models/hooks/service_hook.rb22
-rw-r--r--app/models/hooks/system_hook.rb22
-rw-r--r--app/models/hooks/web_hook.rb22
-rw-r--r--app/models/identity.rb12
-rw-r--r--app/models/issue.rb24
-rw-r--r--app/models/key.rb15
-rw-r--r--app/models/label.rb18
-rw-r--r--app/models/label_link.rb12
-rw-r--r--app/models/lfs_object.rb12
-rw-r--r--app/models/lfs_objects_project.rb11
-rw-r--r--app/models/member.rb19
-rw-r--r--app/models/members/group_member.rb19
-rw-r--r--app/models/members/project_member.rb19
-rw-r--r--app/models/merge_request.rb30
-rw-r--r--app/models/merge_request_diff.rb15
-rw-r--r--app/models/milestone.rb19
-rw-r--r--app/models/namespace.rb17
-rw-r--r--app/models/note.rb21
-rw-r--r--app/models/notification_setting.rb13
-rw-r--r--app/models/oauth_access_token.rb15
-rw-r--r--app/models/personal_snippet.rb16
-rw-r--r--app/models/project.rb49
-rw-r--r--app/models/project_group_link.rb12
-rw-r--r--app/models/project_import_data.rb12
-rw-r--r--app/models/project_services/asana_service.rb24
-rw-r--r--app/models/project_services/assembla_service.rb24
-rw-r--r--app/models/project_services/bamboo_service.rb24
-rw-r--r--app/models/project_services/buildkite_service.rb24
-rw-r--r--app/models/project_services/builds_email_service.rb24
-rw-r--r--app/models/project_services/campfire_service.rb24
-rw-r--r--app/models/project_services/ci_service.rb24
-rw-r--r--app/models/project_services/custom_issue_tracker_service.rb24
-rw-r--r--app/models/project_services/drone_ci_service.rb24
-rw-r--r--app/models/project_services/emails_on_push_service.rb24
-rw-r--r--app/models/project_services/external_wiki_service.rb24
-rw-r--r--app/models/project_services/flowdock_service.rb24
-rw-r--r--app/models/project_services/gemnasium_service.rb24
-rw-r--r--app/models/project_services/gitlab_ci_service.rb24
-rw-r--r--app/models/project_services/gitlab_issue_tracker_service.rb24
-rw-r--r--app/models/project_services/hipchat_service.rb24
-rw-r--r--app/models/project_services/irker_service.rb24
-rw-r--r--app/models/project_services/issue_tracker_service.rb24
-rw-r--r--app/models/project_services/jira_service.rb24
-rw-r--r--app/models/project_services/pivotaltracker_service.rb24
-rw-r--r--app/models/project_services/pushover_service.rb24
-rw-r--r--app/models/project_services/redmine_service.rb24
-rw-r--r--app/models/project_services/slack_service.rb24
-rw-r--r--app/models/project_services/teamcity_service.rb24
-rw-r--r--app/models/project_snippet.rb16
-rw-r--r--app/models/protected_branch.rb12
-rw-r--r--app/models/release.rb12
-rw-r--r--app/models/repository.rb2
-rw-r--r--app/models/security_event.rb14
-rw-r--r--app/models/sent_notification.rb14
-rw-r--r--app/models/service.rb24
-rw-r--r--app/models/snippet.rb16
-rw-r--r--app/models/spam_log.rb17
-rw-r--r--app/models/subscription.rb13
-rw-r--r--app/models/todo.rb18
-rw-r--r--app/models/user.rb67
-rw-r--r--app/models/users_star_project.rb11
-rw-r--r--app/services/system_note_service.rb6
-rw-r--r--app/views/admin/runners/_runner.html.haml12
-rw-r--r--app/views/layouts/header/_default.html.haml5
-rw-r--r--app/views/projects/issues/_issue.html.haml14
-rw-r--r--app/views/projects/merge_requests/_merge_request.html.haml14
-rw-r--r--app/views/projects/merge_requests/widget/_heading.html.haml7
-rw-r--r--app/views/projects/tags/new.html.haml2
-rw-r--r--app/views/projects/tags/show.html.haml8
-rw-r--r--config/application.rb25
-rw-r--r--config/gitlab.teatro.yml1
-rw-r--r--config/initializers/1_settings.rb2
-rw-r--r--config/initializers/5_backend.rb6
-rw-r--r--config/initializers/trusted_proxies.rb3
-rw-r--r--db/migrate/20160508194200_remove_wall_enabled_from_projects.rb5
-rw-r--r--db/schema.rb3
-rw-r--r--doc/api/build_triggers.md12
-rw-r--r--doc/api/issues.md15
-rw-r--r--doc/api/merge_requests.md22
-rw-r--r--doc/api/notes.md10
-rw-r--r--doc/api/users.md80
-rw-r--r--doc/ci/docker/using_docker_build.md6
-rw-r--r--doc/ci/docker/using_docker_images.md8
-rw-r--r--doc/ci/examples/README.md4
-rw-r--r--doc/ci/examples/php.md6
-rw-r--r--doc/ci/examples/test-and-deploy-python-application-to-heroku.md10
-rw-r--r--doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md6
-rw-r--r--doc/ci/services/mysql.md4
-rw-r--r--doc/ci/services/postgres.md2
-rw-r--r--doc/ci/services/redis.md2
-rw-r--r--doc/development/instrumentation.md129
-rw-r--r--doc/workflow/lfs/manage_large_binaries_with_git_lfs.md2
-rw-r--r--docker/README.md6
-rw-r--r--features/project/commits/tags.feature46
-rw-r--r--features/project/create.feature16
-rw-r--r--features/steps/project/commits/tags.rb90
-rw-r--r--features/steps/project/create.rb26
-rw-r--r--lib/api/api.rb69
-rw-r--r--lib/api/api_guard.rb270
-rw-r--r--lib/api/commit_statuses.rb2
-rw-r--r--lib/api/entities.rb4
-rw-r--r--lib/banzai/filter/issue_reference_filter.rb3
-rw-r--r--lib/banzai/filter/sanitization_filter.rb2
-rw-r--r--lib/banzai/filter/upload_link_filter.rb8
-rw-r--r--lib/ci/api/api.rb10
-rw-r--r--lib/gitlab.rb2
-rw-r--r--lib/gitlab/git_access.rb7
-rw-r--r--lib/tasks/auto_annotate_models.rake44
-rw-r--r--lib/tasks/gitlab/db.rake4
-rw-r--r--spec/factories/abuse_reports.rb12
-rw-r--r--spec/factories/broadcast_messages.rb14
-rw-r--r--spec/factories/forked_project_links.rb11
-rw-r--r--spec/factories/label_links.rb12
-rw-r--r--spec/factories/labels.rb13
-rw-r--r--spec/factories/lfs_objects.rb12
-rw-r--r--spec/factories/lfs_objects_projects.rb11
-rw-r--r--spec/factories/merge_requests.rb29
-rw-r--r--spec/factories/notes.rb21
-rw-r--r--spec/factories/oauth_access_tokens.rb15
-rw-r--r--spec/factories/projects.rb50
-rw-r--r--spec/factories/releases.rb12
-rw-r--r--spec/factories/todos.rb18
-rw-r--r--spec/features/merge_requests/user_lists_merge_requests_spec.rb137
-rw-r--r--spec/features/projects/developer_views_empty_project_instructions_spec.rb63
-rw-r--r--spec/features/tags/master_creates_tag_spec.rb62
-rw-r--r--spec/features/tags/master_deletes_tag_spec.rb41
-rw-r--r--spec/features/tags/master_updates_tag_spec.rb42
-rw-r--r--spec/features/tags/master_views_tags_spec.rb73
-rw-r--r--spec/helpers/projects_helper_spec.rb10
-rw-r--r--spec/initializers/trusted_proxies_spec.rb51
-rw-r--r--spec/javascripts/merge_request_widget_spec.js.coffee6
-rw-r--r--spec/lib/banzai/filter/milestone_reference_filter_spec.rb2
-rw-r--r--spec/lib/banzai/filter/sanitization_filter_spec.rb6
-rw-r--r--spec/lib/banzai/filter/upload_link_filter_spec.rb18
-rw-r--r--spec/models/abuse_report_spec.rb12
-rw-r--r--spec/models/application_setting_spec.rb46
-rw-r--r--spec/models/broadcast_message_spec.rb14
-rw-r--r--spec/models/ci/commit_spec.rb18
-rw-r--r--spec/models/ci/runner_project_spec.rb12
-rw-r--r--spec/models/ci/runner_spec.rb19
-rw-r--r--spec/models/ci/trigger_spec.rb13
-rw-r--r--spec/models/ci/variable_spec.rb14
-rw-r--r--spec/models/commit_status_spec.rb34
-rw-r--r--spec/models/deploy_key_spec.rb15
-rw-r--r--spec/models/deploy_keys_project_spec.rb11
-rw-r--r--spec/models/email_spec.rb11
-rw-r--r--spec/models/event_spec.rb16
-rw-r--r--spec/models/forked_project_link_spec.rb11
-rw-r--r--spec/models/generic_commit_status_spec.rb34
-rw-r--r--spec/models/group_spec.rb15
-rw-r--r--spec/models/identity_spec.rb12
-rw-r--r--spec/models/issue_spec.rb20
-rw-r--r--spec/models/key_spec.rb15
-rw-r--r--spec/models/label_link_spec.rb12
-rw-r--r--spec/models/label_spec.rb21
-rw-r--r--spec/models/member_spec.rb19
-rw-r--r--spec/models/merge_request_spec.rb29
-rw-r--r--spec/models/milestone_spec.rb23
-rw-r--r--spec/models/namespace_spec.rb15
-rw-r--r--spec/models/note_spec.rb21
-rw-r--r--spec/models/project_snippet_spec.rb16
-rw-r--r--spec/models/project_spec.rb40
-rw-r--r--spec/models/protected_branch_spec.rb12
-rw-r--r--spec/models/release_spec.rb12
-rw-r--r--spec/models/service_spec.rb21
-rw-r--r--spec/models/snippet_spec.rb16
-rw-r--r--spec/models/todo_spec.rb18
-rw-r--r--spec/models/user_spec.rb63
-rw-r--r--spec/requests/api/commit_statuses_spec.rb (renamed from spec/requests/api/commit_status_spec.rb)2
-rw-r--r--spec/requests/api/issues_spec.rb21
-rw-r--r--spec/requests/api/merge_requests_spec.rb28
-rw-r--r--spec/services/system_note_service_spec.rb9
-rw-r--r--spec/services/todo_service_spec.rb19
213 files changed, 1276 insertions, 3147 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 9d9e43e50df..1ee16fada1f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,8 +2,12 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.8.0 (unreleased)
- Snippets tab under user profile. !4001 (Long Nguyen)
+ - Fix error when using link to uploads in global snippets
- Assign labels and milestone to target project when moving issue. !3934 (Long Nguyen)
+ - Use a case-insensitive comparison in sanitizing URI schemes
- Project#open_branches has been cleaned up and no longer loads entire records into memory.
+ - Escape HTML in commit titles in system note messages
+ - Improve multiple branch push performance by memoizing permission checking
- Log to application.log when an admin starts and stops impersonating a user
- Updated gitlab_git to 10.1.0
- GitAccess#protected_tag? no longer loads all tags just to check if a single one exists
@@ -20,18 +24,29 @@ v 8.8.0 (unreleased)
- Update SVG sanitizer to conform to SVG 1.1
- Updated search UI
- Display informative message when new milestone is created
+ - Sanitize milestones and labels titles
+ - Support multi-line tag messages. !3833 (Calin Seciu)
- Allow "NEWS" and "CHANGES" as alternative names for CHANGELOG. !3768 (Connor Shea)
- Added button to toggle whitespaces changes on diff view
- Backport GitHub Enterprise import support from EE
- Create tags using Rugged for performance reasons. !3745
+ - API: Expose Issue#user_notes_count. !3126 (Anton Popov)
- Files over 5MB can only be viewed in their raw form, files over 1MB without highlighting !3718
- Add support for supressing text diffs using .gitattributes on the default branch (Matt Oakes)
+ - Add eager load paths to help prevent dependency load issues in Sidekiq workers. !3724
- Added multiple colors for labels in dropdowns when dups happen.
- Improve description for the Two-factor Authentication sign-in screen. (Connor Shea)
- API support for the 'since' and 'until' operators on commit requests (Paco Guzman)
- Fix Gravatar hint in user profile when Gravatar is disabled. !3988 (Artem Sidorenko)
- Expire repository exists? and has_visible_content? caches after a push if necessary
- Fix unintentional filtering bug in issues sorted by milestone due (Takuya Noguchi)
+ - Fix adding a todo for private group members (Ahmad Sherif)
+ - Bump ace-rails-ap gem version from 2.0.1 to 4.0.2 which upgrades Ace Editor from 1.1.2 to 1.2.3
+
+v 8.7.4
+ - Fix always showing build notification message when switching between merge requests
+ - Links for Redmine issue references are generated correctly again (Benedikt Huss)
+ - Fix an issue when filtering merge requests with more than one label. !3886
v 8.7.3
- Emails, Gitlab::Email::Message, Gitlab::Diff, and Premailer::Adapter::Nokogiri are now instrumented
diff --git a/Gemfile b/Gemfile
index 1137ef4d72b..77d351419f0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -197,7 +197,7 @@ gem 'licensee', '~> 8.0.0'
gem "rack-attack", '~> 4.3.1'
# Ace editor
-gem 'ace-rails-ap', '~> 2.0.1'
+gem 'ace-rails-ap', '~> 4.0.2'
# Keyboard shortcuts
gem 'mousetrap-rails', '~> 1.4.6'
@@ -242,7 +242,6 @@ group :development do
gem "foreman"
gem 'brakeman', '~> 3.2.0', require: false
- gem "annotate", "~> 2.7.0"
gem 'letter_opener_web', '~> 1.3.0'
gem 'quiet_assets', '~> 1.0.2'
gem 'rerun', '~> 0.11.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index fe083c2b566..c02698bcca7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -3,7 +3,7 @@ GEM
specs:
CFPropertyList (2.3.2)
RedCloth (4.2.9)
- ace-rails-ap (2.0.1)
+ ace-rails-ap (4.0.2)
actionmailer (4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
@@ -51,9 +51,6 @@ GEM
activerecord (>= 3.0)
akismet (2.0.0)
allocations (1.0.4)
- annotate (2.7.0)
- activerecord (>= 3.2, < 6.0)
- rake (~> 10.4)
arel (6.0.3)
asana (0.4.0)
faraday (~> 0.9)
@@ -885,7 +882,7 @@ PLATFORMS
DEPENDENCIES
RedCloth (~> 4.2.9)
- ace-rails-ap (~> 2.0.1)
+ ace-rails-ap (~> 4.0.2)
activerecord-deprecated_finders (~> 1.0.3)
activerecord-session_store (~> 0.1.0)
acts-as-taggable-on (~> 3.4)
@@ -893,7 +890,6 @@ DEPENDENCIES
after_commit_queue
akismet (~> 2.0)
allocations (~> 1.0)
- annotate (~> 2.7.0)
asana (~> 0.4.0)
asciidoctor (~> 1.5.2)
attr_encrypted (~> 1.3.4)
@@ -1061,4 +1057,4 @@ DEPENDENCIES
wikicloth (= 0.8.1)
BUNDLED WITH
- 1.12.1
+ 1.12.3
diff --git a/README.md b/README.md
index c1a29c3bb1e..418d06a45a5 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,10 @@ To see how GitLab looks please see the [features page on our website](https://ab
- Completely free and open source (MIT Expat license)
- Powered by [Ruby on Rails](https://github.com/rails/rails)
+## Hiring
+
+We're hiring developers, support people, and production engineers all the time, please see our [jobs page](https://about.gitlab.com/jobs/).
+
## Editions
There are two editions of GitLab:
@@ -31,11 +35,11 @@ There are two editions of GitLab:
On [about.gitlab.com](https://about.gitlab.com/) you can find more information about:
-- [Subscriptions](https://about.gitlab.com/subscription/)
+- [Subscriptions](https://about.gitlab.com/pricing/)
- [Consultancy](https://about.gitlab.com/consultancy/)
- [Community](https://about.gitlab.com/community/)
- [Hosted GitLab.com](https://about.gitlab.com/gitlab-com/) use GitLab as a free service
-- [GitLab Enterprise Edition](https://about.gitlab.com/gitlab-ee/) with additional features aimed at larger organizations.
+- [GitLab Enterprise Edition](https://about.gitlab.com/features/#enterprise) with additional features aimed at larger organizations.
- [GitLab CI](https://about.gitlab.com/gitlab-ci/) a continuous integration (CI) server that is easy to integrate with GitLab.
## Requirements
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 5bac8eef1cb..bffce5a0c0f 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -204,6 +204,7 @@ $ ->
$('.header-content .title').toggle()
$('.header-content .navbar-collapse').toggle()
$('.navbar-toggle').toggleClass('active')
+ $('.navbar-toggle i').toggleClass("fa-angle-right fa-angle-left")
# Show/hide comments on diff
$("body").on "click", ".js-toggle-diff-comments", (e) ->
diff --git a/app/assets/javascripts/ci/application.js.coffee b/app/assets/javascripts/ci/application.js.coffee
index 05aa0f366bb..ca24c1d759f 100644
--- a/app/assets/javascripts/ci/application.js.coffee
+++ b/app/assets/javascripts/ci/application.js.coffee
@@ -1,34 +1,6 @@
-# This is a manifest file that'll be compiled into application.js, which will include all the files
-# listed below.
-#
-# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
-# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
-#
-# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-# the compiled file.
-#
-# WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
-# GO AFTER THE REQUIRES BELOW.
-#
#= require pager
#= require jquery_nested_form
#= require_tree .
-#
-$(document).on 'click', '.edit-runner-link', (event) ->
- event.preventDefault()
-
- descr = $(this).closest('.runner-description').first()
- descr.addClass('hide')
- form = descr.next('.runner-description-form')
- descrInput = form.find('input.description')
- originalValue = descrInput.val()
- form.removeClass('hide')
- form.find('.cancel').on 'click', (event) ->
- event.preventDefault()
-
- form.addClass('hide')
- descrInput.val(originalValue)
- descr.removeClass('hide')
$(document).on 'click', '.assign-all-runner', ->
$(this).replaceWith('<i class="fa fa-refresh fa-spin"></i> Assign in progress..')
diff --git a/app/assets/javascripts/merge_request_widget.js.coffee b/app/assets/javascripts/merge_request_widget.js.coffee
index 17a5a057a94..f58647988a2 100644
--- a/app/assets/javascripts/merge_request_widget.js.coffee
+++ b/app/assets/javascripts/merge_request_widget.js.coffee
@@ -9,11 +9,12 @@ class @MergeRequestWidget
constructor: (@opts) ->
$('#modal_merge_info').modal(show: false)
@firstCICheck = true
- @readyForCICheck = true
+ @readyForCICheck = false
clearInterval @fetchBuildStatusInterval
@clearEventListeners()
@addEventListeners()
+ @getCIStatus(false)
@pollCIStatus()
notifyPermissions()
@@ -71,7 +72,7 @@ class @MergeRequestWidget
if data.status is ''
return
- if @firstCiCheck || data.status isnt @opts.ci_status and data.status?
+ if @firstCICheck || data.status isnt @opts.ci_status and data.status?
@opts.ci_status = data.status
@showCIStatus data.status
if data.coverage
@@ -79,7 +80,7 @@ class @MergeRequestWidget
# The first check should only update the UI, a notification
# should only be displayed on status changes
- if showNotification and not @firstCiCheck
+ if showNotification and not @firstCICheck
status = @ciLabelForStatus(data.status)
if status is "preparing"
@@ -102,7 +103,7 @@ class @MergeRequestWidget
@close()
Turbolinks.visit _this.opts.builds_path
)
- @firstCiCheck = false
+ @firstCICheck = false
showCIStatus: (state) ->
$('.ci_widget').hide()
diff --git a/app/assets/javascripts/shortcuts_issuable.coffee b/app/assets/javascripts/shortcuts_issuable.coffee
index ad9b3c1c6bf..ccb42ab2168 100644
--- a/app/assets/javascripts/shortcuts_issuable.coffee
+++ b/app/assets/javascripts/shortcuts_issuable.coffee
@@ -6,6 +6,10 @@ class @ShortcutsIssuable extends ShortcutsNavigation
super()
Mousetrap.bind('a', @openSidebarDropdown.bind(@, 'assignee'))
Mousetrap.bind('m', @openSidebarDropdown.bind(@, 'milestone'))
+ Mousetrap.bind('r', =>
+ @replyWithSelectedText()
+ return false
+ )
Mousetrap.bind('j', =>
@prevIssue()
return false
diff --git a/app/assets/javascripts/sidebar.js.coffee b/app/assets/javascripts/sidebar.js.coffee
index 860d4f438d0..ea4ac52da31 100644
--- a/app/assets/javascripts/sidebar.js.coffee
+++ b/app/assets/javascripts/sidebar.js.coffee
@@ -12,7 +12,7 @@ toggleSidebar = ->
niceScrollBars.updateScrollBar();
), 300
-$(document).on("click", '.toggle-nav-collapse', (e) ->
+$(document).on("click", '.toggle-nav-collapse, .side-nav-toggle', (e) ->
e.preventDefault()
toggleSidebar()
diff --git a/app/assets/stylesheets/framework/gitlab-theme.scss b/app/assets/stylesheets/framework/gitlab-theme.scss
index c83cf881596..dc4668877f2 100644
--- a/app/assets/stylesheets/framework/gitlab-theme.scss
+++ b/app/assets/stylesheets/framework/gitlab-theme.scss
@@ -24,6 +24,10 @@
background-color: $color-darker;
a {
color: #fff;
+
+ h3 {
+ color: #fff;
+ }
}
}
}
diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss
index 97f9d582007..8190a97ed58 100644
--- a/app/assets/stylesheets/framework/header.scss
+++ b/app/assets/stylesheets/framework/header.scss
@@ -8,7 +8,7 @@ header {
&.navbar-empty {
height: 58px;
background: #fff;
- border-bottom: 1px solid #eee;
+ border-bottom: 1px solid $btn-gray-hover;
.center-logo {
margin: 11px 0;
@@ -22,14 +22,18 @@ header {
}
&.navbar-gitlab {
- padding: 0 20px;
+ padding: 0 16px;
z-index: 100;
margin-bottom: 0;
- min-height: $header-height;
+ height: $header-height;
background-color: $background-color;
border: none;
border-bottom: 1px solid $border-color;
+ @media (max-width: $screen-xs-min) {
+ padding: 0 16px;
+ }
+
&.with-horizontal-nav {
border-bottom: none;
}
@@ -60,16 +64,44 @@ header {
margin: 6px 0;
border-radius: 0;
position: absolute;
- right: 2px;
+ right: -10px;
+ padding: 6px 10px;
&:hover {
- background-color: #eee;
+ background-color: $btn-gray-hover;
}
+
&.active {
color: $gl-icon-color;
}
}
}
+
+ &.header-collapsed {
+ padding: 0 16px;
+ }
+
+ .side-nav-toggle {
+ display: none;
+ position: absolute;
+ left: -10px;
+ margin: 6px 0;
+ padding: 6px 10px;
+ border: none;
+ background-color: $background-color;
+
+ &:hover {
+ background-color: $btn-gray-hover;
+ }
+
+ &:focus {
+ outline: none;
+ }
+
+ @media (max-width: $screen-xs-min) {
+ display: block;
+ }
+ }
}
.header-content {
@@ -77,6 +109,10 @@ header {
height: $header-height;
padding-right: 40px;
+ @media (max-width: $screen-xs-min) {
+ padding-left: 40px;
+ }
+
@media (min-width: $screen-sm-min) {
padding-right: 0;
}
@@ -145,6 +181,10 @@ header {
@media (min-width: $screen-md-min) {
@include collapsed-header;
}
+
+ @media (max-width: $screen-xs-min) {
+ margin-left: 0;
+ }
}
.header-expanded {
@@ -153,6 +193,10 @@ header {
@media (min-width: $screen-md-min) {
margin-left: $sidebar_width;
}
+
+ @media (max-width: $screen-xs-min) {
+ margin-left: 0;
+ }
}
@media (max-width: $screen-xs-max) {
diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss
index 7c18e93a261..f2d7dc625e0 100644
--- a/app/assets/stylesheets/framework/nav.scss
+++ b/app/assets/stylesheets/framework/nav.scss
@@ -201,9 +201,13 @@
border-bottom: 1px solid $border-color;
transition-duration: .3s;
+ .container-fluid {
+ position: relative;
+ }
+
.controls {
float: right;
- padding: 7px 5px 0 0;
+ padding: 7px 0 0;
i {
color: $layout-link-gray;
diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss
index e940fd7286e..bd91f51708c 100644
--- a/app/assets/stylesheets/framework/sidebar.scss
+++ b/app/assets/stylesheets/framework/sidebar.scss
@@ -98,7 +98,7 @@
}
.sidebar-user {
- padding: 9px 22px;
+ padding: 7px 22px;
position: fixed;
bottom: 40px;
width: $sidebar_width;
@@ -210,15 +210,33 @@
}
}
+.sidebar-wrapper {
+ &.hidden-nav {
+ width: 0;
+ }
+}
+
.page-sidebar-collapsed {
padding-left: $sidebar_collapsed_width;
+ @media (max-width: $screen-xs-min) {
+ padding-left: 0;
+ }
+
.sidebar-wrapper {
width: $sidebar_collapsed_width;
+ @media (max-width: $screen-xs-min) {
+ width: 0;
+ }
+
.header-logo {
width: $sidebar_collapsed_width;
+ @media (max-width: $screen-xs-min) {
+ width: 0;
+ }
+
a {
padding-left: ($sidebar_collapsed_width - 36) / 2;
@@ -244,12 +262,22 @@
.collapse-nav a {
width: $sidebar_collapsed_width;
+
+ @media (max-width: $screen-xs-min) {
+ width: 0;
+ }
}
.sidebar-user {
padding-left: ($sidebar_collapsed_width - 36) / 2;
width: $sidebar_collapsed_width;
+ @media (max-width: $screen-xs-min) {
+ width: 0;
+ padding-left: 0;
+ padding-right: 0;
+ }
+
.username {
display: none;
}
@@ -258,6 +286,10 @@
.layout-nav {
padding-right: $sidebar_collapsed_width;
+
+ @media (max-width: $screen-xs-min) {
+ padding-right: 0;;
+ }
}
}
@@ -268,6 +300,10 @@
padding-left: $sidebar_width;
}
+ @media (max-width: $screen-xs-min) {
+ padding-left: 0;
+ }
+
.sidebar-wrapper {
width: $sidebar_width;
@@ -287,7 +323,17 @@
}
.layout-nav {
- padding-right: $sidebar_width;
+ @media (max-width: $screen-xs-min) {
+ padding-right: 0;;
+ }
+
+ @media (min-width: $screen-xs-min) and (max-width: $screen-md-min) {
+ padding-right: 62px;
+ }
+
+ @media (min-width: $screen-md-min) {
+ padding-right: $sidebar_width;
+ }
}
}
diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss
index ccb4e5381b7..84e74db06b0 100644
--- a/app/assets/stylesheets/framework/variables.scss
+++ b/app/assets/stylesheets/framework/variables.scss
@@ -215,6 +215,7 @@ $dropdown-toggle-hover-icon-color: $dropdown-toggle-hover-border-color;
$btn-active-gray: #ececec;
$btn-placeholder-gray: #c7c7c7;
$btn-white-active: #848484;
+$btn-gray-hover: #eee;
/*
* Award emoji
diff --git a/app/assets/stylesheets/pages/profile.scss b/app/assets/stylesheets/pages/profile.scss
index abc5a0e9877..843379a3f54 100644
--- a/app/assets/stylesheets/pages/profile.scss
+++ b/app/assets/stylesheets/pages/profile.scss
@@ -218,7 +218,7 @@
.btn {
display: inline-block;
- width: 48%;
+ width: 46%;
}
}
}
diff --git a/app/controllers/dashboard/labels_controller.rb b/app/controllers/dashboard/labels_controller.rb
index 23a4ef21ea2..2a88350a4ca 100644
--- a/app/controllers/dashboard/labels_controller.rb
+++ b/app/controllers/dashboard/labels_controller.rb
@@ -1,6 +1,6 @@
class Dashboard::LabelsController < Dashboard::ApplicationController
def index
- labels = Label.where(project_id: projects).select(:title, :color).uniq(:title)
+ labels = Label.where(project_id: projects).select(:id, :title, :color).uniq(:title)
respond_to do |format|
format.json { render json: labels }
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index f17d02a7a3f..85f8854d2eb 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -205,7 +205,8 @@ module ProjectsHelper
end
def default_url_to_repo(project = @project)
- if default_clone_protocol == "ssh"
+ case default_clone_protocol
+ when 'ssh'
project.ssh_url_to_repo
else
project.http_url_to_repo
diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb
index b61f5123127..b01a244032d 100644
--- a/app/models/abuse_report.rb
+++ b/app/models/abuse_report.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: abuse_reports
-#
-# id :integer not null, primary key
-# reporter_id :integer
-# user_id :integer
-# message :text
-# created_at :datetime
-# updated_at :datetime
-#
-
class AbuseReport < ActiveRecord::Base
belongs_to :reporter, class_name: 'User'
belongs_to :user
diff --git a/app/models/appearance.rb b/app/models/appearance.rb
index 4528760fefa..4cf8dd9a8ce 100644
--- a/app/models/appearance.rb
+++ b/app/models/appearance.rb
@@ -1,16 +1,3 @@
-# == Schema Information
-#
-# Table name: appearances
-#
-# id :integer not null, primary key
-# title :string
-# description :text
-# header_logo :string
-# logo :string
-# created_at :datetime not null
-# updated_at :datetime not null
-#
-
class Appearance < ActiveRecord::Base
validates :title, presence: true
validates :description, presence: true
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 72ec91d2909..7039db2d41e 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -1,55 +1,3 @@
-# == Schema Information
-#
-# Table name: application_settings
-#
-# id :integer not null, primary key
-# default_projects_limit :integer
-# signup_enabled :boolean
-# signin_enabled :boolean
-# gravatar_enabled :boolean
-# sign_in_text :text
-# created_at :datetime
-# updated_at :datetime
-# home_page_url :string
-# default_branch_protection :integer default(2)
-# restricted_visibility_levels :text
-# version_check_enabled :boolean default(TRUE)
-# max_attachment_size :integer default(10), not null
-# default_project_visibility :integer
-# default_snippet_visibility :integer
-# restricted_signup_domains :text
-# user_oauth_applications :boolean default(TRUE)
-# after_sign_out_path :string
-# session_expire_delay :integer default(10080), not null
-# import_sources :text
-# help_page_text :text
-# admin_notification_email :string
-# shared_runners_enabled :boolean default(TRUE), not null
-# max_artifacts_size :integer default(100), not null
-# runners_registration_token :string
-# require_two_factor_authentication :boolean default(FALSE)
-# two_factor_grace_period :integer default(48)
-# metrics_enabled :boolean default(FALSE)
-# metrics_host :string default("localhost")
-# metrics_pool_size :integer default(16)
-# metrics_timeout :integer default(10)
-# metrics_method_call_threshold :integer default(10)
-# recaptcha_enabled :boolean default(FALSE)
-# recaptcha_site_key :string
-# recaptcha_private_key :string
-# metrics_port :integer default(8089)
-# metrics_sample_interval :integer default(15)
-# sentry_enabled :boolean default(FALSE)
-# sentry_dsn :string
-# akismet_enabled :boolean default(FALSE)
-# akismet_api_key :string
-# email_author_in_body :boolean default(FALSE)
-# default_group_visibility :integer
-# repository_checks_enabled :boolean default(FALSE)
-# metrics_packet_size :integer default(1)
-# shared_runners_text :text
-#
-
class ApplicationSetting < ActiveRecord::Base
include TokenAuthenticatable
add_authentication_token_field :runners_registration_token
diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb
index 44b090260e7..967ffd46db0 100644
--- a/app/models/audit_event.rb
+++ b/app/models/audit_event.rb
@@ -1,17 +1,3 @@
-# == Schema Information
-#
-# Table name: audit_events
-#
-# id :integer not null, primary key
-# author_id :integer not null
-# type :string not null
-# entity_id :integer not null
-# entity_type :string not null
-# details :text
-# created_at :datetime
-# updated_at :datetime
-#
-
class AuditEvent < ActiveRecord::Base
serialize :details, Hash
diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb
index 075ac733bfc..61498140f27 100644
--- a/app/models/broadcast_message.rb
+++ b/app/models/broadcast_message.rb
@@ -1,17 +1,3 @@
-# == Schema Information
-#
-# Table name: broadcast_messages
-#
-# id :integer not null, primary key
-# message :text not null
-# starts_at :datetime
-# ends_at :datetime
-# created_at :datetime
-# updated_at :datetime
-# color :string
-# font :string
-#
-
class BroadcastMessage < ActiveRecord::Base
include Sortable
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 4bc3a225e2c..c9506dd3057 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -1,40 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_builds
-#
-# id :integer not null, primary key
-# project_id :integer
-# status :string
-# finished_at :datetime
-# trace :text
-# created_at :datetime
-# updated_at :datetime
-# started_at :datetime
-# runner_id :integer
-# coverage :float
-# commit_id :integer
-# commands :text
-# job_id :integer
-# name :string
-# deploy :boolean default(FALSE)
-# options :text
-# allow_failure :boolean default(FALSE), not null
-# stage :string
-# trigger_request_id :integer
-# stage_idx :integer
-# tag :boolean
-# ref :string
-# user_id :integer
-# type :string
-# target_url :string
-# description :string
-# artifacts_file :text
-# gl_project_id :integer
-# artifacts_metadata :text
-# erased_by_id :integer
-# erased_at :datetime
-#
-
module Ci
class Build < CommitStatus
belongs_to :runner, class_name: 'Ci::Runner'
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index 4ac4e0fb8b2..f4b61c75ab6 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -1,25 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_commits
-#
-# id :integer not null, primary key
-# project_id :integer
-# ref :string
-# sha :string
-# before_sha :string
-# push_data :text
-# created_at :datetime
-# updated_at :datetime
-# tag :boolean default(FALSE)
-# yaml_errors :text
-# committed_at :datetime
-# gl_project_id :integer
-# status :string
-# started_at :datetime
-# finished_at :datetime
-# duration :integer
-#
-
module Ci
class Commit < ActiveRecord::Base
extend Ci::Model
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index add59a08892..0cdb64d6c33 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -1,22 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_runners
-#
-# id :integer not null, primary key
-# token :string
-# created_at :datetime
-# updated_at :datetime
-# description :string
-# contacted_at :datetime
-# active :boolean default(TRUE), not null
-# is_shared :boolean default(FALSE)
-# name :string
-# version :string
-# revision :string
-# platform :string
-# architecture :string
-#
-
module Ci
class Runner < ActiveRecord::Base
extend Ci::Model
diff --git a/app/models/ci/runner_project.rb b/app/models/ci/runner_project.rb
index 7b16f207a26..4b44ffa886e 100644
--- a/app/models/ci/runner_project.rb
+++ b/app/models/ci/runner_project.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_runner_projects
-#
-# id :integer not null, primary key
-# runner_id :integer not null
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# gl_project_id :integer
-#
-
module Ci
class RunnerProject < ActiveRecord::Base
extend Ci::Model
diff --git a/app/models/ci/trigger.rb b/app/models/ci/trigger.rb
index 4f3f4d79fac..a0b19b51a12 100644
--- a/app/models/ci/trigger.rb
+++ b/app/models/ci/trigger.rb
@@ -1,16 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_triggers
-#
-# id :integer not null, primary key
-# token :string
-# project_id :integer
-# deleted_at :datetime
-# created_at :datetime
-# updated_at :datetime
-# gl_project_id :integer
-#
-
module Ci
class Trigger < ActiveRecord::Base
extend Ci::Model
diff --git a/app/models/ci/trigger_request.rb b/app/models/ci/trigger_request.rb
index 9973d2e5ade..872d5fb31de 100644
--- a/app/models/ci/trigger_request.rb
+++ b/app/models/ci/trigger_request.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_trigger_requests
-#
-# id :integer not null, primary key
-# trigger_id :integer not null
-# variables :text
-# created_at :datetime
-# updated_at :datetime
-# commit_id :integer
-#
-
module Ci
class TriggerRequest < ActiveRecord::Base
extend Ci::Model
diff --git a/app/models/ci/variable.rb b/app/models/ci/variable.rb
index 4229fe085a1..10802f64813 100644
--- a/app/models/ci/variable.rb
+++ b/app/models/ci/variable.rb
@@ -1,17 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_variables
-#
-# id :integer not null, primary key
-# project_id :integer
-# key :string
-# value :text
-# encrypted_value :text
-# encrypted_value_salt :string
-# encrypted_value_iv :string
-# gl_project_id :integer
-#
-
module Ci
class Variable < ActiveRecord::Base
extend Ci::Model
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 1260c448de3..cacbc13b391 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -1,40 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_builds
-#
-# id :integer not null, primary key
-# project_id :integer
-# status :string
-# finished_at :datetime
-# trace :text
-# created_at :datetime
-# updated_at :datetime
-# started_at :datetime
-# runner_id :integer
-# coverage :float
-# commit_id :integer
-# commands :text
-# job_id :integer
-# name :string
-# deploy :boolean default(FALSE)
-# options :text
-# allow_failure :boolean default(FALSE), not null
-# stage :string
-# trigger_request_id :integer
-# stage_idx :integer
-# tag :boolean
-# ref :string
-# user_id :integer
-# type :string
-# target_url :string
-# description :string
-# artifacts_file :text
-# gl_project_id :integer
-# artifacts_metadata :text
-# erased_by_id :integer
-# erased_at :datetime
-#
-
class CommitStatus < ActiveRecord::Base
include Statuseable
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 2e4efc4e8d8..c1248b53031 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -124,8 +124,8 @@ module Issuable
end
def with_label(title)
- if title.is_a?(Array) && title.count > 1
- joins(:labels).where(labels: { title: title }).group('issues.id').having("count(distinct labels.title) = #{title.count}")
+ if title.is_a?(Array) && title.size > 1
+ joins(:labels).where(labels: { title: title }).group(arel_table[:id]).having("COUNT(DISTINCT labels.title) = #{title.size}")
else
joins(:labels).where(labels: { title: title })
end
@@ -160,6 +160,10 @@ module Issuable
notes.awards.where(note: "thumbsup").count
end
+ def user_notes_count
+ notes.user.count
+ end
+
def subscribed_without_subscriptions?(user)
participants(user).include?(user)
end
diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb
index 98f71ae8cb0..b381d225485 100644
--- a/app/models/concerns/mentionable.rb
+++ b/app/models/concerns/mentionable.rb
@@ -43,8 +43,8 @@ module Mentionable
self
end
- def all_references(current_user = self.author, text = nil)
- ext = Gitlab::ReferenceExtractor.new(self.project, current_user, self.author)
+ def all_references(current_user = nil, text = nil)
+ ext = Gitlab::ReferenceExtractor.new(self.project, current_user || self.author, self.author)
if text
ext.analyze(text)
diff --git a/app/models/deploy_key.rb b/app/models/deploy_key.rb
index 43cf625f770..2c525d4cd7a 100644
--- a/app/models/deploy_key.rb
+++ b/app/models/deploy_key.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: keys
-#
-# id :integer not null, primary key
-# user_id :integer
-# created_at :datetime
-# updated_at :datetime
-# key :text
-# title :string
-# type :string
-# fingerprint :string
-# public :boolean default(FALSE), not null
-#
-
class DeployKey < Key
has_many :deploy_keys_projects, dependent: :destroy
has_many :projects, through: :deploy_keys_projects
diff --git a/app/models/deploy_keys_project.rb b/app/models/deploy_keys_project.rb
index 18db521741f..ae8486bd9ac 100644
--- a/app/models/deploy_keys_project.rb
+++ b/app/models/deploy_keys_project.rb
@@ -1,14 +1,3 @@
-# == Schema Information
-#
-# Table name: deploy_keys_projects
-#
-# id :integer not null, primary key
-# deploy_key_id :integer not null
-# project_id :integer not null
-# created_at :datetime
-# updated_at :datetime
-#
-
class DeployKeysProject < ActiveRecord::Base
belongs_to :project
belongs_to :deploy_key
diff --git a/app/models/email.rb b/app/models/email.rb
index eae2472f337..32a412ab878 100644
--- a/app/models/email.rb
+++ b/app/models/email.rb
@@ -1,14 +1,3 @@
-# == Schema Information
-#
-# Table name: emails
-#
-# id :integer not null, primary key
-# user_id :integer not null
-# email :string not null
-# created_at :datetime
-# updated_at :datetime
-#
-
class Email < ActiveRecord::Base
include Sortable
diff --git a/app/models/event.rb b/app/models/event.rb
index 25c7c3e6dc7..17ee48b91a8 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -1,19 +1,3 @@
-# == Schema Information
-#
-# Table name: events
-#
-# id :integer not null, primary key
-# target_type :string
-# target_id :integer
-# title :string
-# data :text
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# action :integer
-# author_id :integer
-#
-
class Event < ActiveRecord::Base
include Sortable
default_scope { where.not(author_id: nil) }
diff --git a/app/models/forked_project_link.rb b/app/models/forked_project_link.rb
index 9b0c6263a96..9803bae0bee 100644
--- a/app/models/forked_project_link.rb
+++ b/app/models/forked_project_link.rb
@@ -1,14 +1,3 @@
-# == Schema Information
-#
-# Table name: forked_project_links
-#
-# id :integer not null, primary key
-# forked_to_project_id :integer not null
-# forked_from_project_id :integer not null
-# created_at :datetime
-# updated_at :datetime
-#
-
class ForkedProjectLink < ActiveRecord::Base
belongs_to :forked_to_project, class_name: Project
belongs_to :forked_from_project, class_name: Project
diff --git a/app/models/generic_commit_status.rb b/app/models/generic_commit_status.rb
index d4afd8cbe84..fa54e3540d0 100644
--- a/app/models/generic_commit_status.rb
+++ b/app/models/generic_commit_status.rb
@@ -1,40 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_builds
-#
-# id :integer not null, primary key
-# project_id :integer
-# status :string
-# finished_at :datetime
-# trace :text
-# created_at :datetime
-# updated_at :datetime
-# started_at :datetime
-# runner_id :integer
-# coverage :float
-# commit_id :integer
-# commands :text
-# job_id :integer
-# name :string
-# deploy :boolean default(FALSE)
-# options :text
-# allow_failure :boolean default(FALSE), not null
-# stage :string
-# trigger_request_id :integer
-# stage_idx :integer
-# tag :boolean
-# ref :string
-# user_id :integer
-# type :string
-# target_url :string
-# description :string
-# artifacts_file :text
-# gl_project_id :integer
-# artifacts_metadata :text
-# erased_by_id :integer
-# erased_at :datetime
-#
-
class GenericCommitStatus < CommitStatus
before_validation :set_default_values
diff --git a/app/models/group.rb b/app/models/group.rb
index cff76877958..aec92e335e6 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -1,20 +1,3 @@
-# == Schema Information
-#
-# Table name: namespaces
-#
-# id :integer not null, primary key
-# name :string not null
-# path :string not null
-# owner_id :integer
-# created_at :datetime
-# updated_at :datetime
-# type :string
-# description :string default(""), not null
-# avatar :string
-# share_with_group_lock :boolean default(FALSE)
-# visibility_level :integer default(20), not null
-#
-
require 'carrierwave/orm/activerecord'
class Group < Namespace
diff --git a/app/models/hooks/project_hook.rb b/app/models/hooks/project_hook.rb
index 2b8f34a0568..ba42a8eeb70 100644
--- a/app/models/hooks/project_hook.rb
+++ b/app/models/hooks/project_hook.rb
@@ -1,25 +1,3 @@
-# == Schema Information
-#
-# Table name: web_hooks
-#
-# id :integer not null, primary key
-# url :string(2000)
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# type :string default("ProjectHook")
-# service_id :integer
-# push_events :boolean default(TRUE), not null
-# issues_events :boolean default(FALSE), not null
-# merge_requests_events :boolean default(FALSE), not null
-# tag_push_events :boolean default(FALSE)
-# note_events :boolean default(FALSE), not null
-# enable_ssl_verification :boolean default(TRUE)
-# build_events :boolean default(FALSE), not null
-# wiki_page_events :boolean default(FALSE), not null
-# token :string
-#
-
class ProjectHook < WebHook
belongs_to :project
diff --git a/app/models/hooks/service_hook.rb b/app/models/hooks/service_hook.rb
index 0e176de5ef8..eef24052a06 100644
--- a/app/models/hooks/service_hook.rb
+++ b/app/models/hooks/service_hook.rb
@@ -1,25 +1,3 @@
-# == Schema Information
-#
-# Table name: web_hooks
-#
-# id :integer not null, primary key
-# url :string(2000)
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# type :string default("ProjectHook")
-# service_id :integer
-# push_events :boolean default(TRUE), not null
-# issues_events :boolean default(FALSE), not null
-# merge_requests_events :boolean default(FALSE), not null
-# tag_push_events :boolean default(FALSE)
-# note_events :boolean default(FALSE), not null
-# enable_ssl_verification :boolean default(TRUE)
-# build_events :boolean default(FALSE), not null
-# wiki_page_events :boolean default(FALSE), not null
-# token :string
-#
-
class ServiceHook < WebHook
belongs_to :service
diff --git a/app/models/hooks/system_hook.rb b/app/models/hooks/system_hook.rb
index ad508cbbcb8..777bad1e724 100644
--- a/app/models/hooks/system_hook.rb
+++ b/app/models/hooks/system_hook.rb
@@ -1,25 +1,3 @@
-# == Schema Information
-#
-# Table name: web_hooks
-#
-# id :integer not null, primary key
-# url :string(2000)
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# type :string default("ProjectHook")
-# service_id :integer
-# push_events :boolean default(TRUE), not null
-# issues_events :boolean default(FALSE), not null
-# merge_requests_events :boolean default(FALSE), not null
-# tag_push_events :boolean default(FALSE)
-# note_events :boolean default(FALSE), not null
-# enable_ssl_verification :boolean default(TRUE)
-# build_events :boolean default(FALSE), not null
-# wiki_page_events :boolean default(FALSE), not null
-# token :string
-#
-
class SystemHook < WebHook
def async_execute(data, hook_name)
Sidekiq::Client.enqueue(SystemHookWorker, id, data, hook_name)
diff --git a/app/models/hooks/web_hook.rb b/app/models/hooks/web_hook.rb
index 8e58c9583ab..fde05f729dc 100644
--- a/app/models/hooks/web_hook.rb
+++ b/app/models/hooks/web_hook.rb
@@ -1,25 +1,3 @@
-# == Schema Information
-#
-# Table name: web_hooks
-#
-# id :integer not null, primary key
-# url :string(2000)
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# type :string default("ProjectHook")
-# service_id :integer
-# push_events :boolean default(TRUE), not null
-# issues_events :boolean default(FALSE), not null
-# merge_requests_events :boolean default(FALSE), not null
-# tag_push_events :boolean default(FALSE)
-# note_events :boolean default(FALSE), not null
-# enable_ssl_verification :boolean default(TRUE)
-# build_events :boolean default(FALSE), not null
-# wiki_page_events :boolean default(FALSE), not null
-# token :string
-#
-
class WebHook < ActiveRecord::Base
include Sortable
include HTTParty
diff --git a/app/models/identity.rb b/app/models/identity.rb
index ef4d5f99091..3bacc450e6e 100644
--- a/app/models/identity.rb
+++ b/app/models/identity.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: identities
-#
-# id :integer not null, primary key
-# extern_uid :string
-# provider :string
-# user_id :integer
-# created_at :datetime
-# updated_at :datetime
-#
-
class Identity < ActiveRecord::Base
include Sortable
include CaseSensitivity
diff --git a/app/models/issue.rb b/app/models/issue.rb
index abaa509707c..2d4a9b9f19a 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: issues
-#
-# id :integer not null, primary key
-# title :string
-# assignee_id :integer
-# author_id :integer
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# position :integer default(0)
-# branch_name :string
-# description :text
-# milestone_id :integer
-# state :string
-# iid :integer
-# updated_by_id :integer
-# moved_to_id :integer
-# confidential :boolean default(FALSE)
-# deleted_at :datetime
-# due_date :date
-#
-
require 'carrierwave/orm/activerecord'
class Issue < ActiveRecord::Base
diff --git a/app/models/key.rb b/app/models/key.rb
index b2b57849f8a..d52afda67d1 100644
--- a/app/models/key.rb
+++ b/app/models/key.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: keys
-#
-# id :integer not null, primary key
-# user_id :integer
-# created_at :datetime
-# updated_at :datetime
-# key :text
-# title :string
-# type :string
-# fingerprint :string
-# public :boolean default(FALSE), not null
-#
-
require 'digest/md5'
class Key < ActiveRecord::Base
diff --git a/app/models/label.rb b/app/models/label.rb
index 9a22398d952..e5ad11983be 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -1,17 +1,3 @@
-# == Schema Information
-#
-# Table name: labels
-#
-# id :integer not null, primary key
-# title :string
-# color :string
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# template :boolean default(FALSE)
-# description :string
-#
-
class Label < ActiveRecord::Base
include Referable
include Subscribable
@@ -117,6 +103,10 @@ class Label < ActiveRecord::Base
LabelsHelper::text_color_for_bg(self.color)
end
+ def title=(value)
+ write_attribute(:title, Sanitize.clean(value.to_s)) if value.present?
+ end
+
private
def label_format_reference(format = :id)
diff --git a/app/models/label_link.rb b/app/models/label_link.rb
index 7b8e872b6dd..47bd6eaf35f 100644
--- a/app/models/label_link.rb
+++ b/app/models/label_link.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: label_links
-#
-# id :integer not null, primary key
-# label_id :integer
-# target_id :integer
-# target_type :string
-# created_at :datetime
-# updated_at :datetime
-#
-
class LabelLink < ActiveRecord::Base
belongs_to :target, polymorphic: true
belongs_to :label
diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb
index 927e764af92..18657c3e1c8 100644
--- a/app/models/lfs_object.rb
+++ b/app/models/lfs_object.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: lfs_objects
-#
-# id :integer not null, primary key
-# oid :string not null
-# size :integer not null
-# created_at :datetime
-# updated_at :datetime
-# file :string
-#
-
class LfsObject < ActiveRecord::Base
has_many :lfs_objects_projects, dependent: :destroy
has_many :projects, through: :lfs_objects_projects
diff --git a/app/models/lfs_objects_project.rb b/app/models/lfs_objects_project.rb
index 890736bfc80..0fd5f089db9 100644
--- a/app/models/lfs_objects_project.rb
+++ b/app/models/lfs_objects_project.rb
@@ -1,14 +1,3 @@
-# == Schema Information
-#
-# Table name: lfs_objects_projects
-#
-# id :integer not null, primary key
-# lfs_object_id :integer not null
-# project_id :integer not null
-# created_at :datetime
-# updated_at :datetime
-#
-
class LfsObjectsProject < ActiveRecord::Base
belongs_to :project
belongs_to :lfs_object
diff --git a/app/models/member.rb b/app/models/member.rb
index cca82da89f1..d3060f07fc0 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -1,22 +1,3 @@
-# == Schema Information
-#
-# Table name: members
-#
-# id :integer not null, primary key
-# access_level :integer not null
-# source_id :integer not null
-# source_type :string not null
-# user_id :integer
-# notification_level :integer not null
-# type :string
-# created_at :datetime
-# updated_at :datetime
-# created_by_id :integer
-# invite_email :string
-# invite_token :string
-# invite_accepted_at :datetime
-#
-
class Member < ActiveRecord::Base
include Sortable
include Gitlab::Access
diff --git a/app/models/members/group_member.rb b/app/models/members/group_member.rb
index a48c1943e6f..f63a0debf1a 100644
--- a/app/models/members/group_member.rb
+++ b/app/models/members/group_member.rb
@@ -1,22 +1,3 @@
-# == Schema Information
-#
-# Table name: members
-#
-# id :integer not null, primary key
-# access_level :integer not null
-# source_id :integer not null
-# source_type :string not null
-# user_id :integer
-# notification_level :integer not null
-# type :string
-# created_at :datetime
-# updated_at :datetime
-# created_by_id :integer
-# invite_email :string
-# invite_token :string
-# invite_accepted_at :datetime
-#
-
class GroupMember < Member
SOURCE_TYPE = 'Namespace'
diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb
index 143350a0b55..8dae3bb2ef2 100644
--- a/app/models/members/project_member.rb
+++ b/app/models/members/project_member.rb
@@ -1,22 +1,3 @@
-# == Schema Information
-#
-# Table name: members
-#
-# id :integer not null, primary key
-# access_level :integer not null
-# source_id :integer not null
-# source_type :string not null
-# user_id :integer
-# notification_level :integer not null
-# type :string
-# created_at :datetime
-# updated_at :datetime
-# created_by_id :integer
-# invite_email :string
-# invite_token :string
-# invite_accepted_at :datetime
-#
-
class ProjectMember < Member
SOURCE_TYPE = 'Project'
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 4175e1e5fba..5460935366c 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -1,33 +1,3 @@
-# == Schema Information
-#
-# Table name: merge_requests
-#
-# id :integer not null, primary key
-# target_branch :string not null
-# source_branch :string not null
-# source_project_id :integer not null
-# author_id :integer
-# assignee_id :integer
-# title :string
-# created_at :datetime
-# updated_at :datetime
-# milestone_id :integer
-# state :string
-# merge_status :string
-# target_project_id :integer not null
-# iid :integer
-# description :text
-# position :integer default(0)
-# locked_at :datetime
-# updated_by_id :integer
-# merge_error :string
-# merge_params :text
-# merge_when_build_succeeds :boolean default(FALSE), not null
-# merge_user_id :integer
-# merge_commit_sha :string
-# deleted_at :datetime
-#
-
class MergeRequest < ActiveRecord::Base
include InternalId
include Issuable
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index 8951e92a0b8..eb42c07b9b9 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: merge_request_diffs
-#
-# id :integer not null, primary key
-# state :string
-# st_commits :text
-# st_diffs :text
-# merge_request_id :integer not null
-# created_at :datetime
-# updated_at :datetime
-# base_commit_sha :string
-# real_size :string
-#
-
class MergeRequestDiff < ActiveRecord::Base
include Sortable
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index 5ee8a965ad8..e4fdd23badb 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: milestones
-#
-# id :integer not null, primary key
-# title :string not null
-# project_id :integer not null
-# description :text
-# due_date :date
-# created_at :datetime
-# updated_at :datetime
-# state :string
-# iid :integer
-#
-
class Milestone < ActiveRecord::Base
# Represents a "No Milestone" state used for filtering Issues and Merge
# Requests that have no milestone assigned.
@@ -129,6 +114,10 @@ class Milestone < ActiveRecord::Base
nil
end
+ def title=(value)
+ write_attribute(:title, Sanitize.clean(value.to_s)) if value.present?
+ end
+
# Sorts the issues for the given IDs.
#
# This method runs a single SQL query using a CASE statement to update the
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 741e912171d..9c942a8f4e3 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -1,20 +1,3 @@
-# == Schema Information
-#
-# Table name: namespaces
-#
-# id :integer not null, primary key
-# name :string not null
-# path :string not null
-# owner_id :integer
-# created_at :datetime
-# updated_at :datetime
-# type :string
-# description :string default(""), not null
-# avatar :string
-# share_with_group_lock :boolean default(FALSE)
-# visibility_level :integer default(20), not null
-#
-
class Namespace < ActiveRecord::Base
include Sortable
include Gitlab::ShellAdapter
diff --git a/app/models/note.rb b/app/models/note.rb
index deee2b9e885..f26aa1bf63f 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -1,24 +1,3 @@
-# == Schema Information
-#
-# Table name: notes
-#
-# id :integer not null, primary key
-# note :text
-# noteable_type :string
-# author_id :integer
-# created_at :datetime
-# updated_at :datetime
-# project_id :integer
-# attachment :string
-# line_code :string
-# commit_id :string
-# noteable_id :integer
-# system :boolean default(FALSE), not null
-# st_diff :text
-# updated_by_id :integer
-# is_award :boolean default(FALSE), not null
-#
-
require 'carrierwave/orm/activerecord'
class Note < ActiveRecord::Base
diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb
index 846773752a6..5001738f411 100644
--- a/app/models/notification_setting.rb
+++ b/app/models/notification_setting.rb
@@ -1,16 +1,3 @@
-# == Schema Information
-#
-# Table name: notification_settings
-#
-# id :integer not null, primary key
-# user_id :integer not null
-# source_id :integer not null
-# source_type :string not null
-# level :integer default(0), not null
-# created_at :datetime not null
-# updated_at :datetime not null
-#
-
class NotificationSetting < ActiveRecord::Base
enum level: { disabled: 0, participating: 1, watch: 2, global: 3, mention: 4 }
diff --git a/app/models/oauth_access_token.rb b/app/models/oauth_access_token.rb
index c78c7f4aa0e..116fb71ac08 100644
--- a/app/models/oauth_access_token.rb
+++ b/app/models/oauth_access_token.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: oauth_access_tokens
-#
-# id :integer not null, primary key
-# resource_owner_id :integer
-# application_id :integer
-# token :string not null
-# refresh_token :string
-# expires_in :integer
-# revoked_at :datetime
-# created_at :datetime not null
-# scopes :string
-#
-
class OauthAccessToken < ActiveRecord::Base
belongs_to :resource_owner, class_name: 'User'
belongs_to :application, class_name: 'Doorkeeper::Application'
diff --git a/app/models/personal_snippet.rb b/app/models/personal_snippet.rb
index 1d5f4c50254..82c1c4de3a0 100644
--- a/app/models/personal_snippet.rb
+++ b/app/models/personal_snippet.rb
@@ -1,18 +1,2 @@
-# == Schema Information
-#
-# Table name: snippets
-#
-# id :integer not null, primary key
-# title :string
-# content :text
-# author_id :integer not null
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# file_name :string
-# type :string
-# visibility_level :integer default(0), not null
-#
-
class PersonalSnippet < Snippet
end
diff --git a/app/models/project.rb b/app/models/project.rb
index dfd1e54ecf7..418b85e028a 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1,49 +1,3 @@
-# == Schema Information
-#
-# Table name: projects
-#
-# id :integer not null, primary key
-# name :string
-# path :string
-# description :text
-# created_at :datetime
-# updated_at :datetime
-# creator_id :integer
-# issues_enabled :boolean default(TRUE), not null
-# wall_enabled :boolean default(TRUE), not null
-# merge_requests_enabled :boolean default(TRUE), not null
-# wiki_enabled :boolean default(TRUE), not null
-# namespace_id :integer
-# issues_tracker :string default("gitlab"), not null
-# issues_tracker_id :string
-# snippets_enabled :boolean default(TRUE), not null
-# last_activity_at :datetime
-# import_url :string
-# visibility_level :integer default(0), not null
-# archived :boolean default(FALSE), not null
-# avatar :string
-# import_status :string
-# repository_size :float default(0.0)
-# star_count :integer default(0), not null
-# import_type :string
-# import_source :string
-# commit_count :integer default(0)
-# import_error :text
-# ci_id :integer
-# builds_enabled :boolean default(TRUE), not null
-# shared_runners_enabled :boolean default(TRUE), not null
-# runners_token :string
-# build_coverage_regex :string
-# build_allow_git_fetch :boolean default(TRUE), not null
-# build_timeout :integer default(3600), not null
-# pending_delete :boolean default(FALSE)
-# public_builds :boolean default(TRUE), not null
-# main_language :string
-# pushes_since_gc :integer default(0)
-# last_repository_check_failed :boolean
-# last_repository_check_at :datetime
-#
-
require 'carrierwave/orm/activerecord'
class Project < ActiveRecord::Base
@@ -67,7 +21,6 @@ class Project < ActiveRecord::Base
default_value_for :merge_requests_enabled, gitlab_config_features.merge_requests
default_value_for :builds_enabled, gitlab_config_features.builds
default_value_for :wiki_enabled, gitlab_config_features.wiki
- default_value_for :wall_enabled, false
default_value_for :snippets_enabled, gitlab_config_features.snippets
default_value_for(:shared_runners_enabled) { current_application_settings.shared_runners_enabled }
@@ -767,7 +720,7 @@ class Project < ActiveRecord::Base
# Check if current branch name is marked as protected in the system
def protected_branch?(branch_name)
- protected_branches.where(name: branch_name).any?
+ protected_branch_names.include?(branch_name)
end
def developers_can_push_to_protected_branch?(branch_name)
diff --git a/app/models/project_group_link.rb b/app/models/project_group_link.rb
index 66f5a609bf5..e52a6bd7c84 100644
--- a/app/models/project_group_link.rb
+++ b/app/models/project_group_link.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: project_group_links
-#
-# id :integer not null, primary key
-# project_id :integer not null
-# group_id :integer not null
-# created_at :datetime
-# updated_at :datetime
-# group_access :integer default(30), not null
-#
-
class ProjectGroupLink < ActiveRecord::Base
GUEST = 10
REPORTER = 20
diff --git a/app/models/project_import_data.rb b/app/models/project_import_data.rb
index 7830f764ed3..e2f9ffb69ac 100644
--- a/app/models/project_import_data.rb
+++ b/app/models/project_import_data.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: project_import_data
-#
-# id :integer not null, primary key
-# project_id :integer
-# data :text
-# encrypted_credentials :text
-# encrypted_credentials_iv :string
-# encrypted_credentials_salt :string
-#
-
require 'carrierwave/orm/activerecord'
class ProjectImportData < ActiveRecord::Base
diff --git a/app/models/project_services/asana_service.rb b/app/models/project_services/asana_service.rb
index 368485a060a..7c23b766763 100644
--- a/app/models/project_services/asana_service.rb
+++ b/app/models/project_services/asana_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
require 'asana'
class AsanaService < Service
diff --git a/app/models/project_services/assembla_service.rb b/app/models/project_services/assembla_service.rb
index ffb7455b014..d839221d315 100644
--- a/app/models/project_services/assembla_service.rb
+++ b/app/models/project_services/assembla_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class AssemblaService < Service
include HTTParty
diff --git a/app/models/project_services/bamboo_service.rb b/app/models/project_services/bamboo_service.rb
index c36ee95e378..1d1780dcfbf 100644
--- a/app/models/project_services/bamboo_service.rb
+++ b/app/models/project_services/bamboo_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class BambooService < CiService
include HTTParty
diff --git a/app/models/project_services/buildkite_service.rb b/app/models/project_services/buildkite_service.rb
index f9f4897a065..86a06321e21 100644
--- a/app/models/project_services/buildkite_service.rb
+++ b/app/models/project_services/buildkite_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
require "addressable/uri"
class BuildkiteService < CiService
diff --git a/app/models/project_services/builds_email_service.rb b/app/models/project_services/builds_email_service.rb
index 20cdfcaffb2..54da4d74fc5 100644
--- a/app/models/project_services/builds_email_service.rb
+++ b/app/models/project_services/builds_email_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class BuildsEmailService < Service
prop_accessor :recipients
boolean_accessor :add_pusher
diff --git a/app/models/project_services/campfire_service.rb b/app/models/project_services/campfire_service.rb
index 28c969fe57f..511b2eac792 100644
--- a/app/models/project_services/campfire_service.rb
+++ b/app/models/project_services/campfire_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class CampfireService < Service
prop_accessor :token, :subdomain, :room
validates :token, presence: true, if: :activated?
diff --git a/app/models/project_services/ci_service.rb b/app/models/project_services/ci_service.rb
index 9bc8f982da6..596c00705ad 100644
--- a/app/models/project_services/ci_service.rb
+++ b/app/models/project_services/ci_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
# Base class for CI services
# List methods you need to implement to get your CI service
# working with GitLab Merge Requests
diff --git a/app/models/project_services/custom_issue_tracker_service.rb b/app/models/project_services/custom_issue_tracker_service.rb
index 4d1319eb6f8..6b2b1daa724 100644
--- a/app/models/project_services/custom_issue_tracker_service.rb
+++ b/app/models/project_services/custom_issue_tracker_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class CustomIssueTrackerService < IssueTrackerService
prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url
diff --git a/app/models/project_services/drone_ci_service.rb b/app/models/project_services/drone_ci_service.rb
index d8e00e018cc..966dbc41d73 100644
--- a/app/models/project_services/drone_ci_service.rb
+++ b/app/models/project_services/drone_ci_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class DroneCiService < CiService
prop_accessor :drone_url, :token, :enable_ssl_verification
diff --git a/app/models/project_services/emails_on_push_service.rb b/app/models/project_services/emails_on_push_service.rb
index 2dbd29062df..e0083c43adb 100644
--- a/app/models/project_services/emails_on_push_service.rb
+++ b/app/models/project_services/emails_on_push_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class EmailsOnPushService < Service
prop_accessor :send_from_committer_email
prop_accessor :disable_diffs
diff --git a/app/models/project_services/external_wiki_service.rb b/app/models/project_services/external_wiki_service.rb
index 5469049bb5e..f042bfc5210 100644
--- a/app/models/project_services/external_wiki_service.rb
+++ b/app/models/project_services/external_wiki_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class ExternalWikiService < Service
include HTTParty
diff --git a/app/models/project_services/flowdock_service.rb b/app/models/project_services/flowdock_service.rb
index 3dc1e0fbe8b..dd00275187f 100644
--- a/app/models/project_services/flowdock_service.rb
+++ b/app/models/project_services/flowdock_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
require "flowdock-git-hook"
class FlowdockService < Service
diff --git a/app/models/project_services/gemnasium_service.rb b/app/models/project_services/gemnasium_service.rb
index b4c311cf664..598aca5e06d 100644
--- a/app/models/project_services/gemnasium_service.rb
+++ b/app/models/project_services/gemnasium_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
require "gemnasium/gitlab_service"
class GemnasiumService < Service
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb
index a92f7226083..bbc312f5215 100644
--- a/app/models/project_services/gitlab_ci_service.rb
+++ b/app/models/project_services/gitlab_ci_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
# TODO(ayufan): The GitLabCiService is deprecated and the type should be removed when the database entries are removed
class GitlabCiService < CiService
# We override the active accessor to always make GitLabCiService disabled
diff --git a/app/models/project_services/gitlab_issue_tracker_service.rb b/app/models/project_services/gitlab_issue_tracker_service.rb
index 1adaeeb3b2b..5d17c358330 100644
--- a/app/models/project_services/gitlab_issue_tracker_service.rb
+++ b/app/models/project_services/gitlab_issue_tracker_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class GitlabIssueTrackerService < IssueTrackerService
include Gitlab::Routing.url_helpers
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb
index f9ddf588722..0ff4f4c8dd2 100644
--- a/app/models/project_services/hipchat_service.rb
+++ b/app/models/project_services/hipchat_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class HipchatService < Service
MAX_COMMITS = 3
diff --git a/app/models/project_services/irker_service.rb b/app/models/project_services/irker_service.rb
index b9a592d7096..91015e6c9b1 100644
--- a/app/models/project_services/irker_service.rb
+++ b/app/models/project_services/irker_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
require 'uri'
class IrkerService < Service
diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb
index 98a3a7c6b86..6ae9b16d3ce 100644
--- a/app/models/project_services/issue_tracker_service.rb
+++ b/app/models/project_services/issue_tracker_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class IssueTrackerService < Service
validates :project_url, :issues_url, :new_issue_url, presence: true, url: true, if: :activated?
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb
index ba68658f0bd..beda89d3963 100644
--- a/app/models/project_services/jira_service.rb
+++ b/app/models/project_services/jira_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class JiraService < IssueTrackerService
include HTTParty
include Gitlab::Routing.url_helpers
diff --git a/app/models/project_services/pivotaltracker_service.rb b/app/models/project_services/pivotaltracker_service.rb
index acaa0c39365..ad19b7795da 100644
--- a/app/models/project_services/pivotaltracker_service.rb
+++ b/app/models/project_services/pivotaltracker_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class PivotaltrackerService < Service
include HTTParty
diff --git a/app/models/project_services/pushover_service.rb b/app/models/project_services/pushover_service.rb
index a640c8cb440..3dd878e4c7d 100644
--- a/app/models/project_services/pushover_service.rb
+++ b/app/models/project_services/pushover_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class PushoverService < Service
include HTTParty
base_uri 'https://api.pushover.net/1'
diff --git a/app/models/project_services/redmine_service.rb b/app/models/project_services/redmine_service.rb
index e2137e92c62..11cce3e0561 100644
--- a/app/models/project_services/redmine_service.rb
+++ b/app/models/project_services/redmine_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class RedmineService < IssueTrackerService
prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url
diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb
index 83ffa53a407..cf9e4d5a8b6 100644
--- a/app/models/project_services/slack_service.rb
+++ b/app/models/project_services/slack_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class SlackService < Service
prop_accessor :webhook, :username, :channel
boolean_accessor :notify_only_broken_builds
diff --git a/app/models/project_services/teamcity_service.rb b/app/models/project_services/teamcity_service.rb
index 4015da31509..b0dcb52eba1 100644
--- a/app/models/project_services/teamcity_service.rb
+++ b/app/models/project_services/teamcity_service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
class TeamcityService < CiService
include HTTParty
diff --git a/app/models/project_snippet.rb b/app/models/project_snippet.rb
index b4b2807eba4..5fba6baa204 100644
--- a/app/models/project_snippet.rb
+++ b/app/models/project_snippet.rb
@@ -1,19 +1,3 @@
-# == Schema Information
-#
-# Table name: snippets
-#
-# id :integer not null, primary key
-# title :string
-# content :text
-# author_id :integer not null
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# file_name :string
-# type :string
-# visibility_level :integer default(0), not null
-#
-
class ProjectSnippet < Snippet
belongs_to :project
belongs_to :author, class_name: "User"
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb
index 3d2052c892c..33cf046fa75 100644
--- a/app/models/protected_branch.rb
+++ b/app/models/protected_branch.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: protected_branches
-#
-# id :integer not null, primary key
-# project_id :integer not null
-# name :string not null
-# created_at :datetime
-# updated_at :datetime
-# developers_can_push :boolean default(FALSE), not null
-#
-
class ProtectedBranch < ActiveRecord::Base
include Gitlab::ShellAdapter
diff --git a/app/models/release.rb b/app/models/release.rb
index dc700d1ea5a..e196b84eb18 100644
--- a/app/models/release.rb
+++ b/app/models/release.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: releases
-#
-# id :integer not null, primary key
-# tag :string
-# description :text
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-#
-
class Release < ActiveRecord::Base
belongs_to :project
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 7aebfe279fb..a4b42d7226d 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -81,7 +81,7 @@ class Repository
def commit(id = 'HEAD')
return nil unless exists?
commit = Gitlab::Git::Commit.find(raw_repository, id)
- commit = Commit.new(commit, @project) if commit
+ commit = ::Commit.new(commit, @project) if commit
commit
rescue Rugged::OdbError
nil
diff --git a/app/models/security_event.rb b/app/models/security_event.rb
index 0bee03974f1..d131c11cb6c 100644
--- a/app/models/security_event.rb
+++ b/app/models/security_event.rb
@@ -1,16 +1,2 @@
-# == Schema Information
-#
-# Table name: audit_events
-#
-# id :integer not null, primary key
-# author_id :integer not null
-# type :string not null
-# entity_id :integer not null
-# entity_type :string not null
-# details :text
-# created_at :datetime
-# updated_at :datetime
-#
-
class SecurityEvent < AuditEvent
end
diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb
index 99279a2e083..375f195dba7 100644
--- a/app/models/sent_notification.rb
+++ b/app/models/sent_notification.rb
@@ -1,17 +1,3 @@
-# == Schema Information
-#
-# Table name: sent_notifications
-#
-# id :integer not null, primary key
-# project_id :integer
-# noteable_id :integer
-# noteable_type :string
-# recipient_id :integer
-# commit_id :string
-# reply_key :string not null
-# line_code :string
-#
-
class SentNotification < ActiveRecord::Base
belongs_to :project
belongs_to :noteable, polymorphic: true
diff --git a/app/models/service.rb b/app/models/service.rb
index bf16a545307..de3fd24584a 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -1,27 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string
-# title :string
-# project_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-# active :boolean not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-# category :string default("common"), not null
-# default :boolean default(FALSE)
-# wiki_page_events :boolean default(TRUE)
-#
-
# To add new service you should build a class inherited from Service
# and implement a set of methods
class Service < ActiveRecord::Base
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 2f905a90942..0a3c3b57669 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -1,19 +1,3 @@
-# == Schema Information
-#
-# Table name: snippets
-#
-# id :integer not null, primary key
-# title :string
-# content :text
-# author_id :integer not null
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# file_name :string
-# type :string
-# visibility_level :integer default(0), not null
-#
-
class Snippet < ActiveRecord::Base
include Gitlab::VisibilityLevel
include Linguist::BlobHelper
diff --git a/app/models/spam_log.rb b/app/models/spam_log.rb
index f49eb7d88e2..12df68ef83b 100644
--- a/app/models/spam_log.rb
+++ b/app/models/spam_log.rb
@@ -1,20 +1,3 @@
-# == Schema Information
-#
-# Table name: spam_logs
-#
-# id :integer not null, primary key
-# user_id :integer
-# source_ip :string
-# user_agent :string
-# via_api :boolean
-# project_id :integer
-# noteable_type :string
-# title :string
-# description :text
-# created_at :datetime not null
-# updated_at :datetime not null
-#
-
class SpamLog < ActiveRecord::Base
belongs_to :user
diff --git a/app/models/subscription.rb b/app/models/subscription.rb
index 242faa7d32e..3b8aa1eb866 100644
--- a/app/models/subscription.rb
+++ b/app/models/subscription.rb
@@ -1,16 +1,3 @@
-# == Schema Information
-#
-# Table name: subscriptions
-#
-# id :integer not null, primary key
-# user_id :integer
-# subscribable_id :integer
-# subscribable_type :string
-# subscribed :boolean
-# created_at :datetime
-# updated_at :datetime
-#
-
class Subscription < ActiveRecord::Base
belongs_to :user
belongs_to :subscribable, polymorphic: true
diff --git a/app/models/todo.rb b/app/models/todo.rb
index d85f7bfdf57..f8b59fe4126 100644
--- a/app/models/todo.rb
+++ b/app/models/todo.rb
@@ -1,21 +1,3 @@
-# == Schema Information
-#
-# Table name: todos
-#
-# id :integer not null, primary key
-# user_id :integer not null
-# project_id :integer not null
-# target_id :integer
-# target_type :string not null
-# author_id :integer
-# action :integer not null
-# state :string not null
-# created_at :datetime
-# updated_at :datetime
-# note_id :integer
-# commit_id :string
-#
-
class Todo < ActiveRecord::Base
ASSIGNED = 1
MENTIONED = 2
diff --git a/app/models/user.rb b/app/models/user.rb
index 959b1f93758..1e4814641d1 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,68 +1,3 @@
-# == Schema Information
-#
-# Table name: users
-#
-# id :integer not null, primary key
-# email :string default(""), not null
-# encrypted_password :string default(""), not null
-# reset_password_token :string
-# reset_password_sent_at :datetime
-# remember_created_at :datetime
-# sign_in_count :integer default(0)
-# current_sign_in_at :datetime
-# last_sign_in_at :datetime
-# current_sign_in_ip :string
-# last_sign_in_ip :string
-# created_at :datetime
-# updated_at :datetime
-# name :string
-# admin :boolean default(FALSE), not null
-# projects_limit :integer default(10)
-# skype :string default(""), not null
-# linkedin :string default(""), not null
-# twitter :string default(""), not null
-# authentication_token :string
-# theme_id :integer default(1), not null
-# bio :string
-# failed_attempts :integer default(0)
-# locked_at :datetime
-# username :string
-# can_create_group :boolean default(TRUE), not null
-# can_create_team :boolean default(TRUE), not null
-# state :string
-# color_scheme_id :integer default(1), not null
-# notification_level :integer default(1), not null
-# password_expires_at :datetime
-# created_by_id :integer
-# last_credential_check_at :datetime
-# avatar :string
-# confirmation_token :string
-# confirmed_at :datetime
-# confirmation_sent_at :datetime
-# unconfirmed_email :string
-# hide_no_ssh_key :boolean default(FALSE)
-# website_url :string default(""), not null
-# notification_email :string
-# hide_no_password :boolean default(FALSE)
-# password_automatically_set :boolean default(FALSE)
-# location :string
-# encrypted_otp_secret :string
-# encrypted_otp_secret_iv :string
-# encrypted_otp_secret_salt :string
-# otp_required_for_login :boolean default(FALSE), not null
-# otp_backup_codes :text
-# public_email :string default(""), not null
-# dashboard :integer default(0)
-# project_view :integer default(0)
-# consumed_timestep :integer
-# layout :integer default(0)
-# hide_project_limit :boolean default(FALSE)
-# unlock_token :string
-# otp_grace_period_started_at :datetime
-# ldap_email :boolean default(FALSE), not null
-# external :boolean default(FALSE)
-#
-
require 'carrierwave/orm/activerecord'
class User < ActiveRecord::Base
@@ -86,7 +21,7 @@ class User < ActiveRecord::Base
default_value_for :theme_id, gitlab_config.default_theme
devise :two_factor_authenticatable,
- otp_secret_encryption_key: File.read(Rails.root.join('.secret')).chomp
+ otp_secret_encryption_key: Gitlab::Application.config.secret_key_base
alias_attribute :two_factor_enabled, :otp_required_for_login
devise :two_factor_backupable, otp_number_of_backup_codes: 10
diff --git a/app/models/users_star_project.rb b/app/models/users_star_project.rb
index 413f3f485a8..0dfe597317e 100644
--- a/app/models/users_star_project.rb
+++ b/app/models/users_star_project.rb
@@ -1,14 +1,3 @@
-# == Schema Information
-#
-# Table name: users_star_projects
-#
-# id :integer not null, primary key
-# project_id :integer not null
-# user_id :integer not null
-# created_at :datetime
-# updated_at :datetime
-#
-
class UsersStarProject < ActiveRecord::Base
belongs_to :project, counter_cache: :star_count, touch: true
belongs_to :user
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 82a0e2fd1f5..4bdb1b0c074 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -351,7 +351,7 @@ class SystemNoteService
# Returns an Array of Strings
def self.new_commit_summary(new_commits)
new_commits.collect do |commit|
- "* #{commit.short_id} - #{commit.title}"
+ "* #{commit.short_id} - #{escape_html(commit.title)}"
end
end
@@ -433,4 +433,8 @@ class SystemNoteService
body = "Moved #{direction} #{cross_reference}"
create_note(noteable: noteable, project: project, author: author, note: body)
end
+
+ def self.escape_html(text)
+ Rack::Utils.escape_html(text)
+ end
end
diff --git a/app/views/admin/runners/_runner.html.haml b/app/views/admin/runners/_runner.html.haml
index 6745e58deca..36b21eefdee 100644
--- a/app/views/admin/runners/_runner.html.haml
+++ b/app/views/admin/runners/_runner.html.haml
@@ -11,18 +11,10 @@
= link_to admin_runner_path(runner) do
= runner.short_sha
%td
- .runner-description
- = runner.description
- %span (#{link_to 'edit', '#', class: 'edit-runner-link'})
- .runner-description-form.hide
- = form_for [:admin, runner], remote: true, html: { class: 'form-inline' } do |f|
- .form-group
- = f.text_field :description, class: 'form-control'
- = f.submit 'Save', class: 'btn'
- %span (#{link_to 'cancel', '#', class: 'cancel'})
+ = runner.description
%td
- if runner.shared?
- \-
+ n/a
- else
= runner.projects.count(:all)
%td
diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml
index 86930d4eaaf..172579dafda 100644
--- a/app/views/layouts/header/_default.html.haml
+++ b/app/views/layouts/header/_default.html.haml
@@ -1,9 +1,12 @@
%header.navbar.navbar-fixed-top.navbar-gitlab{ class: nav_header_class }
%div{ class: fluid_layout ? "container-fluid" : "container-fluid" }
.header-content
- %button.navbar-toggle{type: 'button'}
+ %button.side-nav-toggle{type: 'button'}
%span.sr-only Toggle navigation
= icon('bars')
+ %button.navbar-toggle{type: 'button'}
+ %span.sr-only Toggle navigation
+ = icon('angle-left')
.navbar-collapse.collapse
%ul.nav.navbar-nav
diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml
index 9ad86ed71c9..5cf70ea3bb7 100644
--- a/app/views/projects/issues/_issue.html.haml
+++ b/app/views/projects/issues/_issue.html.haml
@@ -28,16 +28,10 @@
= downvotes
- note_count = issue.notes.user.nonawards.count
- - if note_count > 0
- %li
- = link_to issue_path(issue) + "#notes" do
- = icon('comments')
- = note_count
- - else
- %li
- = link_to issue_path(issue) + "#notes", class: "issue-no-comments" do
- = icon('comments')
- = note_count
+ %li
+ = link_to issue_path(issue, anchor: 'notes'), class: ('issue-no-comments' if note_count.zero?) do
+ = icon('comments')
+ = note_count
.issue-info
#{issue.to_reference} &middot;
diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml
index e740fe8c84d..73c6a95f5ca 100644
--- a/app/views/projects/merge_requests/_merge_request.html.haml
+++ b/app/views/projects/merge_requests/_merge_request.html.haml
@@ -36,16 +36,10 @@
= downvotes
- note_count = merge_request.mr_and_commit_notes.user.nonawards.count
- - if note_count > 0
- %li
- = link_to merge_request_path(merge_request) + "#notes" do
- = icon('comments')
- = note_count
- - else
- %li
- = link_to merge_request_path(merge_request) + "#notes", class: "merge-request-no-comments" do
- = icon('comments')
- = note_count
+ %li
+ = link_to merge_request_path(merge_request, anchor: 'notes'), class: ('merge-request-no-comments' if note_count.zero?) do
+ = icon('comments')
+ = note_count
.merge-request-info
#{merge_request.to_reference} &middot;
diff --git a/app/views/projects/merge_requests/widget/_heading.html.haml b/app/views/projects/merge_requests/widget/_heading.html.haml
index 2ec0d20a879..4d381754610 100644
--- a/app/views/projects/merge_requests/widget/_heading.html.haml
+++ b/app/views/projects/merge_requests/widget/_heading.html.haml
@@ -41,9 +41,4 @@
.ci_widget.ci-error{style: "display:none"}
= icon("times-circle")
- Could not connect to the CI server. Please check your settings and try again.
-
- :javascript
- $(function() {
- merge_request_widget.getCIStatus(false);
- });
+ Could not connect to the CI server. Please check your settings and try again. \ No newline at end of file
diff --git a/app/views/projects/tags/new.html.haml b/app/views/projects/tags/new.html.haml
index b40a6e5cb2d..f9306453297 100644
--- a/app/views/projects/tags/new.html.haml
+++ b/app/views/projects/tags/new.html.haml
@@ -23,7 +23,7 @@
.form-group
= label_tag :message, nil, class: 'control-label'
.col-sm-10
- = text_field_tag :message, nil, required: false, tabindex: 3, class: 'form-control'
+ = text_area_tag :message, nil, required: false, tabindex: 3, class: 'form-control', rows: 5
.help-block Optionally, enter a message to create an annotated tag.
%hr
.form-group
diff --git a/app/views/projects/tags/show.html.haml b/app/views/projects/tags/show.html.haml
index 9c916fd02de..9f1424aecc7 100644
--- a/app/views/projects/tags/show.html.haml
+++ b/app/views/projects/tags/show.html.haml
@@ -19,15 +19,13 @@
%i.fa.fa-trash-o
.title
%span.item-title= @tag.name
- - if @tag.message.present?
- %span.light
- &nbsp;
- = strip_gpg_signature(@tag.message)
- if @commit
= render 'projects/branches/commit', commit: @commit, project: @project
- else
Cant find HEAD commit for this tag
-
+ - if @tag.message.present?
+ %pre.body
+ = strip_gpg_signature(@tag.message)
.append-bottom-default.prepend-top-default
- if @release.description.present?
diff --git a/config/application.rb b/config/application.rb
index b602e2b6168..cba80f38f1f 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -1,23 +1,30 @@
require File.expand_path('../boot', __FILE__)
require 'rails/all'
-require 'devise'
-I18n.config.enforce_available_locales = false
+
Bundler.require(:default, Rails.env)
-require_relative '../lib/gitlab/redis'
module Gitlab
class Application < Rails::Application
+ require_dependency Rails.root.join('lib/gitlab/redis')
+
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
- # Custom directories with classes and modules you want to be autoloadable.
- config.autoload_paths.push(*%W(#{config.root}/lib
- #{config.root}/app/models/hooks
- #{config.root}/app/models/concerns
- #{config.root}/app/models/project_services
- #{config.root}/app/models/members))
+ # Sidekiq uses eager loading, but directories not in the standard Rails
+ # directories must be added to the eager load paths:
+ # https://github.com/mperham/sidekiq/wiki/FAQ#why-doesnt-sidekiq-autoload-my-rails-application-code
+ # Also, there is no need to add `lib` to autoload_paths since autoloading is
+ # configured to check for eager loaded paths:
+ # https://github.com/rails/rails/blob/v4.2.6/railties/lib/rails/engine.rb#L687
+ # This is a nice reference article on autoloading/eager loading:
+ # http://blog.arkency.com/2014/11/dont-forget-about-eager-load-when-extending-autoload
+ config.eager_load_paths.push(*%W(#{config.root}/lib
+ #{config.root}/app/models/ci
+ #{config.root}/app/models/hooks
+ #{config.root}/app/models/members
+ #{config.root}/app/models/project_services))
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
diff --git a/config/gitlab.teatro.yml b/config/gitlab.teatro.yml
index f0656400beb..01c8dc5ff98 100644
--- a/config/gitlab.teatro.yml
+++ b/config/gitlab.teatro.yml
@@ -15,7 +15,6 @@ production: &base
issues: true
merge_requests: true
wiki: true
- wall: false
snippets: false
visibility_level: "private" # can be "private" | "internal" | "public"
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 8db2c05fe45..23c8cea038a 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -1,4 +1,4 @@
-require 'gitlab' # Load lib/gitlab.rb as soon as possible
+require_dependency Rails.root.join('lib/gitlab') # Load Gitlab as soon as possible
class Settings < Settingslogic
source ENV.fetch('GITLAB_CONFIG') { "#{Rails.root}/config/gitlab.yml" }
diff --git a/config/initializers/5_backend.rb b/config/initializers/5_backend.rb
index 80d641d73a3..e026151a032 100644
--- a/config/initializers/5_backend.rb
+++ b/config/initializers/5_backend.rb
@@ -1,11 +1,11 @@
# GIT over HTTP
-require Rails.root.join("lib", "gitlab", "backend", "grack_auth")
+require_dependency Rails.root.join('lib/gitlab/backend/grack_auth')
# GIT over SSH
-require Rails.root.join("lib", "gitlab", "backend", "shell")
+require_dependency Rails.root.join('lib/gitlab/backend/shell')
# GitLab shell adapter
-require Rails.root.join("lib", "gitlab", "backend", "shell_adapter")
+require_dependency Rails.root.join('lib/gitlab/backend/shell_adapter')
required_version = Gitlab::VersionInfo.parse(Gitlab::Shell.version_required)
current_version = Gitlab::VersionInfo.parse(Gitlab::Shell.new.version)
diff --git a/config/initializers/trusted_proxies.rb b/config/initializers/trusted_proxies.rb
index b8cc025bae2..d256a16d42b 100644
--- a/config/initializers/trusted_proxies.rb
+++ b/config/initializers/trusted_proxies.rb
@@ -1,2 +1,3 @@
-Rails.application.config.action_dispatch.trusted_proxies =
+Rails.application.config.action_dispatch.trusted_proxies = (
[ '127.0.0.1', '::1' ] + Array(Gitlab.config.gitlab.trusted_proxies)
+).map { |proxy| IPAddr.new(proxy) }
diff --git a/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb b/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb
new file mode 100644
index 00000000000..aa560bc0f0c
--- /dev/null
+++ b/db/migrate/20160508194200_remove_wall_enabled_from_projects.rb
@@ -0,0 +1,5 @@
+class RemoveWallEnabledFromProjects < ActiveRecord::Migration
+ def change
+ remove_column :projects, :wall_enabled, :boolean, default: true, null: false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 7683aad968c..71d953afe30 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20160421130527) do
+ActiveRecord::Schema.define(version: 20160508194200) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -728,7 +728,6 @@ ActiveRecord::Schema.define(version: 20160421130527) do
t.datetime "updated_at"
t.integer "creator_id"
t.boolean "issues_enabled", default: true, null: false
- t.boolean "wall_enabled", default: true, null: false
t.boolean "merge_requests_enabled", default: true, null: false
t.boolean "wiki_enabled", default: true, null: false
t.integer "namespace_id"
diff --git a/doc/api/build_triggers.md b/doc/api/build_triggers.md
index 4a12e962b62..0881a7d7a90 100644
--- a/doc/api/build_triggers.md
+++ b/doc/api/build_triggers.md
@@ -101,8 +101,18 @@ DELETE /projects/:id/triggers/:token
| Attribute | Type | required | Description |
|-----------|---------|----------|--------------------------|
| `id` | integer | yes | The ID of a project |
-| `token` | string | yes | The `token` of a project |
+| `token` | string | yes | The `token` of a trigger |
```
curl -X DELETE -H "PRIVATE_TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/triggers/7b9148c158980bbd9bcea92c17522d"
```
+
+```json
+{
+ "created_at": "2015-12-23T16:25:56.760Z",
+ "deleted_at": "2015-12-24T12:32:20.100Z",
+ "last_used": null,
+ "token": "7b9148c158980bbd9bcea92c17522d",
+ "updated_at": "2015-12-24T12:32:20.100Z"
+}
+```
diff --git a/doc/api/issues.md b/doc/api/issues.md
index 3e78149f442..fc7a7ae0c0c 100644
--- a/doc/api/issues.md
+++ b/doc/api/issues.md
@@ -77,7 +77,8 @@ Example response:
"created_at" : "2016-01-04T15:31:51.081Z",
"iid" : 6,
"labels" : [],
- "subscribed" : false
+ "subscribed" : false,
+ "user_notes_count": 1
}
]
```
@@ -154,7 +155,8 @@ Example response:
"title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
"updated_at" : "2016-01-04T15:31:46.176Z",
"created_at" : "2016-01-04T15:31:46.176Z",
- "subscribed" : false
+ "subscribed" : false,
+ "user_notes_count": 1
}
]
```
@@ -216,7 +218,8 @@ Example response:
"title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
"updated_at" : "2016-01-04T15:31:46.176Z",
"created_at" : "2016-01-04T15:31:46.176Z",
- "subscribed": false
+ "subscribed": false,
+ "user_notes_count": 1
}
```
@@ -271,7 +274,8 @@ Example response:
"description" : null,
"updated_at" : "2016-01-07T12:44:33.959Z",
"milestone" : null,
- "subscribed" : true
+ "subscribed" : true,
+ "user_notes_count": 0
}
```
@@ -329,7 +333,8 @@ Example response:
"id" : 85,
"assignee" : null,
"milestone" : null,
- "subscribed" : true
+ "subscribed" : true,
+ "user_notes_count": 0
}
```
diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md
index 2057f9d77aa..8217e30fe25 100644
--- a/doc/api/merge_requests.md
+++ b/doc/api/merge_requests.md
@@ -67,7 +67,8 @@ Parameters:
},
"merge_when_build_succeeds": true,
"merge_status": "can_be_merged",
- "subscribed" : false
+ "subscribed" : false,
+ "user_notes_count": 1
}
]
```
@@ -130,7 +131,8 @@ Parameters:
},
"merge_when_build_succeeds": true,
"merge_status": "can_be_merged",
- "subscribed" : true
+ "subscribed" : true,
+ "user_notes_count": 1
}
```
@@ -230,6 +232,7 @@ Parameters:
"merge_when_build_succeeds": true,
"merge_status": "can_be_merged",
"subscribed" : true,
+ "user_notes_count": 1,
"changes": [
{
"old_path": "VERSION",
@@ -308,7 +311,8 @@ Parameters:
},
"merge_when_build_succeeds": true,
"merge_status": "can_be_merged",
- "subscribed" : true
+ "subscribed" : true,
+ "user_notes_count": 0
}
```
@@ -378,7 +382,8 @@ Parameters:
},
"merge_when_build_succeeds": true,
"merge_status": "can_be_merged",
- "subscribed" : true
+ "subscribed" : true,
+ "user_notes_count": 1
}
```
@@ -472,7 +477,8 @@ Parameters:
},
"merge_when_build_succeeds": true,
"merge_status": "can_be_merged",
- "subscribed" : true
+ "subscribed" : true,
+ "user_notes_count": 1
}
```
@@ -537,7 +543,8 @@ Parameters:
},
"merge_when_build_succeeds": true,
"merge_status": "can_be_merged",
- "subscribed" : true
+ "subscribed" : true,
+ "user_notes_count": 1
}
```
@@ -602,7 +609,8 @@ Example response:
"title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
"created_at" : "2016-01-04T15:31:51.081Z",
"iid" : 6,
- "labels" : []
+ "labels" : [],
+ "user_notes_count": 1
},
]
```
diff --git a/doc/api/notes.md b/doc/api/notes.md
index a6b5b1787fd..7aa1c2155bf 100644
--- a/doc/api/notes.md
+++ b/doc/api/notes.md
@@ -15,7 +15,7 @@ GET /projects/:id/issues/:issue_id/notes
Parameters:
- `id` (required) - The ID of a project
-- `issue_id` (required) - The IID of an issue (not ID)
+- `issue_id` (required) - The ID of an issue
```json
[
@@ -73,7 +73,7 @@ GET /projects/:id/issues/:issue_id/notes/:note_id
Parameters:
- `id` (required) - The ID of a project
-- `issue_id` (required) - The IID of a project issue (not ID)
+- `issue_id` (required) - The ID of a project issue
- `note_id` (required) - The ID of an issue note
### Create new issue note
@@ -87,7 +87,7 @@ POST /projects/:id/issues/:issue_id/notes
Parameters:
- `id` (required) - The ID of a project
-- `issue_id` (required) - The IID of an issue (not ID)
+- `issue_id` (required) - The ID of an issue
- `body` (required) - The content of a note
- `created_at` (optional) - Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z
@@ -102,7 +102,7 @@ PUT /projects/:id/issues/:issue_id/notes/:note_id
Parameters:
- `id` (required) - The ID of a project
-- `issue_id` (required) - The IID of an issue (not ID)
+- `issue_id` (required) - The ID of an issue
- `note_id` (required) - The ID of a note
- `body` (required) - The content of a note
@@ -120,7 +120,7 @@ Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `id` | integer | yes | The ID of a project |
-| `issue_id` | integer | yes | The IID of an issue |
+| `issue_id` | integer | yes | The ID of an issue |
| `note_id` | integer | yes | The ID of a note |
```bash
diff --git a/doc/api/users.md b/doc/api/users.md
index 7d2b4897cff..7e848586dbd 100644
--- a/doc/api/users.md
+++ b/doc/api/users.md
@@ -20,6 +20,7 @@ GET /users
"name": "John Smith",
"state": "active",
"avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
+ "web_url": "http://localhost:3000/u/john_smith"
},
{
"id": 2,
@@ -27,6 +28,7 @@ GET /users
"name": "Jack Smith",
"state": "blocked",
"avatar_url": "http://gravatar.com/../e32131cd8.jpeg",
+ "web_url": "http://localhost:3000/u/jack_smith"
}
]
```
@@ -45,21 +47,31 @@ GET /users
"email": "john@example.com",
"name": "John Smith",
"state": "active",
+ "avatar_url": "http://localhost:3000/uploads/user/avatar/1/index.jpg",
+ "web_url": "http://localhost:3000/u/john_smith",
"created_at": "2012-05-23T08:00:58Z",
+ "is_admin": false,
"bio": null,
+ "location": null,
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
- "extern_uid": "john.smith",
- "provider": "provider_name",
+ "last_sign_in_at": "2012-06-01T11:41:01Z",
+ "confirmed_at": "2012-05-23T09:05:22Z",
"theme_id": 1,
"color_scheme_id": 2,
- "is_admin": false,
- "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
+ "projects_limit": 100,
+ "current_sign_in_at": "2012-06-02T06:36:55Z",
+ "identities": [
+ {"provider": "github", "extern_uid": "2435223452345"},
+ {"provider": "bitbucket", "extern_uid": "john.smith"},
+ {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"}
+ ],
"can_create_group": true,
- "current_sign_in_at": "2014-03-19T13:12:15Z",
- "two_factor_enabled": true
+ "can_create_project": true,
+ "two_factor_enabled": true,
+ "external": false
},
{
"id": 2,
@@ -67,24 +79,27 @@ GET /users
"email": "jack@example.com",
"name": "Jack Smith",
"state": "blocked",
+ "avatar_url": "http://localhost:3000/uploads/user/avatar/2/index.jpg",
+ "web_url": "http://localhost:3000/u/jack_smith",
"created_at": "2012-05-23T08:01:01Z",
+ "is_admin": false,
"bio": null,
"location": null,
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
- "extern_uid": "jack.smith",
- "provider": "provider_name",
+ "last_sign_in_at": null,
+ "confirmed_at": "2012-05-30T16:53:06.148Z",
"theme_id": 1,
"color_scheme_id": 3,
- "is_admin": false,
- "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
- "can_create_group": true,
- "can_create_project": true,
"projects_limit": 100,
"current_sign_in_at": "2014-03-19T17:54:13Z",
- "two_factor_enabled": false
+ "identities": [],
+ "can_create_group": true,
+ "can_create_project": true,
+ "two_factor_enabled": true,
+ "external": false
}
]
```
@@ -124,6 +139,7 @@ Parameters:
"name": "John Smith",
"state": "active",
"avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
+ "web_url": "http://localhost:3000/u/john_smith",
"created_at": "2012-05-23T08:00:58Z",
"is_admin": false,
"bio": null,
@@ -152,23 +168,31 @@ Parameters:
"email": "john@example.com",
"name": "John Smith",
"state": "active",
+ "avatar_url": "http://localhost:3000/uploads/user/avatar/1/index.jpg",
+ "web_url": "http://localhost:3000/u/john_smith",
"created_at": "2012-05-23T08:00:58Z",
- "confirmed_at": "2012-05-23T08:00:58Z",
- "last_sign_in_at": "2015-03-23T08:00:58Z",
+ "is_admin": false,
"bio": null,
"location": null,
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
- "extern_uid": "john.smith",
- "provider": "provider_name",
+ "last_sign_in_at": "2012-06-01T11:41:01Z",
+ "confirmed_at": "2012-05-23T09:05:22Z",
"theme_id": 1,
"color_scheme_id": 2,
- "is_admin": false,
+ "projects_limit": 100,
+ "current_sign_in_at": "2012-06-02T06:36:55Z",
+ "identities": [
+ {"provider": "github", "extern_uid": "2435223452345"},
+ {"provider": "bitbucket", "extern_uid": "john.smith"},
+ {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"}
+ ],
"can_create_group": true,
"can_create_project": true,
- "projects_limit": 100
+ "two_factor_enabled": true,
+ "external": false
}
```
@@ -261,21 +285,33 @@ GET /user
"username": "john_smith",
"email": "john@example.com",
"name": "John Smith",
- "private_token": "dd34asd13as",
"state": "active",
+ "avatar_url": "http://localhost:3000/uploads/user/avatar/1/index.jpg",
+ "web_url": "http://localhost:3000/u/john_smith",
"created_at": "2012-05-23T08:00:58Z",
+ "is_admin": false,
"bio": null,
"location": null,
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
+ "last_sign_in_at": "2012-06-01T11:41:01Z",
+ "confirmed_at": "2012-05-23T09:05:22Z",
"theme_id": 1,
"color_scheme_id": 2,
- "is_admin": false,
+ "projects_limit": 100,
+ "current_sign_in_at": "2012-06-02T06:36:55Z",
+ "identities": [
+ {"provider": "github", "extern_uid": "2435223452345"},
+ {"provider": "bitbucket", "extern_uid": "john_smith"},
+ {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"}
+ ],
"can_create_group": true,
"can_create_project": true,
- "projects_limit": 100
+ "two_factor_enabled": true,
+ "external": false,
+ "private_token": "dd34asd13as"
}
```
diff --git a/doc/ci/docker/using_docker_build.md b/doc/ci/docker/using_docker_build.md
index 5fb086b1dd9..ca52a483a59 100644
--- a/doc/ci/docker/using_docker_build.md
+++ b/doc/ci/docker/using_docker_build.md
@@ -41,9 +41,9 @@ GitLab Runner then executes build scripts as `gitlab-runner` user.
--description "My Runner"
```
-2. Install Docker on server.
+2. Install Docker Engine on server.
- For more information how to install Docker on different systems checkout the [Supported installations](https://docs.docker.com/installation/).
+ For more information how to install Docker Engine on different systems checkout the [Supported installations](https://docs.docker.com/engine/installation/).
3. Add `gitlab-runner` user to `docker` group:
@@ -151,4 +151,4 @@ In order to do that follow the steps:
An example project using this approach can be found here: https://gitlab.com/gitlab-examples/docker.
[docker-in-docker]: https://blog.docker.com/2013/09/docker-can-now-run-within-docker/
-[docker-cap]: https://docs.docker.com/reference/run/#runtime-privilege-and-linux-capabilities
+[docker-cap]: https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities
diff --git a/doc/ci/docker/using_docker_images.md b/doc/ci/docker/using_docker_images.md
index 84212fb3c61..56ac2195c49 100644
--- a/doc/ci/docker/using_docker_images.md
+++ b/doc/ci/docker/using_docker_images.md
@@ -64,7 +64,7 @@ You can see some widely used services examples in the relevant documentation of
### How is service linked to the build
To better understand how the container linking works, read
-[Linking containers together](https://docs.docker.com/userguide/dockerlinks/).
+[Linking containers together][linking-containers].
To summarize, if you add `mysql` as service to your application, the image will
then be used to create a container that is linked to the build container.
@@ -273,7 +273,7 @@ creation.
[Docker Fundamentals]: https://docs.docker.com/engine/understanding-docker/
[hub]: https://hub.docker.com/
[linking-containers]: https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/
-[tutum/wordpress]: https://registry.hub.docker.com/u/tutum/wordpress/
-[postgres-hub]: https://registry.hub.docker.com/u/library/postgres/
-[mysql-hub]: https://registry.hub.docker.com/u/library/mysql/
+[tutum/wordpress]: https://hub.docker.com/r/tutum/wordpress/
+[postgres-hub]: https://hub.docker.com/r/_/postgres/
+[mysql-hub]: https://hub.docker.com/r/_/mysql/
[runner-priv-reg]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/configuration/advanced-configuration.md#using-a-private-docker-registry
diff --git a/doc/ci/examples/README.md b/doc/ci/examples/README.md
index cc059dc4376..61294be599d 100644
--- a/doc/ci/examples/README.md
+++ b/doc/ci/examples/README.md
@@ -4,12 +4,12 @@
- [Test and deploy a Ruby application to Heroku](test-and-deploy-ruby-application-to-heroku.md)
- [Test and deploy a Python application to Heroku](test-and-deploy-python-application-to-heroku.md)
- [Test a Clojure application](test-clojure-application.md)
-- [Using `dpl` as deployment tool](deployment/README.md)
+- [Using `dpl` as deployment tool](../deployment/README.md)
- Help your favorite programming language and GitLab by sending a merge request
with a guide for that language.
## Outside the documentation
-- [Blost post about using GitLab CI for iOS projects](https://about.gitlab.com/2016/03/10/setting-up-gitlab-ci-for-ios-projects/)
+- [Blog post about using GitLab CI for iOS projects](https://about.gitlab.com/2016/03/10/setting-up-gitlab-ci-for-ios-projects/)
- [Repo's with examples for various languages](https://gitlab.com/groups/gitlab-examples)
- [The .gitlab-ci.yml file for GitLab itself](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/.gitlab-ci.yml)
diff --git a/doc/ci/examples/php.md b/doc/ci/examples/php.md
index db077927126..26953014502 100644
--- a/doc/ci/examples/php.md
+++ b/doc/ci/examples/php.md
@@ -60,7 +60,7 @@ docker-php-ext-install pdo_mysql
You might wonder what `docker-php-ext-install` is. In short, it is a script
provided by the official php docker image that you can use to easilly install
extensions. For more information read the the documentation at
-<https://hub.docker.com/_/php/>.
+<https://hub.docker.com/r/_/php/>.
Now that we created the script that contains all prerequisites for our build
environment, let's add it in `.gitlab-ci.yml`:
@@ -92,7 +92,7 @@ Finally, commit your files and push them to GitLab to see your build succeeding
The final `.gitlab-ci.yml` should look similar to this:
```yaml
-# Select image from https://hub.docker.com/_/php/
+# Select image from https://hub.docker.com/r/_/php/
image: php:5.6
before_script:
@@ -278,7 +278,7 @@ that runs on [GitLab.com](https://gitlab.com) using our publicly available
Want to hack on it? Simply fork it, commit and push your changes. Within a few
moments the changes will be picked by a public runner and the build will begin.
-[php-hub]: https://hub.docker.com/_/php/
+[php-hub]: https://hub.docker.com/r/_/php/
[phpenv]: https://github.com/phpenv/phpenv
[phpenv-installation]: https://github.com/phpenv/phpenv#installation
[php-example-repo]: https://gitlab.com/gitlab-examples/php
diff --git a/doc/ci/examples/test-and-deploy-python-application-to-heroku.md b/doc/ci/examples/test-and-deploy-python-application-to-heroku.md
index a236da53fe9..e4d3970deac 100644
--- a/doc/ci/examples/test-and-deploy-python-application-to-heroku.md
+++ b/doc/ci/examples/test-and-deploy-python-application-to-heroku.md
@@ -8,7 +8,7 @@ This is what the `.gitlab-ci.yml` file looks like for this project:
```yaml
test:
script:
- # this configures django application to use attached postgres database that is run on `postgres` host
+ # this configures Django application to use attached postgres database that is run on `postgres` host
- export DATABASE_URL=postgres://postgres:@postgres:5432/python-test-app
- apt-get update -qy
- apt-get install -y python-dev python-pip
@@ -37,7 +37,7 @@ production:
```
This project has three jobs:
-1. `test` - used to test rails application,
+1. `test` - used to test Django application,
2. `staging` - used to automatically deploy staging environment every push to `master` branch
3. `production` - used to automatically deploy production environmnet for every created tag
@@ -61,12 +61,12 @@ gitlab-ci-multi-runner register \
--non-interactive \
--url "https://gitlab.com/ci/" \
--registration-token "PROJECT_REGISTRATION_TOKEN" \
- --description "python-3.2" \
+ --description "python-3.5" \
--executor "docker" \
- --docker-image python:3.2 \
+ --docker-image python:3.5 \
--docker-postgres latest
```
-With the command above, you create a runner that uses [python:3.2](https://registry.hub.docker.com/u/library/python/) image and uses [postgres](https://registry.hub.docker.com/u/library/postgres/) database.
+With the command above, you create a runner that uses [python:3.5](https://hub.docker.com/r/_/python/) image and uses [postgres](https://hub.docker.com/r/_/postgres/) database.
To access PostgreSQL database you need to connect to `host: postgres` as user `postgres` without password.
diff --git a/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md b/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md
index f5645d586ae..08c10d391ea 100644
--- a/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md
+++ b/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md
@@ -1,5 +1,5 @@
## Test and Deploy a ruby application
-This example will guide you how to run tests in your Ruby application and deploy it automatically as Heroku application.
+This example will guide you how to run tests in your Ruby on Rails application and deploy it automatically as Heroku application.
You can checkout the example [source](https://gitlab.com/ayufan/ruby-getting-started) and check [CI status](https://gitlab.com/ayufan/ruby-getting-started/builds?scope=all).
@@ -32,7 +32,7 @@ production:
```
This project has three jobs:
-1. `test` - used to test rails application,
+1. `test` - used to test Rails application,
2. `staging` - used to automatically deploy staging environment every push to `master` branch
3. `production` - used to automatically deploy production environmnet for every created tag
@@ -62,6 +62,6 @@ gitlab-ci-multi-runner register \
--docker-postgres latest
```
-With the command above, you create a runner that uses [ruby:2.2](https://registry.hub.docker.com/u/library/ruby/) image and uses [postgres](https://registry.hub.docker.com/u/library/postgres/) database.
+With the command above, you create a runner that uses [ruby:2.2](https://hub.docker.com/r/_/ruby/) image and uses [postgres](https://hub.docker.com/r/_/postgres/) database.
To access PostgreSQL database you need to connect to `host: postgres` as user `postgres` without password.
diff --git a/doc/ci/services/mysql.md b/doc/ci/services/mysql.md
index c66d77122b2..aaf3aa77837 100644
--- a/doc/ci/services/mysql.md
+++ b/doc/ci/services/mysql.md
@@ -16,7 +16,7 @@ services:
- mysql:latest
variables:
- # Configure mysql environment variables (https://hub.docker.com/_/mysql/)
+ # Configure mysql environment variables (https://hub.docker.com/r/_/mysql/)
MYSQL_DATABASE: el_duderino
MYSQL_ROOT_PASSWORD: mysql_strong_password
```
@@ -114,5 +114,5 @@ available [shared runners](../runners/README.md).
Want to hack on it? Simply fork it, commit and push your changes. Within a few
moments the changes will be picked by a public runner and the build will begin.
-[hub-mysql]: https://hub.docker.com/_/mysql/
+[hub-mysql]: https://hub.docker.com/r/_/mysql/
[mysql-example-repo]: https://gitlab.com/gitlab-examples/mysql
diff --git a/doc/ci/services/postgres.md b/doc/ci/services/postgres.md
index 17d21dbda1c..f787cc0a124 100644
--- a/doc/ci/services/postgres.md
+++ b/doc/ci/services/postgres.md
@@ -110,5 +110,5 @@ available [shared runners](../runners/README.md).
Want to hack on it? Simply fork it, commit and push your changes. Within a few
moments the changes will be picked by a public runner and the build will begin.
-[hub-pg]: https://hub.docker.com/_/postgres/
+[hub-pg]: https://hub.docker.com/r/_/postgres/
[postgres-example-repo]: https://gitlab.com/gitlab-examples/postgres
diff --git a/doc/ci/services/redis.md b/doc/ci/services/redis.md
index b281e8f9f60..80705024d2f 100644
--- a/doc/ci/services/redis.md
+++ b/doc/ci/services/redis.md
@@ -65,5 +65,5 @@ that runs on [GitLab.com](https://gitlab.com) using our publicly available
Want to hack on it? Simply fork it, commit and push your changes. Within a few
moments the changes will be picked by a public runner and the build will begin.
-[hub-redis]: https://hub.docker.com/_/redis/
+[hub-redis]: https://hub.docker.com/r/_/redis/
[redis-example-repo]: https://gitlab.com/gitlab-examples/redis
diff --git a/doc/development/instrumentation.md b/doc/development/instrumentation.md
index c1cf2e77c26..9168c70945a 100644
--- a/doc/development/instrumentation.md
+++ b/doc/development/instrumentation.md
@@ -1,12 +1,125 @@
# Instrumenting Ruby Code
-GitLab Performance Monitoring allows instrumenting of custom blocks of Ruby
-code. This can be used to measure the time spent in a specific part of a larger
-chunk of code. The resulting data is stored as a field in the transaction that
-executed the block.
+GitLab Performance Monitoring allows instrumenting of both methods and custom
+blocks of Ruby code. Method instrumentation is the primary form of
+instrumentation with block-based instrumentation only being used when we want to
+drill down to specific regions of code within a method.
-To start measuring a block of Ruby code you should use `Gitlab::Metrics.measure`
-and give it a name:
+## Instrumenting Methods
+
+Instrumenting methods is done by using the `Gitlab::Metrics::Instrumentation`
+module. This module offers a few different methods that can be used to
+instrument code:
+
+* `instrument_method`: instruments a single class method.
+* `instrument_instance_method`: instruments a single instance method.
+* `instrument_class_hierarchy`: given a Class this method will recursively
+ instrument all sub-classes (both class and instance methods).
+* `instrument_methods`: instruments all public class methods of a Module.
+* `instrument_instance_methods`: instruments all public instance methods of a
+ Module.
+
+To remove the need for typing the full `Gitlab::Metrics::Instrumentation`
+namespace you can use the `configure` class method. This method simply yields
+the supplied block while passing `Gitlab::Metrics::Instrumentation` as its
+argument. An example:
+
+```
+Gitlab::Metrics::Instrumentation.configure do |conf|
+ conf.instrument_method(Foo, :bar)
+ conf.instrument_method(Foo, :baz)
+end
+```
+
+Using this method is in general preferred over directly calling the various
+instrumentation methods.
+
+Method instrumentation should be added in the initializer
+`config/initializers/metrics.rb`.
+
+### Examples
+
+Instrumenting a single method:
+
+```
+Gitlab::Metrics::Instrumentation.configure do |conf|
+ conf.instrument_method(User, :find_by)
+end
+```
+
+Instrumenting an entire class hierarchy:
+
+```
+Gitlab::Metrics::Instrumentation.configure do |conf|
+ conf.instrument_class_hierarchy(ActiveRecord::Base)
+end
+```
+
+Instrumenting all public class methods:
+
+```
+Gitlab::Metrics::Instrumentation.configure do |conf|
+ conf.instrument_methods(User)
+end
+```
+
+### Checking Instrumented Methods
+
+The easiest way to check if a method has been instrumented is to check its
+source location. For example:
+
+```
+method = Rugged::TagCollection.instance_method(:[])
+
+method.source_location
+```
+
+If the source location points to `lib/gitlab/metrics/instrumentation.rb` you
+know the method has been instrumented.
+
+If you're using Pry you can use the `$` command to display the source code of a
+method (along with its source location), this is easier than running the above
+Ruby code. In case of the above snippet you'd run the following:
+
+```
+$ Rugged::TagCollection#[]
+```
+
+This will print out something along the lines of:
+
+```
+From: /path/to/your/gitlab/lib/gitlab/metrics/instrumentation.rb @ line 148:
+Owner: #<Module:0x0055f0865c6d50>
+Visibility: public
+Number of lines: 21
+
+def #{name}(#{args_signature})
+ trans = Gitlab::Metrics::Instrumentation.transaction
+
+ if trans
+ start = Time.now
+ retval = super
+ duration = (Time.now - start) * 1000.0
+
+ if duration >= Gitlab::Metrics.method_call_threshold
+ trans.increment(:method_duration, duration)
+
+ trans.add_metric(Gitlab::Metrics::Instrumentation::SERIES,
+ { duration: duration },
+ method: #{label.inspect})
+ end
+
+ retval
+ else
+ super
+ end
+end
+```
+
+## Instrumenting Ruby Blocks
+
+Measuring blocks of Ruby code is done by calling `Gitlab::Metrics.measure` and
+passing it a block. For example:
```ruby
Gitlab::Metrics.measure(:foo) do
@@ -14,6 +127,10 @@ Gitlab::Metrics.measure(:foo) do
end
```
+The block is executed and the execution time is stored as a set of fields in the
+currently running transaction. If no transaction is present the block is yielded
+without measuring anything.
+
3 values are measured for a block:
1. The real time elapsed, stored in NAME_real_time.
diff --git a/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md b/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md
index 31620044b15..83db44c10b1 100644
--- a/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md
+++ b/doc/workflow/lfs/manage_large_binaries_with_git_lfs.md
@@ -152,4 +152,4 @@ If you are using OS X you can use `osxkeychain` to store and encrypt your creden
For Windows, you can use `wincred` or Microsoft's [Git Credential Manager for Windows](https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases).
More details about various methods of storing the user credentials can be found
-on [Git Credential Storage documentation](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage). \ No newline at end of file
+on [Git Credential Storage documentation](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage).
diff --git a/docker/README.md b/docker/README.md
index 7514d610aec..ee1f32adc26 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -1,7 +1,7 @@
# GitLab Docker images
-* The official GitLab Community Edition Docker image is [available on Docker Hub](https://registry.hub.docker.com/u/gitlab/gitlab-ce/).
-* The official GitLab Enterprise Edition Docker image is [available on Docker Hub](https://registry.hub.docker.com/u/gitlab/gitlab-ee/).
+* The official GitLab Community Edition Docker image is [available on Docker Hub](https://hub.docker.com/r/gitlab/gitlab-ce/).
+* The official GitLab Enterprise Edition Docker image is [available on Docker Hub](https://hub.docker.com/r/gitlab/gitlab-ee/).
* The complete usage guide can be found in [Using GitLab Docker images](http://doc.gitlab.com/omnibus/docker/)
* The Dockerfile used for building public images is in [Omnibus Repository](https://gitlab.com/gitlab-org/omnibus-gitlab/tree/master/docker)
-* Check the guide for [creating Omnibus-based Docker Image](http://doc.gitlab.com/omnibus/build/README.html#Build-Docker-image)
+* Check the guide for [creating Omnibus-based Docker Image](http://doc.gitlab.com/omnibus/build/README.html#build-docker-image)
diff --git a/features/project/commits/tags.feature b/features/project/commits/tags.feature
deleted file mode 100644
index a4be39b2d40..00000000000
--- a/features/project/commits/tags.feature
+++ /dev/null
@@ -1,46 +0,0 @@
-@project_commits
-Feature: Project Commits Tags
- Background:
- Given I sign in as a user
- And I own project "Shop"
- Given I visit project tags page
-
- Scenario: I can see all git tags
- Then I should see "Shop" all tags list
-
- Scenario: I create a tag
- And I click new tag link
- And I submit new tag form
- Then I should see new tag created
-
- Scenario: I create a tag with release notes
- Given I click new tag link
- And I submit new tag form with release notes
- Then I should see new tag created
- And I should see tag release notes
-
- Scenario: I create a tag with invalid name
- And I click new tag link
- And I submit new tag form with invalid name
- Then I should see new an error that tag is invalid
-
- Scenario: I create a tag with invalid reference
- And I click new tag link
- And I submit new tag form with invalid reference
- Then I should see new an error that tag ref is invalid
-
- Scenario: I create a tag that already exists
- And I click new tag link
- And I submit new tag form with tag that already exists
- Then I should see new an error that tag already exists
-
- Scenario: I delete a tag
- Given I visit tag 'v1.1.0' page
- Given I delete tag 'v1.1.0'
- Then I should not see tag 'v1.1.0'
-
- Scenario: I add release notes to the tag
- Given I visit tag 'v1.1.0' page
- When I click edit tag link
- And I fill release notes and submit form
- Then I should see tag release notes
diff --git a/features/project/create.feature b/features/project/create.feature
index 27136798e36..67336d73bf7 100644
--- a/features/project/create.feature
+++ b/features/project/create.feature
@@ -7,20 +7,8 @@ Feature: Project Create
@javascript
Scenario: User create a project
Given I sign in as a user
- When I visit new project page
- And I have an ssh key
- And fill project form with valid data
- Then I should see project page
- And I should see empty project instuctions
-
- @javascript
- Scenario: Empty project instructions
- Given I sign in as a user
And I have an ssh key
When I visit new project page
And fill project form with valid data
- Then I see empty project instuctions
- And I click on HTTP
- Then Remote url should update to http link
- And If I click on SSH
- Then Remote url should update to ssh link
+ Then I should see project page
+ And I should see empty project instructions
diff --git a/features/steps/project/commits/tags.rb b/features/steps/project/commits/tags.rb
deleted file mode 100644
index 912ba580efd..00000000000
--- a/features/steps/project/commits/tags.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedProject
- include SharedPaths
-
- step 'I should see "Shop" all tags list' do
- expect(page).to have_content "Tags"
- expect(page).to have_content "v1.0.0"
- end
-
- step 'I click new tag link' do
- click_link 'New tag'
- end
-
- step 'I submit new tag form' do
- fill_in 'tag_name', with: 'v7.0'
- fill_in 'ref', with: 'master'
- click_button 'Create tag'
- end
-
- step 'I submit new tag form with release notes' do
- fill_in 'tag_name', with: 'v7.0'
- fill_in 'ref', with: 'master'
- fill_in 'release_description', with: 'Awesome release notes'
- click_button 'Create tag'
- end
-
- step 'I fill release notes and submit form' do
- fill_in 'release_description', with: 'Awesome release notes'
- click_button 'Save changes'
- end
-
- step 'I submit new tag form with invalid name' do
- fill_in 'tag_name', with: 'v 1.0'
- fill_in 'ref', with: 'master'
- click_button 'Create tag'
- end
-
- step 'I submit new tag form with invalid reference' do
- fill_in 'tag_name', with: 'foo'
- fill_in 'ref', with: 'foo'
- click_button 'Create tag'
- end
-
- step 'I submit new tag form with tag that already exists' do
- fill_in 'tag_name', with: 'v1.0.0'
- fill_in 'ref', with: 'master'
- click_button 'Create tag'
- end
-
- step 'I should see new tag created' do
- expect(page).to have_content 'v7.0'
- end
-
- step 'I should see new an error that tag is invalid' do
- expect(page).to have_content 'Tag name invalid'
- end
-
- step 'I should see new an error that tag ref is invalid' do
- expect(page).to have_content 'Target foo is invalid'
- end
-
- step 'I should see new an error that tag already exists' do
- expect(page).to have_content 'Tag v1.0.0 already exists'
- end
-
- step "I visit tag 'v1.1.0' page" do
- click_link 'v1.1.0'
- end
-
- step "I delete tag 'v1.1.0'" do
- page.within('.content') do
- first('.btn-remove').click
- end
- end
-
- step "I should not see tag 'v1.1.0'" do
- page.within '.tags' do
- expect(page).not_to have_link 'v1.1.0'
- end
- end
-
- step 'I click edit tag link' do
- click_link 'Edit release notes'
- end
-
- step 'I should see tag release notes' do
- expect(page).to have_content 'Awesome release notes'
- end
-end
diff --git a/features/steps/project/create.rb b/features/steps/project/create.rb
index 422b151eaa2..5f5f806df36 100644
--- a/features/steps/project/create.rb
+++ b/features/steps/project/create.rb
@@ -13,33 +13,9 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
expect(current_path).to eq namespace_project_path(Project.last.namespace, Project.last)
end
- step 'I should see empty project instuctions' do
+ step 'I should see empty project instructions' do
expect(page).to have_content "git init"
expect(page).to have_content "git remote"
expect(page).to have_content Project.last.url_to_repo
end
-
- step 'I see empty project instuctions' do
- expect(page).to have_content "git init"
- expect(page).to have_content "git remote"
- expect(page).to have_content Project.last.url_to_repo
- end
-
- step 'I click on HTTP' do
- find('#clone-dropdown').click
- find('.http-selector').click
- end
-
- step 'Remote url should update to http link' do
- expect(page).to have_content "git remote add origin #{Project.last.http_url_to_repo}"
- end
-
- step 'If I click on SSH' do
- find('#clone-dropdown').click
- find('.ssh-selector').click
- end
-
- step 'Remote url should update to ssh link' do
- expect(page).to have_content "git remote add origin #{Project.last.url_to_repo}"
- end
end
diff --git a/lib/api/api.rb b/lib/api/api.rb
index cc1004f8005..5fd9c30cb42 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -1,5 +1,3 @@
-Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
-
module API
class API < Grape::API
include APIGuard
@@ -25,38 +23,39 @@ module API
format :json
content_type :txt, "text/plain"
- helpers Helpers
-
- mount Groups
- mount GroupMembers
- mount Users
- mount Projects
- mount Repositories
- mount Issues
- mount Milestones
- mount Session
- mount MergeRequests
- mount Notes
- mount Internal
- mount SystemHooks
- mount ProjectSnippets
- mount ProjectMembers
- mount DeployKeys
- mount ProjectHooks
- mount Services
- mount Files
- mount Commits
- mount CommitStatus
- mount Namespaces
- mount Branches
- mount Labels
- mount Settings
- mount Keys
- mount Tags
- mount Triggers
- mount Builds
- mount Variables
- mount Runners
- mount Licenses
+ # Ensure the namespace is right, otherwise we might load Grape::API::Helpers
+ helpers ::API::Helpers
+
+ mount ::API::Groups
+ mount ::API::GroupMembers
+ mount ::API::Users
+ mount ::API::Projects
+ mount ::API::Repositories
+ mount ::API::Issues
+ mount ::API::Milestones
+ mount ::API::Session
+ mount ::API::MergeRequests
+ mount ::API::Notes
+ mount ::API::Internal
+ mount ::API::SystemHooks
+ mount ::API::ProjectSnippets
+ mount ::API::ProjectMembers
+ mount ::API::DeployKeys
+ mount ::API::ProjectHooks
+ mount ::API::Services
+ mount ::API::Files
+ mount ::API::Commits
+ mount ::API::CommitStatuses
+ mount ::API::Namespaces
+ mount ::API::Branches
+ mount ::API::Labels
+ mount ::API::Settings
+ mount ::API::Keys
+ mount ::API::Tags
+ mount ::API::Triggers
+ mount ::API::Builds
+ mount ::API::Variables
+ mount ::API::Runners
+ mount ::API::Licenses
end
end
diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb
index b9994fcefda..7e67edb203a 100644
--- a/lib/api/api_guard.rb
+++ b/lib/api/api_guard.rb
@@ -2,171 +2,175 @@
require 'rack/oauth2'
-module APIGuard
- extend ActiveSupport::Concern
+module API
+ module APIGuard
+ extend ActiveSupport::Concern
- included do |base|
- # OAuth2 Resource Server Authentication
- use Rack::OAuth2::Server::Resource::Bearer, 'The API' do |request|
- # The authenticator only fetches the raw token string
+ included do |base|
+ # OAuth2 Resource Server Authentication
+ use Rack::OAuth2::Server::Resource::Bearer, 'The API' do |request|
+ # The authenticator only fetches the raw token string
- # Must yield access token to store it in the env
- request.access_token
- end
+ # Must yield access token to store it in the env
+ request.access_token
+ end
- helpers HelperMethods
+ helpers HelperMethods
- install_error_responders(base)
- end
+ install_error_responders(base)
+ end
- # Helper Methods for Grape Endpoint
- module HelperMethods
- # Invokes the doorkeeper guard.
- #
- # If token is presented and valid, then it sets @current_user.
- #
- # If the token does not have sufficient scopes to cover the requred scopes,
- # then it raises InsufficientScopeError.
- #
- # If the token is expired, then it raises ExpiredError.
- #
- # If the token is revoked, then it raises RevokedError.
- #
- # If the token is not found (nil), then it raises TokenNotFoundError.
- #
- # Arguments:
- #
- # scopes: (optional) scopes required for this guard.
- # Defaults to empty array.
- #
- def doorkeeper_guard!(scopes: [])
- if (access_token = find_access_token).nil?
- raise TokenNotFoundError
-
- else
- case validate_access_token(access_token, scopes)
- when Oauth2::AccessTokenValidationService::INSUFFICIENT_SCOPE
- raise InsufficientScopeError.new(scopes)
- when Oauth2::AccessTokenValidationService::EXPIRED
- raise ExpiredError
- when Oauth2::AccessTokenValidationService::REVOKED
- raise RevokedError
- when Oauth2::AccessTokenValidationService::VALID
- @current_user = User.find(access_token.resource_owner_id)
+ # Helper Methods for Grape Endpoint
+ module HelperMethods
+ # Invokes the doorkeeper guard.
+ #
+ # If token is presented and valid, then it sets @current_user.
+ #
+ # If the token does not have sufficient scopes to cover the requred scopes,
+ # then it raises InsufficientScopeError.
+ #
+ # If the token is expired, then it raises ExpiredError.
+ #
+ # If the token is revoked, then it raises RevokedError.
+ #
+ # If the token is not found (nil), then it raises TokenNotFoundError.
+ #
+ # Arguments:
+ #
+ # scopes: (optional) scopes required for this guard.
+ # Defaults to empty array.
+ #
+ def doorkeeper_guard!(scopes: [])
+ if (access_token = find_access_token).nil?
+ raise TokenNotFoundError
+
+ else
+ case validate_access_token(access_token, scopes)
+ when Oauth2::AccessTokenValidationService::INSUFFICIENT_SCOPE
+ raise InsufficientScopeError.new(scopes)
+ when Oauth2::AccessTokenValidationService::EXPIRED
+ raise ExpiredError
+ when Oauth2::AccessTokenValidationService::REVOKED
+ raise RevokedError
+ when Oauth2::AccessTokenValidationService::VALID
+ @current_user = User.find(access_token.resource_owner_id)
+ end
end
end
- end
- def doorkeeper_guard(scopes: [])
- if access_token = find_access_token
- case validate_access_token(access_token, scopes)
- when Oauth2::AccessTokenValidationService::INSUFFICIENT_SCOPE
- raise InsufficientScopeError.new(scopes)
+ def doorkeeper_guard(scopes: [])
+ if access_token = find_access_token
+ case validate_access_token(access_token, scopes)
+ when Oauth2::AccessTokenValidationService::INSUFFICIENT_SCOPE
+ raise InsufficientScopeError.new(scopes)
- when Oauth2::AccessTokenValidationService::EXPIRED
- raise ExpiredError
+ when Oauth2::AccessTokenValidationService::EXPIRED
+ raise ExpiredError
- when Oauth2::AccessTokenValidationService::REVOKED
- raise RevokedError
+ when Oauth2::AccessTokenValidationService::REVOKED
+ raise RevokedError
- when Oauth2::AccessTokenValidationService::VALID
- @current_user = User.find(access_token.resource_owner_id)
+ when Oauth2::AccessTokenValidationService::VALID
+ @current_user = User.find(access_token.resource_owner_id)
+ end
end
end
- end
- def current_user
- @current_user
- end
+ def current_user
+ @current_user
+ end
- private
- def find_access_token
- @access_token ||= Doorkeeper.authenticate(doorkeeper_request, Doorkeeper.configuration.access_token_methods)
- end
+ private
- def doorkeeper_request
- @doorkeeper_request ||= ActionDispatch::Request.new(env)
- end
+ def find_access_token
+ @access_token ||= Doorkeeper.authenticate(doorkeeper_request, Doorkeeper.configuration.access_token_methods)
+ end
- def validate_access_token(access_token, scopes)
- Oauth2::AccessTokenValidationService.validate(access_token, scopes: scopes)
- end
- end
+ def doorkeeper_request
+ @doorkeeper_request ||= ActionDispatch::Request.new(env)
+ end
- module ClassMethods
- # Installs the doorkeeper guard on the whole Grape API endpoint.
- #
- # Arguments:
- #
- # scopes: (optional) scopes required for this guard.
- # Defaults to empty array.
- #
- def guard_all!(scopes: [])
- before do
- guard! scopes: scopes
+ def validate_access_token(access_token, scopes)
+ Oauth2::AccessTokenValidationService.validate(access_token, scopes: scopes)
end
end
- private
- def install_error_responders(base)
- error_classes = [ MissingTokenError, TokenNotFoundError,
- ExpiredError, RevokedError, InsufficientScopeError]
+ module ClassMethods
+ # Installs the doorkeeper guard on the whole Grape API endpoint.
+ #
+ # Arguments:
+ #
+ # scopes: (optional) scopes required for this guard.
+ # Defaults to empty array.
+ #
+ def guard_all!(scopes: [])
+ before do
+ guard! scopes: scopes
+ end
+ end
- base.send :rescue_from, *error_classes, oauth2_bearer_token_error_handler
- end
+ private
- def oauth2_bearer_token_error_handler
- Proc.new do |e|
- response =
- case e
- when MissingTokenError
- Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new
-
- when TokenNotFoundError
- Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(
- :invalid_token,
- "Bad Access Token.")
-
- when ExpiredError
- Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(
- :invalid_token,
- "Token is expired. You can either do re-authorization or token refresh.")
-
- when RevokedError
- Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(
- :invalid_token,
- "Token was revoked. You have to re-authorize from the user.")
-
- when InsufficientScopeError
- # FIXME: ForbiddenError (inherited from Bearer::Forbidden of Rack::Oauth2)
- # does not include WWW-Authenticate header, which breaks the standard.
- Rack::OAuth2::Server::Resource::Bearer::Forbidden.new(
- :insufficient_scope,
- Rack::OAuth2::Server::Resource::ErrorMethods::DEFAULT_DESCRIPTION[:insufficient_scope],
- { scope: e.scopes })
- end
+ def install_error_responders(base)
+ error_classes = [ MissingTokenError, TokenNotFoundError,
+ ExpiredError, RevokedError, InsufficientScopeError]
- response.finish
+ base.send :rescue_from, *error_classes, oauth2_bearer_token_error_handler
+ end
+
+ def oauth2_bearer_token_error_handler
+ Proc.new do |e|
+ response =
+ case e
+ when MissingTokenError
+ Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new
+
+ when TokenNotFoundError
+ Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(
+ :invalid_token,
+ "Bad Access Token.")
+
+ when ExpiredError
+ Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(
+ :invalid_token,
+ "Token is expired. You can either do re-authorization or token refresh.")
+
+ when RevokedError
+ Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(
+ :invalid_token,
+ "Token was revoked. You have to re-authorize from the user.")
+
+ when InsufficientScopeError
+ # FIXME: ForbiddenError (inherited from Bearer::Forbidden of Rack::Oauth2)
+ # does not include WWW-Authenticate header, which breaks the standard.
+ Rack::OAuth2::Server::Resource::Bearer::Forbidden.new(
+ :insufficient_scope,
+ Rack::OAuth2::Server::Resource::ErrorMethods::DEFAULT_DESCRIPTION[:insufficient_scope],
+ { scope: e.scopes })
+ end
+
+ response.finish
+ end
end
end
- end
- #
- # Exceptions
- #
+ #
+ # Exceptions
+ #
- class MissingTokenError < StandardError; end
+ class MissingTokenError < StandardError; end
- class TokenNotFoundError < StandardError; end
+ class TokenNotFoundError < StandardError; end
- class ExpiredError < StandardError; end
+ class ExpiredError < StandardError; end
- class RevokedError < StandardError; end
+ class RevokedError < StandardError; end
- class InsufficientScopeError < StandardError
- attr_reader :scopes
- def initialize(scopes)
- @scopes = scopes
+ class InsufficientScopeError < StandardError
+ attr_reader :scopes
+ def initialize(scopes)
+ @scopes = scopes
+ end
end
end
end
diff --git a/lib/api/commit_statuses.rb b/lib/api/commit_statuses.rb
index 7388ed2f4ea..9bcd33ff19e 100644
--- a/lib/api/commit_statuses.rb
+++ b/lib/api/commit_statuses.rb
@@ -2,7 +2,7 @@ require 'mime/types'
module API
# Project commit statuses API
- class CommitStatus < Grape::API
+ class CommitStatuses < Grape::API
resource :projects do
before { authenticate! }
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 716ca6f7ed9..2870a6a40ef 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -170,10 +170,10 @@ module API
expose :label_names, as: :labels
expose :milestone, using: Entities::Milestone
expose :assignee, :author, using: Entities::UserBasic
-
expose :subscribed do |issue, options|
issue.subscribed?(options[:current_user])
end
+ expose :user_notes_count
end
class MergeRequest < ProjectEntity
@@ -187,10 +187,10 @@ module API
expose :milestone, using: Entities::Milestone
expose :merge_when_build_succeeds
expose :merge_status
-
expose :subscribed do |merge_request, options|
merge_request.subscribed?(options[:current_user])
end
+ expose :user_notes_count
end
class MergeRequestChanges < MergeRequest
diff --git a/lib/banzai/filter/issue_reference_filter.rb b/lib/banzai/filter/issue_reference_filter.rb
index 2732e0b5145..59c5e89c546 100644
--- a/lib/banzai/filter/issue_reference_filter.rb
+++ b/lib/banzai/filter/issue_reference_filter.rb
@@ -10,6 +10,9 @@ module Banzai
end
def self.user_can_see_reference?(user, node, context)
+ # It is not possible to check access rights for external issue trackers
+ return true if context[:project].try(:external_issue_tracker)
+
issue = Issue.find(node.attr('data-issue')) rescue nil
Ability.abilities.allowed?(user, :read_issue, issue)
end
diff --git a/lib/banzai/filter/sanitization_filter.rb b/lib/banzai/filter/sanitization_filter.rb
index 42dbab9d27e..ca80aac5a08 100644
--- a/lib/banzai/filter/sanitization_filter.rb
+++ b/lib/banzai/filter/sanitization_filter.rb
@@ -63,7 +63,7 @@ module Banzai
begin
uri = Addressable::URI.parse(node['href'])
- uri.scheme.strip! if uri.scheme
+ uri.scheme = uri.scheme.strip.downcase if uri.scheme
node.remove_attribute('href') if UNSAFE_PROTOCOLS.include?(uri.scheme)
rescue Addressable::URI::InvalidURIError
diff --git a/lib/banzai/filter/upload_link_filter.rb b/lib/banzai/filter/upload_link_filter.rb
index 7edfe5ade2d..c0f503c9af3 100644
--- a/lib/banzai/filter/upload_link_filter.rb
+++ b/lib/banzai/filter/upload_link_filter.rb
@@ -8,6 +8,8 @@ module Banzai
#
class UploadLinkFilter < HTML::Pipeline::Filter
def call
+ return doc unless project
+
doc.search('a').each do |el|
process_link_attr el.attribute('href')
end
@@ -31,7 +33,11 @@ module Banzai
end
def build_url(uri)
- File.join(Gitlab.config.gitlab.url, context[:project].path_with_namespace, uri)
+ File.join(Gitlab.config.gitlab.url, project.path_with_namespace, uri)
+ end
+
+ def project
+ context[:project]
end
# Ensure that a :project key exists in context
diff --git a/lib/ci/api/api.rb b/lib/ci/api/api.rb
index 353c4ddebf8..17bb99a2ae5 100644
--- a/lib/ci/api/api.rb
+++ b/lib/ci/api/api.rb
@@ -1,9 +1,7 @@
-Dir["#{Rails.root}/lib/ci/api/*.rb"].each {|file| require file}
-
module Ci
module API
class API < Grape::API
- include APIGuard
+ include ::API::APIGuard
version 'v1', using: :path
rescue_from ActiveRecord::RecordNotFound do
@@ -31,9 +29,9 @@ module Ci
helpers ::API::Helpers
helpers Gitlab::CurrentSettings
- mount Builds
- mount Runners
- mount Triggers
+ mount ::Ci::API::Builds
+ mount ::Ci::API::Runners
+ mount ::Ci::API::Triggers
end
end
end
diff --git a/lib/gitlab.rb b/lib/gitlab.rb
index 7479e729db1..37f4c34054f 100644
--- a/lib/gitlab.rb
+++ b/lib/gitlab.rb
@@ -1,4 +1,4 @@
-require 'gitlab/git'
+require_dependency 'gitlab/git'
module Gitlab
def self.com?
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index 6cb41239871..d2a0e316cbe 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -122,6 +122,11 @@ module Gitlab
build_status_object(true)
end
+ def can_user_do_action?(action)
+ @permission_cache ||= {}
+ @permission_cache[action] ||= user.can?(action, project)
+ end
+
def change_access_check(change)
oldrev, newrev, ref = change.split(' ')
@@ -135,7 +140,7 @@ module Gitlab
:push_code
end
- unless user.can?(action, project)
+ unless can_user_do_action?(action)
status =
case action
when :force_push_code_to_protected_branches
diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake
deleted file mode 100644
index 16bad4bd2bd..00000000000
--- a/lib/tasks/auto_annotate_models.rake
+++ /dev/null
@@ -1,44 +0,0 @@
-if Rails.env.development?
- task :set_annotation_options do
- # You can override any of these by setting an environment variable of the
- # same name.
- Annotate.set_defaults(
- 'routes' => 'false',
- 'position_in_routes' => 'before',
- 'position_in_class' => 'before',
- 'position_in_test' => 'before',
- 'position_in_fixture' => 'before',
- 'position_in_factory' => 'before',
- 'position_in_serializer' => 'before',
- 'show_foreign_keys' => 'true',
- 'show_indexes' => 'false',
- 'simple_indexes' => 'false',
- 'model_dir' => 'app/models',
- 'root_dir' => '',
- 'include_version' => 'false',
- 'require' => '',
- 'exclude_tests' => 'true',
- 'exclude_fixtures' => 'true',
- 'exclude_factories' => 'true',
- 'exclude_serializers' => 'true',
- 'exclude_scaffolds' => 'true',
- 'exclude_controllers' => 'true',
- 'exclude_helpers' => 'true',
- 'ignore_model_sub_dir' => 'false',
- 'ignore_columns' => nil,
- 'ignore_unknown_models' => 'false',
- 'hide_limit_column_types' => 'integer,boolean',
- 'skip_on_db_migrate' => 'false',
- 'format_bare' => 'true',
- 'format_rdoc' => 'false',
- 'format_markdown' => 'false',
- 'sort' => 'false',
- 'force' => 'false',
- 'trace' => 'false',
- 'wrapper_open' => nil,
- 'wrapper_close' => nil,
- )
- end
-
- Annotate.load_tasks
-end
diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake
index 1c706dc11b3..e473b756023 100644
--- a/lib/tasks/gitlab/db.rake
+++ b/lib/tasks/gitlab/db.rake
@@ -29,10 +29,12 @@ namespace :gitlab do
tables.delete 'schema_migrations'
# Truncate schema_migrations to ensure migrations re-run
connection.execute('TRUNCATE schema_migrations')
+
# Drop tables with cascade to avoid dependent table errors
# PG: http://www.postgresql.org/docs/current/static/ddl-depend.html
# MySQL: http://dev.mysql.com/doc/refman/5.7/en/drop-table.html
- tables.each { |t| connection.execute("DROP TABLE #{t} CASCADE") }
+ # Add `IF EXISTS` because cascade could have already deleted a table.
+ tables.each { |t| connection.execute("DROP TABLE IF EXISTS #{t} CASCADE") }
end
end
end
diff --git a/spec/factories/abuse_reports.rb b/spec/factories/abuse_reports.rb
index d0e8c778518..8f6422a7825 100644
--- a/spec/factories/abuse_reports.rb
+++ b/spec/factories/abuse_reports.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: abuse_reports
-#
-# id :integer not null, primary key
-# reporter_id :integer
-# user_id :integer
-# message :text
-# created_at :datetime
-# updated_at :datetime
-#
-
FactoryGirl.define do
factory :abuse_report do
reporter factory: :user
diff --git a/spec/factories/broadcast_messages.rb b/spec/factories/broadcast_messages.rb
index c80e7366551..efe9803b1a7 100644
--- a/spec/factories/broadcast_messages.rb
+++ b/spec/factories/broadcast_messages.rb
@@ -1,17 +1,3 @@
-# == Schema Information
-#
-# Table name: broadcast_messages
-#
-# id :integer not null, primary key
-# message :text not null
-# starts_at :datetime
-# ends_at :datetime
-# created_at :datetime
-# updated_at :datetime
-# color :string(255)
-# font :string(255)
-#
-
FactoryGirl.define do
factory :broadcast_message do
message "MyText"
diff --git a/spec/factories/forked_project_links.rb b/spec/factories/forked_project_links.rb
index 19a54946fe0..b16c1272e68 100644
--- a/spec/factories/forked_project_links.rb
+++ b/spec/factories/forked_project_links.rb
@@ -1,14 +1,3 @@
-# == Schema Information
-#
-# Table name: forked_project_links
-#
-# id :integer not null, primary key
-# forked_to_project_id :integer not null
-# forked_from_project_id :integer not null
-# created_at :datetime
-# updated_at :datetime
-#
-
FactoryGirl.define do
factory :forked_project_link do
association :forked_to_project, factory: :project
diff --git a/spec/factories/label_links.rb b/spec/factories/label_links.rb
index 2939d4307c5..3580174e873 100644
--- a/spec/factories/label_links.rb
+++ b/spec/factories/label_links.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: label_links
-#
-# id :integer not null, primary key
-# label_id :integer
-# target_id :integer
-# target_type :string(255)
-# created_at :datetime
-# updated_at :datetime
-#
-
FactoryGirl.define do
factory :label_link do
label
diff --git a/spec/factories/labels.rb b/spec/factories/labels.rb
index ea2be8928d5..eb489099854 100644
--- a/spec/factories/labels.rb
+++ b/spec/factories/labels.rb
@@ -1,16 +1,3 @@
-# == Schema Information
-#
-# Table name: labels
-#
-# id :integer not null, primary key
-# title :string(255)
-# color :string(255)
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# template :boolean default(FALSE)
-#
-
FactoryGirl.define do
factory :label do
sequence(:title) { |n| "label#{n}" }
diff --git a/spec/factories/lfs_objects.rb b/spec/factories/lfs_objects.rb
index 327858ce435..a81645acd2b 100644
--- a/spec/factories/lfs_objects.rb
+++ b/spec/factories/lfs_objects.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: lfs_objects
-#
-# id :integer not null, primary key
-# oid :string(255) not null
-# size :integer not null
-# created_at :datetime
-# updated_at :datetime
-# file :string(255)
-#
-
include ActionDispatch::TestProcess
FactoryGirl.define do
diff --git a/spec/factories/lfs_objects_projects.rb b/spec/factories/lfs_objects_projects.rb
index 50b45843c99..1ed0355c8e4 100644
--- a/spec/factories/lfs_objects_projects.rb
+++ b/spec/factories/lfs_objects_projects.rb
@@ -1,14 +1,3 @@
-# == Schema Information
-#
-# Table name: lfs_objects_projects
-#
-# id :integer not null, primary key
-# lfs_object_id :integer not null
-# project_id :integer not null
-# created_at :datetime
-# updated_at :datetime
-#
-
FactoryGirl.define do
factory :lfs_objects_project do
lfs_object
diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb
index e281e2f227b..c6a08d78b78 100644
--- a/spec/factories/merge_requests.rb
+++ b/spec/factories/merge_requests.rb
@@ -1,32 +1,3 @@
-# == Schema Information
-#
-# Table name: merge_requests
-#
-# id :integer not null, primary key
-# target_branch :string(255) not null
-# source_branch :string(255) not null
-# source_project_id :integer not null
-# author_id :integer
-# assignee_id :integer
-# title :string(255)
-# created_at :datetime
-# updated_at :datetime
-# milestone_id :integer
-# state :string(255)
-# merge_status :string(255)
-# target_project_id :integer not null
-# iid :integer
-# description :text
-# position :integer default(0)
-# locked_at :datetime
-# updated_by_id :integer
-# merge_error :string(255)
-# merge_params :text
-# merge_when_build_succeeds :boolean default(FALSE), not null
-# merge_user_id :integer
-# merge_commit_sha :string
-#
-
FactoryGirl.define do
factory :merge_request do
title
diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb
index e5dcb159014..840b13196a6 100644
--- a/spec/factories/notes.rb
+++ b/spec/factories/notes.rb
@@ -1,24 +1,3 @@
-# == Schema Information
-#
-# Table name: notes
-#
-# id :integer not null, primary key
-# note :text
-# noteable_type :string(255)
-# author_id :integer
-# created_at :datetime
-# updated_at :datetime
-# project_id :integer
-# attachment :string(255)
-# line_code :string(255)
-# commit_id :string(255)
-# noteable_id :integer
-# system :boolean default(FALSE), not null
-# st_diff :text
-# updated_by_id :integer
-# is_award :boolean default(FALSE), not null
-#
-
require_relative '../support/repo_helpers'
include ActionDispatch::TestProcess
diff --git a/spec/factories/oauth_access_tokens.rb b/spec/factories/oauth_access_tokens.rb
index 7700b15d538..ccf02d0719b 100644
--- a/spec/factories/oauth_access_tokens.rb
+++ b/spec/factories/oauth_access_tokens.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: oauth_access_tokens
-#
-# id :integer not null, primary key
-# resource_owner_id :integer
-# application_id :integer
-# token :string not null
-# refresh_token :string
-# expires_in :integer
-# revoked_at :datetime
-# created_at :datetime not null
-# scopes :string
-#
-
FactoryGirl.define do
factory :oauth_access_token do
resource_owner
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb
index c14b99606ba..da8d97c9f82 100644
--- a/spec/factories/projects.rb
+++ b/spec/factories/projects.rb
@@ -1,43 +1,3 @@
-# == Schema Information
-#
-# Table name: projects
-#
-# id :integer not null, primary key
-# name :string(255)
-# path :string(255)
-# description :text
-# created_at :datetime
-# updated_at :datetime
-# creator_id :integer
-# issues_enabled :boolean default(TRUE), not null
-# wall_enabled :boolean default(TRUE), not null
-# merge_requests_enabled :boolean default(TRUE), not null
-# wiki_enabled :boolean default(TRUE), not null
-# namespace_id :integer
-# issues_tracker :string(255) default("gitlab"), not null
-# issues_tracker_id :string(255)
-# snippets_enabled :boolean default(TRUE), not null
-# last_activity_at :datetime
-# import_url :string(255)
-# visibility_level :integer default(0), not null
-# archived :boolean default(FALSE), not null
-# avatar :string(255)
-# import_status :string(255)
-# repository_size :float default(0.0)
-# star_count :integer default(0), not null
-# import_type :string(255)
-# import_source :string(255)
-# commit_count :integer default(0)
-# import_error :text
-# ci_id :integer
-# builds_enabled :boolean default(TRUE), not null
-# shared_runners_enabled :boolean default(TRUE), not null
-# runners_token :string
-# build_coverage_regex :string
-# build_allow_git_fetch :boolean default(TRUE), not null
-# build_timeout :integer default(3600), not null
-#
-
FactoryGirl.define do
# Project without repository
#
@@ -61,6 +21,12 @@ FactoryGirl.define do
trait :private do
visibility_level Gitlab::VisibilityLevel::PRIVATE
end
+
+ trait :empty_repo do
+ after(:create) do |project|
+ project.create_repository
+ end
+ end
end
# Project with empty repository
@@ -68,9 +34,7 @@ FactoryGirl.define do
# This is a case when you just created a project
# but not pushed any code there yet
factory :project_empty_repo, parent: :empty_project do
- after :create do |project|
- project.create_repository
- end
+ empty_repo
end
# Project with test repository
diff --git a/spec/factories/releases.rb b/spec/factories/releases.rb
index 7f331c37256..74497dc82c0 100644
--- a/spec/factories/releases.rb
+++ b/spec/factories/releases.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: releases
-#
-# id :integer not null, primary key
-# tag :string(255)
-# description :text
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-#
-
FactoryGirl.define do
factory :release do
tag "v1.1.0"
diff --git a/spec/factories/todos.rb b/spec/factories/todos.rb
index 7ae06c27840..e3681ae93a5 100644
--- a/spec/factories/todos.rb
+++ b/spec/factories/todos.rb
@@ -1,21 +1,3 @@
-# == Schema Information
-#
-# Table name: todos
-#
-# id :integer not null, primary key
-# user_id :integer not null
-# project_id :integer not null
-# target_id :integer
-# target_type :string not null
-# author_id :integer
-# action :integer not null
-# state :string not null
-# created_at :datetime
-# updated_at :datetime
-# note_id :integer
-# commit_id :string
-#
-
FactoryGirl.define do
factory :todo do
project
diff --git a/spec/features/merge_requests/user_lists_merge_requests_spec.rb b/spec/features/merge_requests/user_lists_merge_requests_spec.rb
new file mode 100644
index 00000000000..cc7f78e7325
--- /dev/null
+++ b/spec/features/merge_requests/user_lists_merge_requests_spec.rb
@@ -0,0 +1,137 @@
+require 'spec_helper'
+
+describe 'Projects > Merge requests > User lists merge requests', feature: true do
+ include SortingHelper
+
+ let(:project) { create(:project, :public) }
+ let(:user) { create(:user) }
+
+ before do
+ @fix = create(:merge_request,
+ title: 'fix',
+ source_project: project,
+ source_branch: 'fix',
+ assignee: user,
+ milestone: create(:milestone, due_date: '2013-12-11'),
+ created_at: 1.minute.ago,
+ updated_at: 1.minute.ago)
+ create(:merge_request,
+ title: 'markdown',
+ source_project: project,
+ source_branch: 'markdown',
+ assignee: user,
+ milestone: create(:milestone, due_date: '2013-12-12'),
+ created_at: 2.minutes.ago,
+ updated_at: 2.minutes.ago)
+ create(:merge_request,
+ title: 'lfs',
+ source_project: project,
+ source_branch: 'lfs',
+ created_at: 3.minutes.ago,
+ updated_at: 10.seconds.ago)
+ end
+
+ it 'filters on no assignee' do
+ visit_merge_requests(project, assignee_id: IssuableFinder::NONE)
+
+ expect(current_path).to eq(namespace_project_merge_requests_path(project.namespace, project))
+ expect(page).to have_content 'lfs'
+ expect(page).not_to have_content 'fix'
+ expect(page).not_to have_content 'markdown'
+ end
+
+ it 'filters on a specific assignee' do
+ visit_merge_requests(project, assignee_id: user.id)
+
+ expect(page).not_to have_content 'lfs'
+ expect(page).to have_content 'fix'
+ expect(page).to have_content 'markdown'
+ end
+
+ it 'sorts by newest' do
+ visit_merge_requests(project, sort: sort_value_recently_created)
+
+ expect(first_merge_request).to include('lfs')
+ expect(last_merge_request).to include('fix')
+ end
+
+ it 'sorts by oldest' do
+ visit_merge_requests(project, sort: sort_value_oldest_created)
+
+ expect(first_merge_request).to include('fix')
+ expect(last_merge_request).to include('lfs')
+ end
+
+ it 'sorts by last updated' do
+ visit_merge_requests(project, sort: sort_value_recently_updated)
+
+ expect(first_merge_request).to include('lfs')
+ end
+
+ it 'sorts by oldest updated' do
+ visit_merge_requests(project, sort: sort_value_oldest_updated)
+
+ expect(first_merge_request).to include('markdown')
+ end
+
+ it 'sorts by milestone due soon' do
+ visit_merge_requests(project, sort: sort_value_milestone_soon)
+
+ expect(first_merge_request).to include('fix')
+ end
+
+ it 'sorts by milestone due later' do
+ visit_merge_requests(project, sort: sort_value_milestone_later)
+
+ expect(first_merge_request).to include('markdown')
+ end
+
+ it 'filters on one label and sorts by due soon' do
+ label = create(:label, project: project)
+ create(:label_link, label: label, target: @fix)
+
+ visit_merge_requests(project, label_name: [label.name],
+ sort: sort_value_due_date_soon)
+
+ expect(first_merge_request).to include('fix')
+ end
+
+ context 'while filtering on two labels' do
+ let(:label) { create(:label, project: project) }
+ let(:label2) { create(:label, project: project) }
+
+ before do
+ create(:label_link, label: label, target: @fix)
+ create(:label_link, label: label2, target: @fix)
+ end
+
+ it 'sorts by due soon' do
+ visit_merge_requests(project, label_name: [label.name, label2.name],
+ sort: sort_value_due_date_soon)
+
+ expect(first_merge_request).to include('fix')
+ end
+
+ context 'filter on assignee and' do
+ it 'sorts by due soon' do
+ visit_merge_requests(project, label_name: [label.name, label2.name],
+ assignee_id: user.id,
+ sort: sort_value_due_date_soon)
+
+ expect(first_merge_request).to include('fix')
+ end
+ end
+ end
+
+ def visit_merge_requests(project, opts = {})
+ visit namespace_project_merge_requests_path(project.namespace, project, opts)
+ end
+
+ def first_merge_request
+ page.all('ul.mr-list > li').first.text
+ end
+
+ def last_merge_request
+ page.all('ul.mr-list > li').last.text
+ end
+end
diff --git a/spec/features/projects/developer_views_empty_project_instructions_spec.rb b/spec/features/projects/developer_views_empty_project_instructions_spec.rb
new file mode 100644
index 00000000000..0c51fe72ca4
--- /dev/null
+++ b/spec/features/projects/developer_views_empty_project_instructions_spec.rb
@@ -0,0 +1,63 @@
+require 'rails_helper'
+
+feature 'Developer views empty project instructions', feature: true do
+ let(:project) { create(:empty_project, :empty_repo) }
+ let(:developer) { create(:user) }
+
+ background do
+ project.team << [developer, :developer]
+
+ login_as(developer)
+ end
+
+ context 'without an SSH key' do
+ scenario 'defaults to HTTP' do
+ visit_project
+
+ expect_instructions_for('http')
+ end
+
+ scenario 'switches to SSH', js: true do
+ visit_project
+
+ select_protocol('SSH')
+
+ expect_instructions_for('ssh')
+ end
+ end
+
+ context 'with an SSH key' do
+ background do
+ create(:personal_key, user: developer)
+ end
+
+ scenario 'defaults to SSH' do
+ visit_project
+
+ expect_instructions_for('ssh')
+ end
+
+ scenario 'switches to HTTP', js: true do
+ visit_project
+
+ select_protocol('HTTP')
+
+ expect_instructions_for('http')
+ end
+ end
+
+ def visit_project
+ visit namespace_project_path(project.namespace, project)
+ end
+
+ def select_protocol(protocol)
+ find('#clone-dropdown').click
+ find(".#{protocol.downcase}-selector").click
+ end
+
+ def expect_instructions_for(protocol)
+ msg = :"#{protocol.downcase}_url_to_repo"
+
+ expect(page).to have_content("git clone #{project.send(msg)}")
+ end
+end
diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/master_creates_tag_spec.rb
new file mode 100644
index 00000000000..08a97085a9c
--- /dev/null
+++ b/spec/features/tags/master_creates_tag_spec.rb
@@ -0,0 +1,62 @@
+require 'spec_helper'
+
+feature 'Master creates tag', feature: true do
+ let(:user) { create(:user) }
+ let(:project) { create(:project, namespace: user.namespace) }
+
+ before do
+ project.team << [user, :master]
+ login_with(user)
+ visit namespace_project_tags_path(project.namespace, project)
+ end
+
+ scenario 'with an invalid name displays an error' do
+ create_tag_in_form(tag: 'v 1.0', ref: 'master')
+
+ expect(page).to have_content 'Tag name invalid'
+ end
+
+ scenario 'with an invalid reference displays an error' do
+ create_tag_in_form(tag: 'v2.0', ref: 'foo')
+
+ expect(page).to have_content 'Target foo is invalid'
+ end
+
+ scenario 'that already exists displays an error' do
+ create_tag_in_form(tag: 'v1.1.0', ref: 'master')
+
+ expect(page).to have_content 'Tag v1.1.0 already exists'
+ end
+
+ scenario 'with multiline message displays the message in a <pre> block' do
+ create_tag_in_form(tag: 'v3.0', ref: 'master', message: "Awesome tag message\n\n- hello\n- world")
+
+ expect(current_path).to eq(
+ namespace_project_tag_path(project.namespace, project, 'v3.0'))
+ expect(page).to have_content 'v3.0'
+ page.within 'pre.body' do
+ expect(page).to have_content "Awesome tag message\n\n- hello\n- world"
+ end
+ end
+
+ scenario 'with multiline release notes parses the release note as Markdown' do
+ create_tag_in_form(tag: 'v4.0', ref: 'master', desc: "Awesome release notes\n\n- hello\n- world")
+
+ expect(current_path).to eq(
+ namespace_project_tag_path(project.namespace, project, 'v4.0'))
+ expect(page).to have_content 'v4.0'
+ page.within '.description' do
+ expect(page).to have_content 'Awesome release notes'
+ expect(page).to have_selector('ul li', count: 2)
+ end
+ end
+
+ def create_tag_in_form(tag:, ref:, message: nil, desc: nil)
+ click_link 'New tag'
+ fill_in 'tag_name', with: tag
+ fill_in 'ref', with: ref
+ fill_in 'message', with: message unless message.nil?
+ fill_in 'release_description', with: desc unless desc.nil?
+ click_button 'Create tag'
+ end
+end
diff --git a/spec/features/tags/master_deletes_tag_spec.rb b/spec/features/tags/master_deletes_tag_spec.rb
new file mode 100644
index 00000000000..f0990118e3c
--- /dev/null
+++ b/spec/features/tags/master_deletes_tag_spec.rb
@@ -0,0 +1,41 @@
+require 'spec_helper'
+
+feature 'Master deletes tag', feature: true do
+ let(:user) { create(:user) }
+ let(:project) { create(:project, namespace: user.namespace) }
+
+ before do
+ project.team << [user, :master]
+ login_with(user)
+ visit namespace_project_tags_path(project.namespace, project)
+ end
+
+ context 'from the tags list page' do
+ scenario 'deletes the tag' do
+ expect(page).to have_content 'v1.1.0'
+
+ page.within('.content') do
+ first('.btn-remove').click
+ end
+
+ expect(current_path).to eq(
+ namespace_project_tags_path(project.namespace, project))
+ expect(page).not_to have_content 'v1.1.0'
+ end
+
+ end
+
+ context 'from a specific tag page' do
+ scenario 'deletes the tag' do
+ click_on 'v1.0.0'
+ expect(current_path).to eq(
+ namespace_project_tag_path(project.namespace, project, 'v1.0.0'))
+
+ click_on 'Delete tag'
+
+ expect(current_path).to eq(
+ namespace_project_tags_path(project.namespace, project))
+ expect(page).not_to have_content 'v1.0.0'
+ end
+ end
+end
diff --git a/spec/features/tags/master_updates_tag_spec.rb b/spec/features/tags/master_updates_tag_spec.rb
new file mode 100644
index 00000000000..c926e9841f3
--- /dev/null
+++ b/spec/features/tags/master_updates_tag_spec.rb
@@ -0,0 +1,42 @@
+require 'spec_helper'
+
+feature 'Master updates tag', feature: true do
+ let(:user) { create(:user) }
+ let(:project) { create(:project, namespace: user.namespace) }
+
+ before do
+ project.team << [user, :master]
+ login_with(user)
+ visit namespace_project_tags_path(project.namespace, project)
+ end
+
+ context 'from the tags list page' do
+ scenario 'updates the release notes' do
+ page.within(first('.controls')) do
+ click_link 'Edit release notes'
+ end
+
+ fill_in 'release_description', with: 'Awesome release notes'
+ click_button 'Save changes'
+
+ expect(current_path).to eq(
+ namespace_project_tag_path(project.namespace, project, 'v1.1.0'))
+ expect(page).to have_content 'v1.1.0'
+ expect(page).to have_content 'Awesome release notes'
+ end
+ end
+
+ context 'from a specific tag page' do
+ scenario 'updates the release notes' do
+ click_on 'v1.1.0'
+ click_link 'Edit release notes'
+ fill_in 'release_description', with: 'Awesome release notes'
+ click_button 'Save changes'
+
+ expect(current_path).to eq(
+ namespace_project_tag_path(project.namespace, project, 'v1.1.0'))
+ expect(page).to have_content 'v1.1.0'
+ expect(page).to have_content 'Awesome release notes'
+ end
+ end
+end
diff --git a/spec/features/tags/master_views_tags_spec.rb b/spec/features/tags/master_views_tags_spec.rb
new file mode 100644
index 00000000000..29d2c244720
--- /dev/null
+++ b/spec/features/tags/master_views_tags_spec.rb
@@ -0,0 +1,73 @@
+require 'spec_helper'
+
+feature 'Master views tags', feature: true do
+ let(:user) { create(:user) }
+
+ before do
+ project.team << [user, :master]
+ login_with(user)
+ end
+
+ context 'when project has no tags' do
+ let(:project) { create(:project_empty_repo) }
+ before do
+ visit namespace_project_path(project.namespace, project)
+ click_on 'README'
+ fill_in :commit_message, with: 'Add a README file', visible: true
+ # Remove pre-receive hook so we can push without auth
+ FileUtils.rm_f(File.join(project.repository.path, 'hooks', 'pre-receive'))
+ click_button 'Commit Changes'
+ visit namespace_project_tags_path(project.namespace, project)
+ end
+
+ scenario 'displays a specific message' do
+ expect(page).to have_content 'Repository has no tags yet.'
+ end
+ end
+
+ context 'when project has tags' do
+ let(:project) { create(:project, namespace: user.namespace) }
+ before do
+ visit namespace_project_tags_path(project.namespace, project)
+ end
+
+ scenario 'views the tags list page' do
+ expect(page).to have_content 'v1.0.0'
+ end
+
+ scenario 'views a specific tag page' do
+ click_on 'v1.0.0'
+
+ expect(current_path).to eq(
+ namespace_project_tag_path(project.namespace, project, 'v1.0.0'))
+ expect(page).to have_content 'v1.0.0'
+ expect(page).to have_content 'This tag has no release notes.'
+ end
+
+ describe 'links on the tag page' do
+ scenario 'has a button to browse files' do
+ click_on 'v1.0.0'
+
+ expect(current_path).to eq(
+ namespace_project_tag_path(project.namespace, project, 'v1.0.0'))
+
+ click_on 'Browse files'
+
+ expect(current_path).to eq(
+ namespace_project_tree_path(project.namespace, project, 'v1.0.0'))
+ end
+
+ scenario 'has a button to browse commits' do
+ click_on 'v1.0.0'
+
+ expect(current_path).to eq(
+ namespace_project_tag_path(project.namespace, project, 'v1.0.0'))
+
+ click_on 'Browse commits'
+
+ expect(current_path).to eq(
+ namespace_project_commits_path(project.namespace, project, 'v1.0.0'))
+ end
+ end
+ end
+end
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb
index 29bcb8c5892..ac5af8740dc 100644
--- a/spec/helpers/projects_helper_spec.rb
+++ b/spec/helpers/projects_helper_spec.rb
@@ -88,18 +88,18 @@ describe ProjectsHelper do
end
describe 'default_clone_protocol' do
- describe 'using HTTP' do
+ context 'when user is not logged in and gitlab protocol is HTTP' do
it 'returns HTTP' do
- expect(helper).to receive(:current_user).and_return(nil)
+ allow(helper).to receive(:current_user).and_return(nil)
expect(helper.send(:default_clone_protocol)).to eq('http')
end
end
- describe 'using HTTPS' do
+ context 'when user is not logged in and gitlab protocol is HTTPS' do
it 'returns HTTPS' do
- allow(Gitlab.config.gitlab).to receive(:protocol).and_return('https')
- expect(helper).to receive(:current_user).and_return(nil)
+ stub_config_setting(protocol: 'https')
+ allow(helper).to receive(:current_user).and_return(nil)
expect(helper.send(:default_clone_protocol)).to eq('https')
end
diff --git a/spec/initializers/trusted_proxies_spec.rb b/spec/initializers/trusted_proxies_spec.rb
new file mode 100644
index 00000000000..4bb149f25ff
--- /dev/null
+++ b/spec/initializers/trusted_proxies_spec.rb
@@ -0,0 +1,51 @@
+require 'spec_helper'
+
+describe 'trusted_proxies', lib: true do
+ context 'with default config' do
+ before do
+ set_trusted_proxies([])
+ end
+
+ it 'preserves private IPs as remote_ip' do
+ request = stub_request('HTTP_X_FORWARDED_FOR' => '10.1.5.89')
+ expect(request.remote_ip).to eq('10.1.5.89')
+ end
+
+ it 'filters out localhost from remote_ip' do
+ request = stub_request('HTTP_X_FORWARDED_FOR' => '1.1.1.1, 10.1.5.89, 127.0.0.1')
+ expect(request.remote_ip).to eq('10.1.5.89')
+ end
+ end
+
+ context 'with private IP ranges added' do
+ before do
+ set_trusted_proxies([ "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" ])
+ end
+
+ it 'filters out private and local IPs from remote_ip' do
+ request = stub_request('HTTP_X_FORWARDED_FOR' => '1.2.3.6, 1.1.1.1, 10.1.5.89, 127.0.0.1')
+ expect(request.remote_ip).to eq('1.1.1.1')
+ end
+ end
+
+ context 'with proxy IP added' do
+ before do
+ set_trusted_proxies([ "60.98.25.47" ])
+ end
+
+ it 'filters out proxy IP from remote_ip' do
+ request = stub_request('HTTP_X_FORWARDED_FOR' => '1.2.3.6, 1.1.1.1, 60.98.25.47, 127.0.0.1')
+ expect(request.remote_ip).to eq('1.1.1.1')
+ end
+ end
+
+ def stub_request(headers = {})
+ ActionDispatch::RemoteIp.new(Proc.new { }, false, Rails.application.config.action_dispatch.trusted_proxies).call(headers)
+ ActionDispatch::Request.new(headers)
+ end
+
+ def set_trusted_proxies(proxies = [])
+ stub_config_setting('trusted_proxies' => proxies)
+ load File.join(__dir__, '../../config/initializers/trusted_proxies.rb')
+ end
+end
diff --git a/spec/javascripts/merge_request_widget_spec.js.coffee b/spec/javascripts/merge_request_widget_spec.js.coffee
index c0bd8a29e43..92b7eeb1116 100644
--- a/spec/javascripts/merge_request_widget_spec.js.coffee
+++ b/spec/javascripts/merge_request_widget_spec.js.coffee
@@ -47,3 +47,9 @@ describe 'MergeRequestWidget', ->
spy = spyOn(@class, 'showCICoverage').and.stub()
@class.getCIStatus(false)
expect(spy).not.toHaveBeenCalled()
+
+ it 'should not display a notification on the first check after the widget has been created', ->
+ spy = spyOn(window, 'notify')
+ @class = new MergeRequestWidget(@opts)
+ @class.getCIStatus(true)
+ expect(spy).not.toHaveBeenCalled()
diff --git a/spec/lib/banzai/filter/milestone_reference_filter_spec.rb b/spec/lib/banzai/filter/milestone_reference_filter_spec.rb
index ebf3d7489b5..5beb61dac5c 100644
--- a/spec/lib/banzai/filter/milestone_reference_filter_spec.rb
+++ b/spec/lib/banzai/filter/milestone_reference_filter_spec.rb
@@ -43,7 +43,7 @@ describe Banzai::Filter::MilestoneReferenceFilter, lib: true do
milestone.update_attribute(:title, %{"></a>whatever<a title="})
doc = reference_filter("milestone #{reference}")
- expect(doc.text).to eq "milestone #{milestone.title}"
+ expect(doc.text).to eq "milestone \">whatever"
end
it 'includes default classes' do
diff --git a/spec/lib/banzai/filter/sanitization_filter_spec.rb b/spec/lib/banzai/filter/sanitization_filter_spec.rb
index 27ce312b11c..b38e3b17e64 100644
--- a/spec/lib/banzai/filter/sanitization_filter_spec.rb
+++ b/spec/lib/banzai/filter/sanitization_filter_spec.rb
@@ -22,6 +22,12 @@ describe Banzai::Filter::SanitizationFilter, lib: true do
expect(filter(act).to_html).to eq exp
end
+ it 'sanitizes mixed-cased javascript in attributes' do
+ act = %q(<a href="javaScript:alert('foo')">Text</a>)
+ exp = '<a>Text</a>'
+ expect(filter(act).to_html).to eq exp
+ end
+
it 'allows whitelisted HTML tags from the user' do
exp = act = "<dl>\n<dt>Term</dt>\n<dd>Definition</dd>\n</dl>"
expect(filter(act).to_html).to eq exp
diff --git a/spec/lib/banzai/filter/upload_link_filter_spec.rb b/spec/lib/banzai/filter/upload_link_filter_spec.rb
index 3b073a90a95..b83be54746c 100644
--- a/spec/lib/banzai/filter/upload_link_filter_spec.rb
+++ b/spec/lib/banzai/filter/upload_link_filter_spec.rb
@@ -8,6 +8,10 @@ describe Banzai::Filter::UploadLinkFilter, lib: true do
project: project
})
+ raw_filter(doc, contexts)
+ end
+
+ def raw_filter(doc, contexts = {})
described_class.call(doc, contexts)
end
@@ -70,4 +74,18 @@ describe Banzai::Filter::UploadLinkFilter, lib: true do
expect(doc.at_css('img')['src']).to match "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/uploads/%ED%95%9C%EA%B8%80.png"
end
end
+
+ context 'when project context does not exist' do
+ let(:upload_link) { link('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg') }
+
+ it 'does not raise error' do
+ expect { raw_filter(upload_link, project: nil) }.not_to raise_error
+ end
+
+ it 'does not rewrite link' do
+ doc = raw_filter(upload_link, project: nil)
+
+ expect(doc.to_html).to eq upload_link
+ end
+ end
end
diff --git a/spec/models/abuse_report_spec.rb b/spec/models/abuse_report_spec.rb
index ac12ab6c757..305f8bc88cc 100644
--- a/spec/models/abuse_report_spec.rb
+++ b/spec/models/abuse_report_spec.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: abuse_reports
-#
-# id :integer not null, primary key
-# reporter_id :integer
-# user_id :integer
-# message :text
-# created_at :datetime
-# updated_at :datetime
-#
-
require 'rails_helper'
RSpec.describe AbuseReport, type: :model do
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index 520cf1b75de..1ce22feed5c 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -1,49 +1,3 @@
-# == Schema Information
-#
-# Table name: application_settings
-#
-# id :integer not null, primary key
-# default_projects_limit :integer
-# signup_enabled :boolean
-# signin_enabled :boolean
-# gravatar_enabled :boolean
-# sign_in_text :text
-# created_at :datetime
-# updated_at :datetime
-# home_page_url :string(255)
-# default_branch_protection :integer default(2)
-# restricted_visibility_levels :text
-# version_check_enabled :boolean default(TRUE)
-# max_attachment_size :integer default(10), not null
-# default_project_visibility :integer
-# default_snippet_visibility :integer
-# restricted_signup_domains :text
-# user_oauth_applications :boolean default(TRUE)
-# after_sign_out_path :string(255)
-# session_expire_delay :integer default(10080), not null
-# import_sources :text
-# help_page_text :text
-# admin_notification_email :string(255)
-# shared_runners_enabled :boolean default(TRUE), not null
-# max_artifacts_size :integer default(100), not null
-# runners_registration_token :string
-# require_two_factor_authentication :boolean default(FALSE)
-# two_factor_grace_period :integer default(48)
-# metrics_enabled :boolean default(FALSE)
-# metrics_host :string default("localhost")
-# metrics_username :string
-# metrics_password :string
-# metrics_pool_size :integer default(16)
-# metrics_timeout :integer default(10)
-# metrics_method_call_threshold :integer default(10)
-# recaptcha_enabled :boolean default(FALSE)
-# recaptcha_site_key :string
-# recaptcha_private_key :string
-# metrics_port :integer default(8089)
-# sentry_enabled :boolean default(FALSE)
-# sentry_dsn :string
-#
-
require 'spec_helper'
describe ApplicationSetting, models: true do
diff --git a/spec/models/broadcast_message_spec.rb b/spec/models/broadcast_message_spec.rb
index f6f84db57e6..6ad8bfef4f2 100644
--- a/spec/models/broadcast_message_spec.rb
+++ b/spec/models/broadcast_message_spec.rb
@@ -1,17 +1,3 @@
-# == Schema Information
-#
-# Table name: broadcast_messages
-#
-# id :integer not null, primary key
-# message :text not null
-# starts_at :datetime
-# ends_at :datetime
-# created_at :datetime
-# updated_at :datetime
-# color :string(255)
-# font :string(255)
-#
-
require 'spec_helper'
describe BroadcastMessage, models: true do
diff --git a/spec/models/ci/commit_spec.rb b/spec/models/ci/commit_spec.rb
index a747aa08447..dc071ad1c90 100644
--- a/spec/models/ci/commit_spec.rb
+++ b/spec/models/ci/commit_spec.rb
@@ -1,21 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_commits
-#
-# id :integer not null, primary key
-# project_id :integer
-# ref :string(255)
-# sha :string(255)
-# before_sha :string(255)
-# push_data :text
-# created_at :datetime
-# updated_at :datetime
-# tag :boolean default(FALSE)
-# yaml_errors :text
-# committed_at :datetime
-# gl_project_id :integer
-#
-
require 'spec_helper'
describe Ci::Commit, models: true do
diff --git a/spec/models/ci/runner_project_spec.rb b/spec/models/ci/runner_project_spec.rb
index 000a732db77..95fc160b238 100644
--- a/spec/models/ci/runner_project_spec.rb
+++ b/spec/models/ci/runner_project_spec.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_runner_projects
-#
-# id :integer not null, primary key
-# runner_id :integer not null
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# gl_project_id :integer
-#
-
require 'spec_helper'
describe Ci::RunnerProject, models: true do
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index 25e9e5eca48..eaa94228922 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -1,22 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_runners
-#
-# id :integer not null, primary key
-# token :string(255)
-# created_at :datetime
-# updated_at :datetime
-# description :string(255)
-# contacted_at :datetime
-# active :boolean default(TRUE), not null
-# is_shared :boolean default(FALSE)
-# name :string(255)
-# version :string(255)
-# revision :string(255)
-# platform :string(255)
-# architecture :string(255)
-#
-
require 'spec_helper'
describe Ci::Runner, models: true do
diff --git a/spec/models/ci/trigger_spec.rb b/spec/models/ci/trigger_spec.rb
index 159be939300..474b0b1621d 100644
--- a/spec/models/ci/trigger_spec.rb
+++ b/spec/models/ci/trigger_spec.rb
@@ -1,16 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_triggers
-#
-# id :integer not null, primary key
-# token :string(255)
-# project_id :integer
-# deleted_at :datetime
-# created_at :datetime
-# updated_at :datetime
-# gl_project_id :integer
-#
-
require 'spec_helper'
describe Ci::Trigger, models: true do
diff --git a/spec/models/ci/variable_spec.rb b/spec/models/ci/variable_spec.rb
index 71e84091cb7..c712d211b0f 100644
--- a/spec/models/ci/variable_spec.rb
+++ b/spec/models/ci/variable_spec.rb
@@ -1,17 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_variables
-#
-# id :integer not null, primary key
-# project_id :integer
-# key :string(255)
-# value :text
-# encrypted_value :text
-# encrypted_value_salt :string(255)
-# encrypted_value_iv :string(255)
-# gl_project_id :integer
-#
-
require 'spec_helper'
describe Ci::Variable, models: true do
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 971e6750375..434e58cfd06 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -1,37 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_builds
-#
-# id :integer not null, primary key
-# project_id :integer
-# status :string(255)
-# finished_at :datetime
-# trace :text
-# created_at :datetime
-# updated_at :datetime
-# started_at :datetime
-# runner_id :integer
-# coverage :float
-# commit_id :integer
-# commands :text
-# job_id :integer
-# name :string(255)
-# deploy :boolean default(FALSE)
-# options :text
-# allow_failure :boolean default(FALSE), not null
-# stage :string(255)
-# trigger_request_id :integer
-# stage_idx :integer
-# tag :boolean
-# ref :string(255)
-# user_id :integer
-# type :string(255)
-# target_url :string(255)
-# description :string(255)
-# artifacts_file :text
-# gl_project_id :integer
-#
-
require 'spec_helper'
describe CommitStatus, models: true do
diff --git a/spec/models/deploy_key_spec.rb b/spec/models/deploy_key_spec.rb
index 64ba778afea..6a90598a629 100644
--- a/spec/models/deploy_key_spec.rb
+++ b/spec/models/deploy_key_spec.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: keys
-#
-# id :integer not null, primary key
-# user_id :integer
-# created_at :datetime
-# updated_at :datetime
-# key :text
-# title :string(255)
-# type :string(255)
-# fingerprint :string(255)
-# public :boolean default(FALSE), not null
-#
-
require 'spec_helper'
describe DeployKey, models: true do
diff --git a/spec/models/deploy_keys_project_spec.rb b/spec/models/deploy_keys_project_spec.rb
index 8aedbfb8636..8a1e337c1a3 100644
--- a/spec/models/deploy_keys_project_spec.rb
+++ b/spec/models/deploy_keys_project_spec.rb
@@ -1,14 +1,3 @@
-# == Schema Information
-#
-# Table name: deploy_keys_projects
-#
-# id :integer not null, primary key
-# deploy_key_id :integer not null
-# project_id :integer not null
-# created_at :datetime
-# updated_at :datetime
-#
-
require 'spec_helper'
describe DeployKeysProject, models: true do
diff --git a/spec/models/email_spec.rb b/spec/models/email_spec.rb
index a20a6149649..5d0bd31db5a 100644
--- a/spec/models/email_spec.rb
+++ b/spec/models/email_spec.rb
@@ -1,14 +1,3 @@
-# == Schema Information
-#
-# Table name: emails
-#
-# id :integer not null, primary key
-# user_id :integer not null
-# email :string(255) not null
-# created_at :datetime
-# updated_at :datetime
-#
-
require 'spec_helper'
describe Email, models: true do
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb
index 0c3cd13f399..b0e76fec693 100644
--- a/spec/models/event_spec.rb
+++ b/spec/models/event_spec.rb
@@ -1,19 +1,3 @@
-# == Schema Information
-#
-# Table name: events
-#
-# id :integer not null, primary key
-# target_type :string(255)
-# target_id :integer
-# title :string(255)
-# data :text
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# action :integer
-# author_id :integer
-#
-
require 'spec_helper'
describe Event, models: true do
diff --git a/spec/models/forked_project_link_spec.rb b/spec/models/forked_project_link_spec.rb
index d90fbfe1ea5..3b817608ce0 100644
--- a/spec/models/forked_project_link_spec.rb
+++ b/spec/models/forked_project_link_spec.rb
@@ -1,14 +1,3 @@
-# == Schema Information
-#
-# Table name: forked_project_links
-#
-# id :integer not null, primary key
-# forked_to_project_id :integer not null
-# forked_from_project_id :integer not null
-# created_at :datetime
-# updated_at :datetime
-#
-
require 'spec_helper'
describe ForkedProjectLink, "add link on fork" do
diff --git a/spec/models/generic_commit_status_spec.rb b/spec/models/generic_commit_status_spec.rb
index 5b0883d8702..0caf5869c24 100644
--- a/spec/models/generic_commit_status_spec.rb
+++ b/spec/models/generic_commit_status_spec.rb
@@ -1,37 +1,3 @@
-# == Schema Information
-#
-# Table name: ci_builds
-#
-# id :integer not null, primary key
-# project_id :integer
-# status :string(255)
-# finished_at :datetime
-# trace :text
-# created_at :datetime
-# updated_at :datetime
-# started_at :datetime
-# runner_id :integer
-# coverage :float
-# commit_id :integer
-# commands :text
-# job_id :integer
-# name :string(255)
-# deploy :boolean default(FALSE)
-# options :text
-# allow_failure :boolean default(FALSE), not null
-# stage :string(255)
-# trigger_request_id :integer
-# stage_idx :integer
-# tag :boolean
-# ref :string(255)
-# user_id :integer
-# type :string(255)
-# target_url :string(255)
-# description :string(255)
-# artifacts_file :text
-# gl_project_id :integer
-#
-
require 'spec_helper'
describe GenericCommitStatus, models: true do
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index 7bfca1e72c3..6fa16be7f04 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: namespaces
-#
-# id :integer not null, primary key
-# name :string(255) not null
-# path :string(255) not null
-# owner_id :integer
-# created_at :datetime
-# updated_at :datetime
-# type :string(255)
-# description :string(255) default(""), not null
-# avatar :string(255)
-#
-
require 'spec_helper'
describe Group, models: true do
diff --git a/spec/models/identity_spec.rb b/spec/models/identity_spec.rb
index 5afe042e154..1b987588f59 100644
--- a/spec/models/identity_spec.rb
+++ b/spec/models/identity_spec.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: identities
-#
-# id :integer not null, primary key
-# extern_uid :string(255)
-# provider :string(255)
-# user_id :integer
-# created_at :datetime
-# updated_at :datetime
-#
-
require 'spec_helper'
RSpec.describe Identity, models: true do
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 060e6599104..8ab00c70f9d 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -1,23 +1,3 @@
-# == Schema Information
-#
-# Table name: issues
-#
-# id :integer not null, primary key
-# title :string(255)
-# assignee_id :integer
-# author_id :integer
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# position :integer default(0)
-# branch_name :string(255)
-# description :text
-# milestone_id :integer
-# state :string(255)
-# iid :integer
-# updated_by_id :integer
-#
-
require 'spec_helper'
describe Issue, models: true do
diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb
index c962b83644a..26fbedbef2f 100644
--- a/spec/models/key_spec.rb
+++ b/spec/models/key_spec.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: keys
-#
-# id :integer not null, primary key
-# user_id :integer
-# created_at :datetime
-# updated_at :datetime
-# key :text
-# title :string(255)
-# type :string(255)
-# fingerprint :string(255)
-# public :boolean default(FALSE), not null
-#
-
require 'spec_helper'
describe Key, models: true do
diff --git a/spec/models/label_link_spec.rb b/spec/models/label_link_spec.rb
index dc7510b1de3..5e6f8ca1528 100644
--- a/spec/models/label_link_spec.rb
+++ b/spec/models/label_link_spec.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: label_links
-#
-# id :integer not null, primary key
-# label_id :integer
-# target_id :integer
-# target_type :string(255)
-# created_at :datetime
-# updated_at :datetime
-#
-
require 'spec_helper'
describe LabelLink, models: true do
diff --git a/spec/models/label_spec.rb b/spec/models/label_spec.rb
index 0614ca1e7c9..dad2628651b 100644
--- a/spec/models/label_spec.rb
+++ b/spec/models/label_spec.rb
@@ -1,16 +1,3 @@
-# == Schema Information
-#
-# Table name: labels
-#
-# id :integer not null, primary key
-# title :string(255)
-# color :string(255)
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# template :boolean default(FALSE)
-#
-
require 'spec_helper'
describe Label, models: true do
@@ -55,6 +42,14 @@ describe Label, models: true do
end
end
+ describe "#title" do
+ let(:label) { create(:label, title: "<b>test</b>") }
+
+ it "sanitizes title" do
+ expect(label.title).to eq("test")
+ end
+ end
+
describe '#to_reference' do
context 'using id' do
it 'returns a String reference to the object' do
diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb
index 2d8f1cc1ad3..6e51730eecd 100644
--- a/spec/models/member_spec.rb
+++ b/spec/models/member_spec.rb
@@ -1,22 +1,3 @@
-# == Schema Information
-#
-# Table name: members
-#
-# id :integer not null, primary key
-# access_level :integer not null
-# source_id :integer not null
-# source_type :string(255) not null
-# user_id :integer
-# notification_level :integer not null
-# type :string(255)
-# created_at :datetime
-# updated_at :datetime
-# created_by_id :integer
-# invite_email :string(255)
-# invite_token :string(255)
-# invite_accepted_at :datetime
-#
-
require 'spec_helper'
describe Member, models: true do
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index d7884cea336..c8578749b21 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -1,32 +1,3 @@
-# == Schema Information
-#
-# Table name: merge_requests
-#
-# id :integer not null, primary key
-# target_branch :string(255) not null
-# source_branch :string(255) not null
-# source_project_id :integer not null
-# author_id :integer
-# assignee_id :integer
-# title :string(255)
-# created_at :datetime
-# updated_at :datetime
-# milestone_id :integer
-# state :string(255)
-# merge_status :string(255)
-# target_project_id :integer not null
-# iid :integer
-# description :text
-# position :integer default(0)
-# locked_at :datetime
-# updated_by_id :integer
-# merge_error :string(255)
-# merge_params :text
-# merge_when_build_succeeds :boolean default(FALSE), not null
-# merge_user_id :integer
-# merge_commit_sha :string
-#
-
require 'spec_helper'
describe MergeRequest, models: true do
diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb
index 72a4ea70228..247a9fa9910 100644
--- a/spec/models/milestone_spec.rb
+++ b/spec/models/milestone_spec.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: milestones
-#
-# id :integer not null, primary key
-# title :string(255) not null
-# project_id :integer not null
-# description :text
-# due_date :date
-# created_at :datetime
-# updated_at :datetime
-# state :string(255)
-# iid :integer
-#
-
require 'spec_helper'
describe Milestone, models: true do
@@ -34,6 +19,14 @@ describe Milestone, models: true do
let(:issue) { create(:issue) }
let(:user) { create(:user) }
+ describe "#title" do
+ let(:milestone) { create(:milestone, title: "<b>test</b>") }
+
+ it "sanitizes title" do
+ expect(milestone.title).to eq("test")
+ end
+ end
+
describe "unique milestone title per project" do
it "shouldn't accept the same title in a project twice" do
new_milestone = Milestone.new(project: milestone.project, title: milestone.title)
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 3c3a580942a..4074f966299 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -1,18 +1,3 @@
-# == Schema Information
-#
-# Table name: namespaces
-#
-# id :integer not null, primary key
-# name :string(255) not null
-# path :string(255) not null
-# owner_id :integer
-# created_at :datetime
-# updated_at :datetime
-# type :string(255)
-# description :string(255) default(""), not null
-# avatar :string(255)
-#
-
require 'spec_helper'
describe Namespace, models: true do
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 6b18936edb1..4b788b57882 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -1,24 +1,3 @@
-# == Schema Information
-#
-# Table name: notes
-#
-# id :integer not null, primary key
-# note :text
-# noteable_type :string(255)
-# author_id :integer
-# created_at :datetime
-# updated_at :datetime
-# project_id :integer
-# attachment :string(255)
-# line_code :string(255)
-# commit_id :string(255)
-# noteable_id :integer
-# system :boolean default(FALSE), not null
-# st_diff :text
-# updated_by_id :integer
-# is_award :boolean default(FALSE), not null
-#
-
require 'spec_helper'
describe Note, models: true do
diff --git a/spec/models/project_snippet_spec.rb b/spec/models/project_snippet_spec.rb
index e0feb606f78..d9d7c0b0aaa 100644
--- a/spec/models/project_snippet_spec.rb
+++ b/spec/models/project_snippet_spec.rb
@@ -1,19 +1,3 @@
-# == Schema Information
-#
-# Table name: snippets
-#
-# id :integer not null, primary key
-# title :string(255)
-# content :text
-# author_id :integer not null
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# file_name :string(255)
-# type :string(255)
-# visibility_level :integer default(0), not null
-#
-
require 'spec_helper'
describe ProjectSnippet, models: true do
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 5b1cf71337e..f6e5b132643 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -1,43 +1,3 @@
-# == Schema Information
-#
-# Table name: projects
-#
-# id :integer not null, primary key
-# name :string(255)
-# path :string(255)
-# description :text
-# created_at :datetime
-# updated_at :datetime
-# creator_id :integer
-# issues_enabled :boolean default(TRUE), not null
-# wall_enabled :boolean default(TRUE), not null
-# merge_requests_enabled :boolean default(TRUE), not null
-# wiki_enabled :boolean default(TRUE), not null
-# namespace_id :integer
-# issues_tracker :string(255) default("gitlab"), not null
-# issues_tracker_id :string(255)
-# snippets_enabled :boolean default(TRUE), not null
-# last_activity_at :datetime
-# import_url :string(255)
-# visibility_level :integer default(0), not null
-# archived :boolean default(FALSE), not null
-# avatar :string(255)
-# import_status :string(255)
-# repository_size :float default(0.0)
-# star_count :integer default(0), not null
-# import_type :string(255)
-# import_source :string(255)
-# commit_count :integer default(0)
-# import_error :text
-# ci_id :integer
-# builds_enabled :boolean default(TRUE), not null
-# shared_runners_enabled :boolean default(TRUE), not null
-# runners_token :string
-# build_coverage_regex :string
-# build_allow_git_fetch :boolean default(TRUE), not null
-# build_timeout :integer default(3600), not null
-#
-
require 'spec_helper'
describe Project, models: true do
diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb
index 7e956cf6779..b523834c6e9 100644
--- a/spec/models/protected_branch_spec.rb
+++ b/spec/models/protected_branch_spec.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: protected_branches
-#
-# id :integer not null, primary key
-# project_id :integer not null
-# name :string(255) not null
-# created_at :datetime
-# updated_at :datetime
-# developers_can_push :boolean default(FALSE), not null
-#
-
require 'spec_helper'
describe ProtectedBranch, models: true do
diff --git a/spec/models/release_spec.rb b/spec/models/release_spec.rb
index 72ecb442a36..527005b2b69 100644
--- a/spec/models/release_spec.rb
+++ b/spec/models/release_spec.rb
@@ -1,15 +1,3 @@
-# == Schema Information
-#
-# Table name: releases
-#
-# id :integer not null, primary key
-# tag :string(255)
-# description :text
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-#
-
require 'rails_helper'
RSpec.describe Release, type: :model do
diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb
index 173628c08d0..8592e112c50 100644
--- a/spec/models/service_spec.rb
+++ b/spec/models/service_spec.rb
@@ -1,24 +1,3 @@
-# == Schema Information
-#
-# Table name: services
-#
-# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
-# properties :text
-# template :boolean default(FALSE)
-# push_events :boolean default(TRUE)
-# issues_events :boolean default(TRUE)
-# merge_requests_events :boolean default(TRUE)
-# tag_push_events :boolean default(TRUE)
-# note_events :boolean default(TRUE), not null
-# build_events :boolean default(FALSE), not null
-#
-
require 'spec_helper'
describe Service, models: true do
diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb
index 5077ac7b62b..7a613e360d4 100644
--- a/spec/models/snippet_spec.rb
+++ b/spec/models/snippet_spec.rb
@@ -1,19 +1,3 @@
-# == Schema Information
-#
-# Table name: snippets
-#
-# id :integer not null, primary key
-# title :string(255)
-# content :text
-# author_id :integer not null
-# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# file_name :string(255)
-# type :string(255)
-# visibility_level :integer default(0), not null
-#
-
require 'spec_helper'
describe Snippet, models: true do
diff --git a/spec/models/todo_spec.rb b/spec/models/todo_spec.rb
index d9b86b9368f..623b82c01d8 100644
--- a/spec/models/todo_spec.rb
+++ b/spec/models/todo_spec.rb
@@ -1,21 +1,3 @@
-# == Schema Information
-#
-# Table name: todos
-#
-# id :integer not null, primary key
-# user_id :integer not null
-# project_id :integer not null
-# target_id :integer
-# target_type :string not null
-# author_id :integer
-# action :integer not null
-# state :string not null
-# created_at :datetime
-# updated_at :datetime
-# note_id :integer
-# commit_id :string
-#
-
require 'spec_helper'
describe Todo, models: true do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 8b2fb77e28e..26d4e139396 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1,66 +1,3 @@
-# == Schema Information
-#
-# Table name: users
-#
-# id :integer not null, primary key
-# email :string(255) default(""), not null
-# encrypted_password :string(255) default(""), not null
-# reset_password_token :string(255)
-# reset_password_sent_at :datetime
-# remember_created_at :datetime
-# sign_in_count :integer default(0)
-# current_sign_in_at :datetime
-# last_sign_in_at :datetime
-# current_sign_in_ip :string(255)
-# last_sign_in_ip :string(255)
-# created_at :datetime
-# updated_at :datetime
-# name :string(255)
-# admin :boolean default(FALSE), not null
-# projects_limit :integer default(10)
-# skype :string(255) default(""), not null
-# linkedin :string(255) default(""), not null
-# twitter :string(255) default(""), not null
-# authentication_token :string(255)
-# theme_id :integer default(1), not null
-# bio :string(255)
-# failed_attempts :integer default(0)
-# locked_at :datetime
-# username :string(255)
-# can_create_group :boolean default(TRUE), not null
-# can_create_team :boolean default(TRUE), not null
-# state :string(255)
-# color_scheme_id :integer default(1), not null
-# notification_level :integer default(1), not null
-# password_expires_at :datetime
-# created_by_id :integer
-# last_credential_check_at :datetime
-# avatar :string(255)
-# confirmation_token :string(255)
-# confirmed_at :datetime
-# confirmation_sent_at :datetime
-# unconfirmed_email :string(255)
-# hide_no_ssh_key :boolean default(FALSE)
-# website_url :string(255) default(""), not null
-# notification_email :string(255)
-# hide_no_password :boolean default(FALSE)
-# password_automatically_set :boolean default(FALSE)
-# location :string(255)
-# encrypted_otp_secret :string(255)
-# encrypted_otp_secret_iv :string(255)
-# encrypted_otp_secret_salt :string(255)
-# otp_required_for_login :boolean default(FALSE), not null
-# otp_backup_codes :text
-# public_email :string(255) default(""), not null
-# dashboard :integer default(0)
-# project_view :integer default(0)
-# consumed_timestep :integer
-# layout :integer default(0)
-# hide_project_limit :boolean default(FALSE)
-# unlock_token :string
-# otp_grace_period_started_at :datetime
-#
-
require 'spec_helper'
describe User, models: true do
diff --git a/spec/requests/api/commit_status_spec.rb b/spec/requests/api/commit_statuses_spec.rb
index f3785b19362..633927c8c3e 100644
--- a/spec/requests/api/commit_status_spec.rb
+++ b/spec/requests/api/commit_statuses_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe API::CommitStatus, api: true do
+describe API::CommitStatuses, api: true do
include ApiHelpers
let!(:project) { create(:project) }
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index f88e39cad9e..9dd43f4fab3 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -39,6 +39,7 @@ describe API::API, api: true do
let!(:empty_milestone) do
create(:milestone, title: '2.0.0', project: project)
end
+ let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue) }
before { project.team << [user, :reporter] }
@@ -232,8 +233,28 @@ describe API::API, api: true do
end
describe "GET /projects/:id/issues/:issue_id" do
+ it 'exposes known attributes' do
+ get api("/projects/#{project.id}/issues/#{issue.id}", user)
+
+ expect(response.status).to eq(200)
+ expect(json_response['id']).to eq(issue.id)
+ expect(json_response['iid']).to eq(issue.iid)
+ expect(json_response['project_id']).to eq(issue.project.id)
+ expect(json_response['title']).to eq(issue.title)
+ expect(json_response['description']).to eq(issue.description)
+ expect(json_response['state']).to eq(issue.state)
+ expect(json_response['created_at']).to be_present
+ expect(json_response['updated_at']).to be_present
+ expect(json_response['labels']).to eq(issue.label_names)
+ expect(json_response['milestone']).to be_a Hash
+ expect(json_response['assignee']).to be_a Hash
+ expect(json_response['author']).to be_a Hash
+ expect(json_response['user_notes_count']).to be(1)
+ end
+
it "should return a project issue by id" do
get api("/projects/#{project.id}/issues/#{issue.id}", user)
+
expect(response.status).to eq(200)
expect(json_response['title']).to eq(issue.title)
expect(json_response['iid']).to eq(issue.iid)
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 1fa7e76894f..4b0111df149 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -113,6 +113,34 @@ describe API::API, api: true do
end
describe "GET /projects/:id/merge_requests/:merge_request_id" do
+ it 'exposes known attributes' do
+ get api("/projects/#{project.id}/merge_requests/#{merge_request.id}", user)
+
+ expect(response.status).to eq(200)
+ expect(json_response['id']).to eq(merge_request.id)
+ expect(json_response['iid']).to eq(merge_request.iid)
+ expect(json_response['project_id']).to eq(merge_request.project.id)
+ expect(json_response['title']).to eq(merge_request.title)
+ expect(json_response['description']).to eq(merge_request.description)
+ expect(json_response['state']).to eq(merge_request.state)
+ expect(json_response['created_at']).to be_present
+ expect(json_response['updated_at']).to be_present
+ expect(json_response['labels']).to eq(merge_request.label_names)
+ expect(json_response['milestone']).to be_nil
+ expect(json_response['assignee']).to be_a Hash
+ expect(json_response['author']).to be_a Hash
+ expect(json_response['target_branch']).to eq(merge_request.target_branch)
+ expect(json_response['source_branch']).to eq(merge_request.source_branch)
+ expect(json_response['upvotes']).to eq(0)
+ expect(json_response['downvotes']).to eq(0)
+ expect(json_response['source_project_id']).to eq(merge_request.source_project.id)
+ expect(json_response['target_project_id']).to eq(merge_request.target_project.id)
+ expect(json_response['work_in_progress']).to be_falsy
+ expect(json_response['merge_when_build_succeeds']).to be_falsy
+ expect(json_response['merge_status']).to eq('can_be_merged')
+ expect(json_response['user_notes_count']).to be(2)
+ end
+
it "should return merge_request" do
get api("/projects/#{project.id}/merge_requests/#{merge_request.id}", user)
expect(response.status).to eq(200)
diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb
index 240eae10052..5fbf2ae5247 100644
--- a/spec/services/system_note_service_spec.rb
+++ b/spec/services/system_note_service_spec.rb
@@ -506,6 +506,15 @@ describe SystemNoteService, services: true do
end
end
+ describe '.new_commit_summary' do
+ it 'escapes HTML titles' do
+ commit = double(title: '<pre>This is a test</pre>', short_id: '12345678')
+ escaped = '* 12345678 - &lt;pre&gt;This is a test&lt;&#x2F;pre&gt;'
+
+ expect(described_class.new_commit_summary([commit])).to eq([escaped])
+ end
+ end
+
include JiraServiceHelper
describe 'JIRA integration' do
diff --git a/spec/services/todo_service_spec.rb b/spec/services/todo_service_spec.rb
index 82b7fbfa816..a075496ee63 100644
--- a/spec/services/todo_service_spec.rb
+++ b/spec/services/todo_service_spec.rb
@@ -55,6 +55,25 @@ describe TodoService, services: true do
should_create_todo(user: admin, target: confidential_issue, author: john_doe, action: Todo::MENTIONED)
should_not_create_todo(user: john_doe, target: confidential_issue, author: john_doe, action: Todo::MENTIONED)
end
+
+ context 'when a private group is mentioned' do
+ let(:group) { create :group, :private }
+ let(:project) { create :project, :private, group: group }
+ let(:issue) { create :issue, author: author, project: project, description: group.to_reference }
+
+ before do
+ group.add_owner(author)
+ group.add_user(member, Gitlab::Access::DEVELOPER)
+ group.add_user(john_doe, Gitlab::Access::DEVELOPER)
+
+ service.new_issue(issue, author)
+ end
+
+ it 'creates a todo for group members' do
+ should_create_todo(user: member, target: issue)
+ should_create_todo(user: john_doe, target: issue)
+ end
+ end
end
describe '#update_issue' do