diff options
author | Drew Blessing <drew.blessing@me.com> | 2014-04-15 05:12:07 +0400 |
---|---|---|
committer | Drew Blessing <drew.blessing@me.com> | 2014-05-13 15:41:36 +0400 |
commit | 5f25cdfe19c7c0a8c1ada592307e9017e2a754e1 (patch) | |
tree | 82e2dde5c25c8dc9b6fa56dc1f2440910b2c1412 /app/models | |
parent | 172ad9624599647df5682f7f2a9d2d74d947d068 (diff) |
Implement Merge Request Labels
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/merge_request.rb | 7 | ||||
-rw-r--r-- | app/models/project.rb | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 8c885b70a48..a55f3a61398 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -36,7 +36,9 @@ class MergeRequest < ActiveRecord::Base delegate :commits, :diffs, :last_commit, :last_commit_short_sha, to: :merge_request_diff, prefix: nil - attr_accessible :title, :assignee_id, :source_project_id, :source_branch, :target_project_id, :target_branch, :milestone_id, :state_event, :description + attr_accessible :title, :assignee_id, :source_project_id, :source_branch, + :target_project_id, :target_branch, :milestone_id, + :state_event, :description, :label_list attr_accessor :should_remove_source_branch @@ -44,6 +46,9 @@ class MergeRequest < ActiveRecord::Base # It allows us to close or modify broken merge requests attr_accessor :allow_broken + ActsAsTaggableOn.strict_case_match = true + acts_as_taggable_on :labels + state_machine :state, initial: :opened do event :close do transition [:reopened, :opened] => :closed diff --git a/app/models/project.rb b/app/models/project.rb index 7ddcc73cf2a..45e950f4807 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -281,8 +281,11 @@ class Project < ActiveRecord::Base self.id end + # Tags are shared by issues and merge requests def issues_labels - @issues_labels ||= (issues_default_labels + issues.tags_on(:labels)).uniq.sort_by(&:name) + @issues_labels ||= (issues_default_labels + + merge_requests.tags_on(:labels) + + issues.tags_on(:labels)).uniq.sort_by(&:name) end def issue_exists?(issue_id) |