Add Milestone information in Merge Requests

Step 1:
* Add milestone_id in the model for merge_requests
* Make it possible to create or update a Merge Request with an attached
  Milestone detail
* Add the possibility to filter by Milestone and / or Assignee in the
  Merge Requests listing page
This commit is contained in:
Sergio Visinoni 2012-10-26 14:52:10 +02:00
parent 4f687aaa8e
commit a7d0816933
8 changed files with 93 additions and 22 deletions

View file

@ -4,11 +4,13 @@ class MergeRequest < ActiveRecord::Base
include IssueCommonality
include Votes
attr_accessible :title, :assignee_id, :closed, :target_branch, :source_branch,
attr_accessible :title, :assignee_id, :closed, :target_branch, :source_branch, :milestone_id,
:author_id_of_changes
attr_accessor :should_remove_source_branch
belongs_to :milestone
BROKEN_DIFF = "--broken-diff"
UNCHECKED = 1
@ -26,6 +28,10 @@ class MergeRequest < ActiveRecord::Base
where("source_branch LIKE :branch OR target_branch LIKE :branch", branch: branch_name)
end
def self.find_all_by_milestone(milestone)
where("milestone_id = :milestone_id", milestone_id: milestone)
end
def human_state
states = {
CAN_BE_MERGED => "can_be_merged",
@ -212,5 +218,6 @@ end
# st_diffs :text(4294967295
# merged :boolean default(FALSE), not null
# state :integer default(1), not null
# milestone_id :integer
#