summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG2
-rw-r--r--app/models/appearance.rb13
-rw-r--r--app/models/application_setting.rb16
-rw-r--r--app/models/audit_event.rb4
-rw-r--r--app/models/broadcast_message.rb4
-rw-r--r--app/models/ci/build.rb14
-rw-r--r--app/models/ci/commit.rb10
-rw-r--r--app/models/ci/runner.rb14
-rw-r--r--app/models/ci/trigger.rb2
-rw-r--r--app/models/ci/variable.rb6
-rw-r--r--app/models/commit_status.rb17
-rw-r--r--app/models/concerns/issuable.rb5
-rw-r--r--app/models/deploy_key.rb6
-rw-r--r--app/models/email.rb2
-rw-r--r--app/models/event.rb4
-rw-r--r--app/models/generic_commit_status.rb17
-rw-r--r--app/models/group.rb21
-rw-r--r--app/models/hooks/project_hook.rb2
-rw-r--r--app/models/hooks/service_hook.rb2
-rw-r--r--app/models/hooks/system_hook.rb2
-rw-r--r--app/models/hooks/web_hook.rb2
-rw-r--r--app/models/identity.rb4
-rw-r--r--app/models/issue.rb9
-rw-r--r--app/models/key.rb6
-rw-r--r--app/models/label.rb16
-rw-r--r--app/models/label_link.rb2
-rw-r--r--app/models/lfs_object.rb4
-rw-r--r--app/models/member.rb8
-rw-r--r--app/models/members/group_member.rb8
-rw-r--r--app/models/members/project_member.rb8
-rw-r--r--app/models/merge_request.rb13
-rw-r--r--app/models/merge_request_diff.rb4
-rw-r--r--app/models/milestone.rb4
-rw-r--r--app/models/namespace.rb20
-rw-r--r--app/models/note.rb8
-rw-r--r--app/models/notification_setting.rb13
-rw-r--r--app/models/personal_snippet.rb6
-rw-r--r--app/models/project.rb75
-rw-r--r--app/models/project_group_link.rb12
-rw-r--r--app/models/project_import_data.rb9
-rw-r--r--app/models/project_services/asana_service.rb13
-rw-r--r--app/models/project_services/assembla_service.rb13
-rw-r--r--app/models/project_services/bamboo_service.rb13
-rw-r--r--app/models/project_services/buildkite_service.rb13
-rw-r--r--app/models/project_services/builds_email_service.rb13
-rw-r--r--app/models/project_services/campfire_service.rb13
-rw-r--r--app/models/project_services/ci_service.rb13
-rw-r--r--app/models/project_services/custom_issue_tracker_service.rb13
-rw-r--r--app/models/project_services/drone_ci_service.rb13
-rw-r--r--app/models/project_services/emails_on_push_service.rb13
-rw-r--r--app/models/project_services/external_wiki_service.rb13
-rw-r--r--app/models/project_services/flowdock_service.rb13
-rw-r--r--app/models/project_services/gemnasium_service.rb13
-rw-r--r--app/models/project_services/gitlab_ci_service.rb13
-rw-r--r--app/models/project_services/gitlab_issue_tracker_service.rb13
-rw-r--r--app/models/project_services/hipchat_service.rb13
-rw-r--r--app/models/project_services/irker_service.rb13
-rw-r--r--app/models/project_services/issue_tracker_service.rb13
-rw-r--r--app/models/project_services/jira_service.rb13
-rw-r--r--app/models/project_services/pivotaltracker_service.rb13
-rw-r--r--app/models/project_services/pushover_service.rb13
-rw-r--r--app/models/project_services/redmine_service.rb13
-rw-r--r--app/models/project_services/slack_service.rb13
-rw-r--r--app/models/project_services/teamcity_service.rb13
-rw-r--r--app/models/project_snippet.rb6
-rw-r--r--app/models/protected_branch.rb2
-rw-r--r--app/models/release.rb2
-rw-r--r--app/models/security_event.rb4
-rw-r--r--app/models/sent_notification.rb8
-rw-r--r--app/models/service.rb13
-rw-r--r--app/models/snippet.rb6
-rw-r--r--app/models/spam_log.rb17
-rw-r--r--app/models/subscription.rb2
-rw-r--r--app/models/user.rb49
-rw-r--r--app/services/issues/move_service.rb15
-rw-r--r--doc/install/requirements.md9
-rw-r--r--lib/tasks/auto_annotate_models.rake44
-rw-r--r--spec/features/issues_spec.rb2
-rw-r--r--spec/services/issues/move_service_spec.rb38
79 files changed, 589 insertions, 334 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 99e294c9ae1..78d6c1ec2b2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 8.8.0 (unreleased)
+ - Assign labels and milestone to target project when moving issue. !3934 (Long Nguyen)
- Project#open_branches has been cleaned up and no longer loads entire records into memory.
- Log to application.log when an admin starts and stops impersonating a user
- Updated gitlab_git to 10.1.0
@@ -27,6 +28,7 @@ v 8.8.0 (unreleased)
- 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)
v 8.7.3
- Emails, Gitlab::Email::Message, Gitlab::Diff, and Premailer::Adapter::Nokogiri are now instrumented
diff --git a/app/models/appearance.rb b/app/models/appearance.rb
index 4cf8dd9a8ce..4528760fefa 100644
--- a/app/models/appearance.rb
+++ b/app/models/appearance.rb
@@ -1,3 +1,16 @@
+# == 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 36f88154232..72ec91d2909 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -10,21 +10,20 @@
# sign_in_text :text
# created_at :datetime
# updated_at :datetime
-# home_page_url :string(255)
+# 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
-# default_group_visibility :integer
# restricted_signup_domains :text
# user_oauth_applications :boolean default(TRUE)
-# after_sign_out_path :string(255)
+# after_sign_out_path :string
# session_expire_delay :integer default(10080), not null
# import_sources :text
# help_page_text :text
-# admin_notification_email :string(255)
+# admin_notification_email :string
# shared_runners_enabled :boolean default(TRUE), not null
# max_artifacts_size :integer default(100), not null
# runners_registration_token :string
@@ -32,8 +31,6 @@
# 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)
@@ -41,9 +38,16 @@
# 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
diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb
index 0ed0dd98a59..44b090260e7 100644
--- a/app/models/audit_event.rb
+++ b/app/models/audit_event.rb
@@ -4,9 +4,9 @@
#
# id :integer not null, primary key
# author_id :integer not null
-# type :string(255) not null
+# type :string not null
# entity_id :integer not null
-# entity_type :string(255) not null
+# entity_type :string not null
# details :text
# created_at :datetime
# updated_at :datetime
diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb
index 8a0a8a4c2a9..075ac733bfc 100644
--- a/app/models/broadcast_message.rb
+++ b/app/models/broadcast_message.rb
@@ -8,8 +8,8 @@
# ends_at :datetime
# created_at :datetime
# updated_at :datetime
-# color :string(255)
-# font :string(255)
+# color :string
+# font :string
#
class BroadcastMessage < ActiveRecord::Base
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 553cd447971..4bc3a225e2c 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -4,7 +4,7 @@
#
# id :integer not null, primary key
# project_id :integer
-# status :string(255)
+# status :string
# finished_at :datetime
# trace :text
# created_at :datetime
@@ -15,19 +15,19 @@
# commit_id :integer
# commands :text
# job_id :integer
-# name :string(255)
+# name :string
# deploy :boolean default(FALSE)
# options :text
# allow_failure :boolean default(FALSE), not null
-# stage :string(255)
+# stage :string
# trigger_request_id :integer
# stage_idx :integer
# tag :boolean
-# ref :string(255)
+# ref :string
# user_id :integer
-# type :string(255)
-# target_url :string(255)
-# description :string(255)
+# type :string
+# target_url :string
+# description :string
# artifacts_file :text
# gl_project_id :integer
# artifacts_metadata :text
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index f2667e5476b..4ac4e0fb8b2 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -4,9 +4,9 @@
#
# id :integer not null, primary key
# project_id :integer
-# ref :string(255)
-# sha :string(255)
-# before_sha :string(255)
+# ref :string
+# sha :string
+# before_sha :string
# push_data :text
# created_at :datetime
# updated_at :datetime
@@ -14,6 +14,10 @@
# yaml_errors :text
# committed_at :datetime
# gl_project_id :integer
+# status :string
+# started_at :datetime
+# finished_at :datetime
+# duration :integer
#
module Ci
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index 90349a07594..add59a08892 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -3,18 +3,18 @@
# Table name: ci_runners
#
# id :integer not null, primary key
-# token :string(255)
+# token :string
# created_at :datetime
# updated_at :datetime
-# description :string(255)
+# description :string
# 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)
+# name :string
+# version :string
+# revision :string
+# platform :string
+# architecture :string
#
module Ci
diff --git a/app/models/ci/trigger.rb b/app/models/ci/trigger.rb
index 2b9a457c8ab..4f3f4d79fac 100644
--- a/app/models/ci/trigger.rb
+++ b/app/models/ci/trigger.rb
@@ -3,7 +3,7 @@
# Table name: ci_triggers
#
# id :integer not null, primary key
-# token :string(255)
+# token :string
# project_id :integer
# deleted_at :datetime
# created_at :datetime
diff --git a/app/models/ci/variable.rb b/app/models/ci/variable.rb
index e786bd7dd93..4229fe085a1 100644
--- a/app/models/ci/variable.rb
+++ b/app/models/ci/variable.rb
@@ -4,11 +4,11 @@
#
# id :integer not null, primary key
# project_id :integer
-# key :string(255)
+# key :string
# value :text
# encrypted_value :text
-# encrypted_value_salt :string(255)
-# encrypted_value_iv :string(255)
+# encrypted_value_salt :string
+# encrypted_value_iv :string
# gl_project_id :integer
#
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index aa56314aa16..1260c448de3 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -4,7 +4,7 @@
#
# id :integer not null, primary key
# project_id :integer
-# status :string(255)
+# status :string
# finished_at :datetime
# trace :text
# created_at :datetime
@@ -15,21 +15,24 @@
# commit_id :integer
# commands :text
# job_id :integer
-# name :string(255)
+# name :string
# deploy :boolean default(FALSE)
# options :text
# allow_failure :boolean default(FALSE), not null
-# stage :string(255)
+# stage :string
# trigger_request_id :integer
# stage_idx :integer
# tag :boolean
-# ref :string(255)
+# ref :string
# user_id :integer
-# type :string(255)
-# target_url :string(255)
-# description :string(255)
+# 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
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index d5166e81474..2e4efc4e8d8 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -35,13 +35,14 @@ module Issuable
scope :only_opened, -> { with_state(:opened) }
scope :only_reopened, -> { with_state(:reopened) }
scope :closed, -> { with_state(:closed) }
- scope :order_milestone_due_desc, -> { joins(:milestone).reorder('milestones.due_date DESC, milestones.id DESC') }
- scope :order_milestone_due_asc, -> { joins(:milestone).reorder('milestones.due_date ASC, milestones.id ASC') }
+ scope :order_milestone_due_desc, -> { outer_join_milestone.reorder('milestones.due_date IS NULL ASC, milestones.due_date DESC, milestones.id DESC') }
+ scope :order_milestone_due_asc, -> { outer_join_milestone.reorder('milestones.due_date IS NULL ASC, milestones.due_date ASC, milestones.id ASC') }
scope :without_label, -> { joins("LEFT OUTER JOIN label_links ON label_links.target_type = '#{name}' AND label_links.target_id = #{table_name}.id").where(label_links: { id: nil }) }
scope :join_project, -> { joins(:project) }
scope :references_project, -> { references(:project) }
scope :non_archived, -> { join_project.where(projects: { archived: false }) }
+ scope :outer_join_milestone, -> { joins("LEFT OUTER JOIN milestones ON milestones.id = #{table_name}.milestone_id") }
delegate :name,
:email,
diff --git a/app/models/deploy_key.rb b/app/models/deploy_key.rb
index 9ab663c04ad..43cf625f770 100644
--- a/app/models/deploy_key.rb
+++ b/app/models/deploy_key.rb
@@ -7,9 +7,9 @@
# created_at :datetime
# updated_at :datetime
# key :text
-# title :string(255)
-# type :string(255)
-# fingerprint :string(255)
+# title :string
+# type :string
+# fingerprint :string
# public :boolean default(FALSE), not null
#
diff --git a/app/models/email.rb b/app/models/email.rb
index b323d1edd10..eae2472f337 100644
--- a/app/models/email.rb
+++ b/app/models/email.rb
@@ -4,7 +4,7 @@
#
# id :integer not null, primary key
# user_id :integer not null
-# email :string(255) not null
+# email :string not null
# created_at :datetime
# updated_at :datetime
#
diff --git a/app/models/event.rb b/app/models/event.rb
index 897518aadc7..25c7c3e6dc7 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -3,9 +3,9 @@
# Table name: events
#
# id :integer not null, primary key
-# target_type :string(255)
+# target_type :string
# target_id :integer
-# title :string(255)
+# title :string
# data :text
# project_id :integer
# created_at :datetime
diff --git a/app/models/generic_commit_status.rb b/app/models/generic_commit_status.rb
index 97f4f03a9a5..d4afd8cbe84 100644
--- a/app/models/generic_commit_status.rb
+++ b/app/models/generic_commit_status.rb
@@ -4,7 +4,7 @@
#
# id :integer not null, primary key
# project_id :integer
-# status :string(255)
+# status :string
# finished_at :datetime
# trace :text
# created_at :datetime
@@ -15,21 +15,24 @@
# commit_id :integer
# commands :text
# job_id :integer
-# name :string(255)
+# name :string
# deploy :boolean default(FALSE)
# options :text
# allow_failure :boolean default(FALSE), not null
-# stage :string(255)
+# stage :string
# trigger_request_id :integer
# stage_idx :integer
# tag :boolean
-# ref :string(255)
+# ref :string
# user_id :integer
-# type :string(255)
-# target_url :string(255)
-# description :string(255)
+# 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
diff --git a/app/models/group.rb b/app/models/group.rb
index 1f8432e3320..cff76877958 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -2,16 +2,17 @@
#
# Table name: namespaces
#
-# id :integer not null, primary key
-# name :string(255) not null
-# path :string(255) not null
-# owner_id :integer
-# visibility_level :integer default(20), not null
-# created_at :datetime
-# updated_at :datetime
-# type :string(255)
-# description :string(255) default(""), not null
-# avatar :string(255)
+# 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'
diff --git a/app/models/hooks/project_hook.rb b/app/models/hooks/project_hook.rb
index d149511b868..64f570b12ae 100644
--- a/app/models/hooks/project_hook.rb
+++ b/app/models/hooks/project_hook.rb
@@ -16,7 +16,7 @@
# note_events :boolean default(FALSE), not null
# enable_ssl_verification :boolean default(TRUE)
# build_events :boolean default(FALSE), not null
-# token :string
+# wiki_page_events :boolean default(FALSE), not null
#
class ProjectHook < WebHook
diff --git a/app/models/hooks/service_hook.rb b/app/models/hooks/service_hook.rb
index f45145eeb3a..23f6468ee52 100644
--- a/app/models/hooks/service_hook.rb
+++ b/app/models/hooks/service_hook.rb
@@ -16,7 +16,7 @@
# note_events :boolean default(FALSE), not null
# enable_ssl_verification :boolean default(TRUE)
# build_events :boolean default(FALSE), not null
-# token :string
+# wiki_page_events :boolean default(FALSE), not null
#
class ServiceHook < WebHook
diff --git a/app/models/hooks/system_hook.rb b/app/models/hooks/system_hook.rb
index 012cc8ec005..5e9046f3623 100644
--- a/app/models/hooks/system_hook.rb
+++ b/app/models/hooks/system_hook.rb
@@ -16,7 +16,7 @@
# note_events :boolean default(FALSE), not null
# enable_ssl_verification :boolean default(TRUE)
# build_events :boolean default(FALSE), not null
-# token :string
+# wiki_page_events :boolean default(FALSE), not null
#
class SystemHook < WebHook
diff --git a/app/models/hooks/web_hook.rb b/app/models/hooks/web_hook.rb
index 1e3b4815596..a8f17ac16a6 100644
--- a/app/models/hooks/web_hook.rb
+++ b/app/models/hooks/web_hook.rb
@@ -16,7 +16,7 @@
# note_events :boolean default(FALSE), not null
# enable_ssl_verification :boolean default(TRUE)
# build_events :boolean default(FALSE), not null
-# token :string
+# wiki_page_events :boolean default(FALSE), not null
#
class WebHook < ActiveRecord::Base
diff --git a/app/models/identity.rb b/app/models/identity.rb
index e1915b079d4..ef4d5f99091 100644
--- a/app/models/identity.rb
+++ b/app/models/identity.rb
@@ -3,8 +3,8 @@
# Table name: identities
#
# id :integer not null, primary key
-# extern_uid :string(255)
-# provider :string(255)
+# extern_uid :string
+# provider :string
# user_id :integer
# created_at :datetime
# updated_at :datetime
diff --git a/app/models/issue.rb b/app/models/issue.rb
index ea1bfb776ee..abaa509707c 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -3,20 +3,23 @@
# Table name: issues
#
# id :integer not null, primary key
-# title :string(255)
+# title :string
# assignee_id :integer
# author_id :integer
# project_id :integer
# created_at :datetime
# updated_at :datetime
# position :integer default(0)
-# branch_name :string(255)
+# branch_name :string
# description :text
# milestone_id :integer
-# state :string(255)
+# 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'
diff --git a/app/models/key.rb b/app/models/key.rb
index 0282ad18139..b2b57849f8a 100644
--- a/app/models/key.rb
+++ b/app/models/key.rb
@@ -7,9 +7,9 @@
# created_at :datetime
# updated_at :datetime
# key :text
-# title :string(255)
-# type :string(255)
-# fingerprint :string(255)
+# title :string
+# type :string
+# fingerprint :string
# public :boolean default(FALSE), not null
#
diff --git a/app/models/label.rb b/app/models/label.rb
index 60bdce32952..9a22398d952 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -2,14 +2,14 @@
#
# 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)
-# description :string(255)
+# 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
diff --git a/app/models/label_link.rb b/app/models/label_link.rb
index b94c9c777af..7b8e872b6dd 100644
--- a/app/models/label_link.rb
+++ b/app/models/label_link.rb
@@ -5,7 +5,7 @@
# id :integer not null, primary key
# label_id :integer
# target_id :integer
-# target_type :string(255)
+# target_type :string
# created_at :datetime
# updated_at :datetime
#
diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb
index 86b1b7e2f99..927e764af92 100644
--- a/app/models/lfs_object.rb
+++ b/app/models/lfs_object.rb
@@ -3,11 +3,11 @@
# Table name: lfs_objects
#
# id :integer not null, primary key
-# oid :string(255) not null
+# oid :string not null
# size :integer not null
# created_at :datetime
# updated_at :datetime
-# file :string(255)
+# file :string
#
class LfsObject < ActiveRecord::Base
diff --git a/app/models/member.rb b/app/models/member.rb
index 60efafef211..cca82da89f1 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -5,15 +5,15 @@
# id :integer not null, primary key
# access_level :integer not null
# source_id :integer not null
-# source_type :string(255) not null
+# source_type :string not null
# user_id :integer
# notification_level :integer not null
-# type :string(255)
+# type :string
# created_at :datetime
# updated_at :datetime
# created_by_id :integer
-# invite_email :string(255)
-# invite_token :string(255)
+# invite_email :string
+# invite_token :string
# invite_accepted_at :datetime
#
diff --git a/app/models/members/group_member.rb b/app/models/members/group_member.rb
index 9fb474a1a93..a48c1943e6f 100644
--- a/app/models/members/group_member.rb
+++ b/app/models/members/group_member.rb
@@ -5,15 +5,15 @@
# id :integer not null, primary key
# access_level :integer not null
# source_id :integer not null
-# source_type :string(255) not null
+# source_type :string not null
# user_id :integer
# notification_level :integer not null
-# type :string(255)
+# type :string
# created_at :datetime
# updated_at :datetime
# created_by_id :integer
-# invite_email :string(255)
-# invite_token :string(255)
+# invite_email :string
+# invite_token :string
# invite_accepted_at :datetime
#
diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb
index 07ddb02ae9d..143350a0b55 100644
--- a/app/models/members/project_member.rb
+++ b/app/models/members/project_member.rb
@@ -5,15 +5,15 @@
# id :integer not null, primary key
# access_level :integer not null
# source_id :integer not null
-# source_type :string(255) not null
+# source_type :string not null
# user_id :integer
# notification_level :integer not null
-# type :string(255)
+# type :string
# created_at :datetime
# updated_at :datetime
# created_by_id :integer
-# invite_email :string(255)
-# invite_token :string(255)
+# invite_email :string
+# invite_token :string
# invite_accepted_at :datetime
#
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index d00919c3b0c..4175e1e5fba 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -3,28 +3,29 @@
# Table name: merge_requests
#
# id :integer not null, primary key
-# target_branch :string(255) not null
-# source_branch :string(255) not null
+# target_branch :string not null
+# source_branch :string not null
# source_project_id :integer not null
# author_id :integer
# assignee_id :integer
-# title :string(255)
+# title :string
# created_at :datetime
# updated_at :datetime
# milestone_id :integer
-# state :string(255)
-# merge_status :string(255)
+# 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(255)
+# 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
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index 0580cafdd1b..8951e92a0b8 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -3,12 +3,14 @@
# Table name: merge_request_diffs
#
# id :integer not null, primary key
-# state :string(255)
+# 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
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index 986184dd301..5ee8a965ad8 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -3,13 +3,13 @@
# Table name: milestones
#
# id :integer not null, primary key
-# title :string(255) not null
+# title :string not null
# project_id :integer not null
# description :text
# due_date :date
# created_at :datetime
# updated_at :datetime
-# state :string(255)
+# state :string
# iid :integer
#
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 55842df1e2d..741e912171d 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -2,15 +2,17 @@
#
# 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)
+# 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
diff --git a/app/models/note.rb b/app/models/note.rb
index 71b4293d57a..deee2b9e885 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -4,14 +4,14 @@
#
# id :integer not null, primary key
# note :text
-# noteable_type :string(255)
+# noteable_type :string
# author_id :integer
# created_at :datetime
# updated_at :datetime
# project_id :integer
-# attachment :string(255)
-# line_code :string(255)
-# commit_id :string(255)
+# attachment :string
+# line_code :string
+# commit_id :string
# noteable_id :integer
# system :boolean default(FALSE), not null
# st_diff :text
diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb
index 5001738f411..846773752a6 100644
--- a/app/models/notification_setting.rb
+++ b/app/models/notification_setting.rb
@@ -1,3 +1,16 @@
+# == 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/personal_snippet.rb b/app/models/personal_snippet.rb
index 452f3913eef..1d5f4c50254 100644
--- a/app/models/personal_snippet.rb
+++ b/app/models/personal_snippet.rb
@@ -3,14 +3,14 @@
# Table name: snippets
#
# id :integer not null, primary key
-# title :string(255)
+# title :string
# content :text
# author_id :integer not null
# project_id :integer
# created_at :datetime
# updated_at :datetime
-# file_name :string(255)
-# type :string(255)
+# file_name :string
+# type :string
# visibility_level :integer default(0), not null
#
diff --git a/app/models/project.rb b/app/models/project.rb
index af62e8ecd90..9403acf7759 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -2,41 +2,46 @@
#
# 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
-# pending_delete :boolean
+# 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'
diff --git a/app/models/project_group_link.rb b/app/models/project_group_link.rb
index e52a6bd7c84..66f5a609bf5 100644
--- a/app/models/project_group_link.rb
+++ b/app/models/project_group_link.rb
@@ -1,3 +1,15 @@
+# == 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 2c0ae312f1b..3f0080205dd 100644
--- a/app/models/project_import_data.rb
+++ b/app/models/project_import_data.rb
@@ -2,9 +2,12 @@
#
# Table name: project_import_data
#
-# id :integer not null, primary key
-# project_id :integer
-# data :text
+# id :integer not null, primary key
+# project_id :integer
+# data :text
+# encrypted_credentials :text
+# encrypted_credentials_iv :text
+# encrypted_credentials_salt :text
#
require 'carrierwave/orm/activerecord'
diff --git a/app/models/project_services/asana_service.rb b/app/models/project_services/asana_service.rb
index 792ad804575..368485a060a 100644
--- a/app/models/project_services/asana_service.rb
+++ b/app/models/project_services/asana_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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'
diff --git a/app/models/project_services/assembla_service.rb b/app/models/project_services/assembla_service.rb
index 29d841faed8..ffb7455b014 100644
--- a/app/models/project_services/assembla_service.rb
+++ b/app/models/project_services/assembla_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/bamboo_service.rb b/app/models/project_services/bamboo_service.rb
index 060062aaf7a..c36ee95e378 100644
--- a/app/models/project_services/bamboo_service.rb
+++ b/app/models/project_services/bamboo_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/buildkite_service.rb b/app/models/project_services/buildkite_service.rb
index 861cc974ec4..f9f4897a065 100644
--- a/app/models/project_services/buildkite_service.rb
+++ b/app/models/project_services/buildkite_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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"
diff --git a/app/models/project_services/builds_email_service.rb b/app/models/project_services/builds_email_service.rb
index 6ab6d7417b7..20cdfcaffb2 100644
--- a/app/models/project_services/builds_email_service.rb
+++ b/app/models/project_services/builds_email_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/campfire_service.rb b/app/models/project_services/campfire_service.rb
index 6e8f0842524..28c969fe57f 100644
--- a/app/models/project_services/campfire_service.rb
+++ b/app/models/project_services/campfire_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/ci_service.rb b/app/models/project_services/ci_service.rb
index d9f0849d147..9bc8f982da6 100644
--- a/app/models/project_services/ci_service.rb
+++ b/app/models/project_services/ci_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/custom_issue_tracker_service.rb b/app/models/project_services/custom_issue_tracker_service.rb
index 88a3e9218cb..4d1319eb6f8 100644
--- a/app/models/project_services/custom_issue_tracker_service.rb
+++ b/app/models/project_services/custom_issue_tracker_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/drone_ci_service.rb b/app/models/project_services/drone_ci_service.rb
index b4724bb647e..d8e00e018cc 100644
--- a/app/models/project_services/drone_ci_service.rb
+++ b/app/models/project_services/drone_ci_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/emails_on_push_service.rb b/app/models/project_services/emails_on_push_service.rb
index b831577cd97..2dbd29062df 100644
--- a/app/models/project_services/emails_on_push_service.rb
+++ b/app/models/project_services/emails_on_push_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/external_wiki_service.rb b/app/models/project_services/external_wiki_service.rb
index b402b68665a..5469049bb5e 100644
--- a/app/models/project_services/external_wiki_service.rb
+++ b/app/models/project_services/external_wiki_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/flowdock_service.rb b/app/models/project_services/flowdock_service.rb
index 8605ce66e48..3dc1e0fbe8b 100644
--- a/app/models/project_services/flowdock_service.rb
+++ b/app/models/project_services/flowdock_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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"
diff --git a/app/models/project_services/gemnasium_service.rb b/app/models/project_services/gemnasium_service.rb
index 61babe9cfe5..b4c311cf664 100644
--- a/app/models/project_services/gemnasium_service.rb
+++ b/app/models/project_services/gemnasium_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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"
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb
index 33f0d7ea01a..a92f7226083 100644
--- a/app/models/project_services/gitlab_ci_service.rb
+++ b/app/models/project_services/gitlab_ci_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/gitlab_issue_tracker_service.rb b/app/models/project_services/gitlab_issue_tracker_service.rb
index eaa5654b9c6..1adaeeb3b2b 100644
--- a/app/models/project_services/gitlab_issue_tracker_service.rb
+++ b/app/models/project_services/gitlab_issue_tracker_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb
index 064ef8e8674..f9ddf588722 100644
--- a/app/models/project_services/hipchat_service.rb
+++ b/app/models/project_services/hipchat_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/irker_service.rb b/app/models/project_services/irker_service.rb
index 04c714bfaad..b9a592d7096 100644
--- a/app/models/project_services/irker_service.rb
+++ b/app/models/project_services/irker_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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'
diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb
index c5501e06411..98a3a7c6b86 100644
--- a/app/models/project_services/issue_tracker_service.rb
+++ b/app/models/project_services/issue_tracker_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb
index b4418ba9284..ba68658f0bd 100644
--- a/app/models/project_services/jira_service.rb
+++ b/app/models/project_services/jira_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/pivotaltracker_service.rb b/app/models/project_services/pivotaltracker_service.rb
index c9a890c7e3f..acaa0c39365 100644
--- a/app/models/project_services/pivotaltracker_service.rb
+++ b/app/models/project_services/pivotaltracker_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/pushover_service.rb b/app/models/project_services/pushover_service.rb
index e76d9eca2ab..a640c8cb440 100644
--- a/app/models/project_services/pushover_service.rb
+++ b/app/models/project_services/pushover_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/redmine_service.rb b/app/models/project_services/redmine_service.rb
index de974354c77..e2137e92c62 100644
--- a/app/models/project_services/redmine_service.rb
+++ b/app/models/project_services/redmine_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb
index 7092b757549..83ffa53a407 100644
--- a/app/models/project_services/slack_service.rb
+++ b/app/models/project_services/slack_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_services/teamcity_service.rb b/app/models/project_services/teamcity_service.rb
index 8dceee5e2c5..4015da31509 100644
--- a/app/models/project_services/teamcity_service.rb
+++ b/app/models/project_services/teamcity_service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/project_snippet.rb b/app/models/project_snippet.rb
index d48f0546159..b4b2807eba4 100644
--- a/app/models/project_snippet.rb
+++ b/app/models/project_snippet.rb
@@ -3,14 +3,14 @@
# Table name: snippets
#
# id :integer not null, primary key
-# title :string(255)
+# title :string
# content :text
# author_id :integer not null
# project_id :integer
# created_at :datetime
# updated_at :datetime
-# file_name :string(255)
-# type :string(255)
+# file_name :string
+# type :string
# visibility_level :integer default(0), not null
#
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb
index 8ebd790a89e..3d2052c892c 100644
--- a/app/models/protected_branch.rb
+++ b/app/models/protected_branch.rb
@@ -4,7 +4,7 @@
#
# id :integer not null, primary key
# project_id :integer not null
-# name :string(255) not null
+# name :string not null
# created_at :datetime
# updated_at :datetime
# developers_can_push :boolean default(FALSE), not null
diff --git a/app/models/release.rb b/app/models/release.rb
index 89f70278af5..dc700d1ea5a 100644
--- a/app/models/release.rb
+++ b/app/models/release.rb
@@ -3,7 +3,7 @@
# Table name: releases
#
# id :integer not null, primary key
-# tag :string(255)
+# tag :string
# description :text
# project_id :integer
# created_at :datetime
diff --git a/app/models/security_event.rb b/app/models/security_event.rb
index 68c00adad59..0bee03974f1 100644
--- a/app/models/security_event.rb
+++ b/app/models/security_event.rb
@@ -4,9 +4,9 @@
#
# id :integer not null, primary key
# author_id :integer not null
-# type :string(255) not null
+# type :string not null
# entity_id :integer not null
-# entity_type :string(255) not null
+# entity_type :string not null
# details :text
# created_at :datetime
# updated_at :datetime
diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb
index 77115597d71..99279a2e083 100644
--- a/app/models/sent_notification.rb
+++ b/app/models/sent_notification.rb
@@ -5,11 +5,11 @@
# id :integer not null, primary key
# project_id :integer
# noteable_id :integer
-# noteable_type :string(255)
+# noteable_type :string
# recipient_id :integer
-# commit_id :string(255)
-# line_code :string(255)
-# reply_key :string(255) not null
+# commit_id :string
+# reply_key :string not null
+# line_code :string
#
class SentNotification < ActiveRecord::Base
diff --git a/app/models/service.rb b/app/models/service.rb
index 2645b8321d7..bf16a545307 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -3,12 +3,12 @@
# Table name: services
#
# id :integer not null, primary key
-# type :string(255)
-# title :string(255)
+# type :string
+# title :string
# project_id :integer
-# created_at :datetime
-# updated_at :datetime
-# active :boolean default(FALSE), not null
+# 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)
@@ -17,6 +17,9 @@
# 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
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 0fd08061925..2f905a90942 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -3,14 +3,14 @@
# Table name: snippets
#
# id :integer not null, primary key
-# title :string(255)
+# title :string
# content :text
# author_id :integer not null
# project_id :integer
# created_at :datetime
# updated_at :datetime
-# file_name :string(255)
-# type :string(255)
+# file_name :string
+# type :string
# visibility_level :integer default(0), not null
#
diff --git a/app/models/spam_log.rb b/app/models/spam_log.rb
index 12df68ef83b..f49eb7d88e2 100644
--- a/app/models/spam_log.rb
+++ b/app/models/spam_log.rb
@@ -1,3 +1,20 @@
+# == 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 dd800ce110f..242faa7d32e 100644
--- a/app/models/subscription.rb
+++ b/app/models/subscription.rb
@@ -5,7 +5,7 @@
# id :integer not null, primary key
# user_id :integer
# subscribable_id :integer
-# subscribable_type :string(255)
+# subscribable_type :string
# subscribed :boolean
# created_at :datetime
# updated_at :datetime
diff --git a/app/models/user.rb b/app/models/user.rb
index ab48f8f1960..959b1f93758 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -3,55 +3,55 @@
# 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)
+# 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(255)
-# last_sign_in_ip :string(255)
+# current_sign_in_ip :string
+# last_sign_in_ip :string
# created_at :datetime
# updated_at :datetime
-# name :string(255)
+# name :string
# 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)
+# 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(255)
+# bio :string
# failed_attempts :integer default(0)
# locked_at :datetime
-# username :string(255)
+# username :string
# can_create_group :boolean default(TRUE), not null
# can_create_team :boolean default(TRUE), not null
-# state :string(255)
+# 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(255)
-# confirmation_token :string(255)
+# avatar :string
+# confirmation_token :string
# confirmed_at :datetime
# confirmation_sent_at :datetime
-# unconfirmed_email :string(255)
+# unconfirmed_email :string
# hide_no_ssh_key :boolean default(FALSE)
-# website_url :string(255) default(""), not null
-# notification_email :string(255)
+# website_url :string default(""), not null
+# notification_email :string
# 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)
+# 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(255) default(""), not null
+# public_email :string default(""), not null
# dashboard :integer default(0)
# project_view :integer default(0)
# consumed_timestep :integer
@@ -59,7 +59,8 @@
# hide_project_limit :boolean default(FALSE)
# unlock_token :string
# otp_grace_period_started_at :datetime
-# external :boolean default(FALSE)
+# ldap_email :boolean default(FALSE), not null
+# external :boolean default(FALSE)
#
require 'carrierwave/orm/activerecord'
diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb
index 82e7090f1ea..e61628086f0 100644
--- a/app/services/issues/move_service.rb
+++ b/app/services/issues/move_service.rb
@@ -41,14 +41,25 @@ module Issues
private
def create_new_issue
- new_params = { id: nil, iid: nil, label_ids: [], milestone: nil,
+ new_params = { id: nil, iid: nil, label_ids: cloneable_label_ids,
+ milestone_id: cloneable_milestone_id,
project: @new_project, author: @old_issue.author,
description: rewrite_content(@old_issue.description) }
- new_params = @old_issue.serializable_hash.merge(new_params)
+ new_params = @old_issue.serializable_hash.symbolize_keys.merge(new_params)
CreateService.new(@new_project, @current_user, new_params).execute
end
+ def cloneable_label_ids
+ @new_project.labels
+ .where(title: @old_issue.labels.pluck(:title)).pluck(:id)
+ end
+
+ def cloneable_milestone_id
+ @new_project.milestones
+ .find_by(title: @old_issue.milestone.try(:title)).try(:id)
+ end
+
def rewrite_notes
@old_issue.notes.find_each do |note|
new_note = note.dup
diff --git a/doc/install/requirements.md b/doc/install/requirements.md
index 58f409746cd..df8e8bdc476 100644
--- a/doc/install/requirements.md
+++ b/doc/install/requirements.md
@@ -64,7 +64,10 @@ If you have enough RAM memory and a recent CPU the speed of GitLab is mainly lim
### Memory
You need at least 2GB of addressable memory (RAM + swap) to install and use GitLab!
-With less memory GitLab will give strange errors during the reconfigure run and 500 errors during usage.
+The operating system and any other running applications will also be using memory
+so keep in mind that you need at least 2GB available before running GitLab. With
+less memory GitLab will give strange errors during the reconfigure run and 500
+errors during usage.
- 512MB RAM + 1.5GB of swap is the absolute minimum but we strongly **advise against** this amount of memory. See the unicorn worker section below for more advice.
- 1GB RAM + 1GB swap supports up to 100 users but it will be very slow
@@ -77,6 +80,10 @@ With less memory GitLab will give strange errors during the reconfigure run and
- 128GB RAM supports up to 32,000 users
- More users? Run it on [multiple application servers](https://about.gitlab.com/high-availability/)
+We recommend having at least 1GB of swap on your server, even if you currently have
+enough available RAM. Having swap will help reduce the chance of errors occuring
+if your available memory changes.
+
Notice: The 25 workers of Sidekiq will show up as separate processes in your process overview (such as top or htop) but they share the same RAM allocation since Sidekiq is a multithreaded application. Please see the section below about Unicorn workers for information about many you need of those.
## Gitlab Runner
diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake
new file mode 100644
index 00000000000..16bad4bd2bd
--- /dev/null
+++ b/lib/tasks/auto_annotate_models.rake
@@ -0,0 +1,44 @@
+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/spec/features/issues_spec.rb b/spec/features/issues_spec.rb
index b57131f68d5..d5755c293c5 100644
--- a/spec/features/issues_spec.rb
+++ b/spec/features/issues_spec.rb
@@ -264,12 +264,14 @@ describe 'Issues', feature: true do
visit namespace_project_issues_path(project.namespace, project, sort: sort_value_milestone_soon)
expect(first_issue).to include('foo')
+ expect(last_issue).to include('baz')
end
it 'sorts by least recently due milestone' do
visit namespace_project_issues_path(project.namespace, project, sort: sort_value_milestone_later)
expect(first_issue).to include('bar')
+ expect(last_issue).to include('baz')
end
end
diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb
index 2a5e4ac3ec4..c15e26189a5 100644
--- a/spec/services/issues/move_service_spec.rb
+++ b/spec/services/issues/move_service_spec.rb
@@ -7,10 +7,11 @@ describe Issues::MoveService, services: true do
let(:description) { 'Some issue description' }
let(:old_project) { create(:project) }
let(:new_project) { create(:project) }
+ let(:milestone1) { create(:milestone, project_id: old_project.id, title: 'v9.0') }
let(:old_issue) do
create(:issue, title: title, description: description,
- project: old_project, author: author)
+ project: old_project, author: author, milestone: milestone1)
end
let(:move_service) do
@@ -21,11 +22,24 @@ describe Issues::MoveService, services: true do
before do
old_project.team << [user, :reporter]
new_project.team << [user, :reporter]
+
+ ['label1', 'label2'].each do |label|
+ old_issue.labels << create(:label,
+ project_id: old_project.id,
+ title: label)
+ end
+
+ new_project.labels << create(:label, title: 'label1')
+ new_project.labels << create(:label, title: 'label2')
end
end
describe '#execute' do
shared_context 'issue move executed' do
+ let!(:milestone2) do
+ create(:milestone, project_id: new_project.id, title: 'v9.0')
+ end
+
let!(:new_issue) { move_service.execute(old_issue, new_project) }
end
@@ -39,6 +53,23 @@ describe Issues::MoveService, services: true do
expect(new_issue.project).to eq new_project
end
+ it 'assigns milestone to new issue' do
+ expect(new_issue.reload.milestone.title).to eq 'v9.0'
+ expect(new_issue.reload.milestone).to eq(milestone2)
+ end
+
+ it 'assign labels to new issue' do
+ expected_label_titles = new_issue.reload.labels.map(&:title)
+ expect(expected_label_titles).to include 'label1'
+ expect(expected_label_titles).to include 'label2'
+ expect(expected_label_titles.size).to eq 2
+
+ new_issue.labels.each do |label|
+ expect(new_project.labels).to include(label)
+ expect(old_project.labels).not_to include(label)
+ end
+ end
+
it 'rewrites issue title' do
expect(new_issue.title).to eq title
end
@@ -72,11 +103,6 @@ describe Issues::MoveService, services: true do
expect(new_issue.author).to eq author
end
- it 'removes data that is invalid in new context' do
- expect(new_issue.milestone).to be_nil
- expect(new_issue.labels).to be_empty
- end
-
it 'creates a new internal id for issue' do
expect(new_issue.iid).to be 1
end