Commit a3bb9ca1fa2e6c3e6a75d416e09cbdcb61fcd1e0
1 parent
80f2ef2d
Exists in
master
and in
4 other branches
Feature: Unassigned Merge Requests
Showing
7 changed files
with
22 additions
and
14 deletions
Show diff stats
app/models/merge_request.rb
| ... | ... | @@ -22,7 +22,6 @@ class MergeRequest < ActiveRecord::Base |
| 22 | 22 | :should_remove_source_branch |
| 23 | 23 | |
| 24 | 24 | validates_presence_of :project_id |
| 25 | - validates_presence_of :assignee_id | |
| 26 | 25 | validates_presence_of :author_id |
| 27 | 26 | validates_presence_of :source_branch |
| 28 | 27 | validates_presence_of :target_branch |
| ... | ... | @@ -36,6 +35,7 @@ class MergeRequest < ActiveRecord::Base |
| 36 | 35 | delegate :name, |
| 37 | 36 | :email, |
| 38 | 37 | :to => :assignee, |
| 38 | + :allow_nil => true, | |
| 39 | 39 | :prefix => true |
| 40 | 40 | |
| 41 | 41 | validates :title, | ... | ... |
app/observers/mailer_observer.rb
| ... | ... | @@ -43,7 +43,7 @@ class MailerObserver < ActiveRecord::Observer |
| 43 | 43 | end |
| 44 | 44 | |
| 45 | 45 | def new_merge_request(merge_request) |
| 46 | - if merge_request.assignee != current_user | |
| 46 | + if merge_request.assignee && merge_request.assignee != current_user | |
| 47 | 47 | Notify.new_merge_request_email(merge_request.id).deliver |
| 48 | 48 | end |
| 49 | 49 | end | ... | ... |
app/views/merge_requests/_form.html.haml
| ... | ... | @@ -5,7 +5,8 @@ |
| 5 | 5 | - @merge_request.errors.full_messages.each do |msg| |
| 6 | 6 | %li= msg |
| 7 | 7 | |
| 8 | - %h3.padded.cgray 1. Select Branches | |
| 8 | + %h4.cdark 1. Select Branches | |
| 9 | + %br | |
| 9 | 10 | |
| 10 | 11 | .row |
| 11 | 12 | .span6 |
| ... | ... | @@ -30,14 +31,21 @@ |
| 30 | 31 | .bottom_commit |
| 31 | 32 | .mr_target_commit |
| 32 | 33 | |
| 33 | - %h3.padded.cgray 2. Fill info | |
| 34 | + %h4.cdark 2. Fill info | |
| 35 | + | |
| 34 | 36 | .clearfix |
| 35 | - = f.label :assignee_id, "Assign to", :class => "control-label" | |
| 36 | - .controls= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px") | |
| 37 | + .main_box | |
| 38 | + .top_box_content | |
| 39 | + = f.label :title do | |
| 40 | + %strong= "Title *" | |
| 41 | + .input= f.text_field :title, :class => "input-xxlarge pad", :maxlength => 255, :rows => 5 | |
| 42 | + .middle_box_content | |
| 43 | + = f.label :assignee_id do | |
| 44 | + %i.icon-user | |
| 45 | + Assign to | |
| 46 | + .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px") | |
| 37 | 47 | |
| 38 | 48 | .control-group |
| 39 | - = f.label :title, :class => "control-label" | |
| 40 | - .controls= f.text_field :title, :class => "input-xxlarge pad", :maxlength => 255, :rows => 5 | |
| 41 | 49 | |
| 42 | 50 | .form-actions |
| 43 | 51 | = f.submit 'Save', :class => "btn-primary btn" | ... | ... |
app/views/merge_requests/edit.html.haml
app/views/merge_requests/new.html.haml
app/views/merge_requests/show/_mr_box.html.haml
| ... | ... | @@ -13,9 +13,10 @@ |
| 13 | 13 | = image_tag gravatar_icon(@merge_request.author_email), :width => 16, :class => "lil_av" |
| 14 | 14 | %strong.author= link_to_merge_request_author(@merge_request) |
| 15 | 15 | |
| 16 | - %cite.cgray and currently assigned to | |
| 17 | - = image_tag gravatar_icon(@merge_request.assignee_email), :width => 16, :class => "lil_av" | |
| 18 | - %strong.author= link_to_merge_request_assignee(@merge_request) | |
| 16 | + - if @merge_request.assignee | |
| 17 | + %cite.cgray and currently assigned to | |
| 18 | + = image_tag gravatar_icon(@merge_request.assignee_email), :width => 16, :class => "lil_av" | |
| 19 | + %strong.author= link_to_merge_request_assignee(@merge_request) | |
| 19 | 20 | |
| 20 | 21 | |
| 21 | 22 | - if @merge_request.closed | ... | ... |
spec/models/merge_request_spec.rb
| ... | ... | @@ -13,7 +13,6 @@ describe MergeRequest do |
| 13 | 13 | it { should validate_presence_of(:title) } |
| 14 | 14 | it { should validate_presence_of(:author_id) } |
| 15 | 15 | it { should validate_presence_of(:project_id) } |
| 16 | - it { should validate_presence_of(:assignee_id) } | |
| 17 | 16 | end |
| 18 | 17 | |
| 19 | 18 | describe "Scope" do | ... | ... |