Commit a3bb9ca1 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Feature: Unassigned Merge Requests

parent 80f2ef2d
...@@ -22,7 +22,6 @@ class MergeRequest < ActiveRecord::Base ...@@ -22,7 +22,6 @@ class MergeRequest < ActiveRecord::Base
:should_remove_source_branch :should_remove_source_branch
validates_presence_of :project_id validates_presence_of :project_id
validates_presence_of :assignee_id
validates_presence_of :author_id validates_presence_of :author_id
validates_presence_of :source_branch validates_presence_of :source_branch
validates_presence_of :target_branch validates_presence_of :target_branch
...@@ -36,6 +35,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -36,6 +35,7 @@ class MergeRequest < ActiveRecord::Base
delegate :name, delegate :name,
:email, :email,
:to => :assignee, :to => :assignee,
:allow_nil => true,
:prefix => true :prefix => true
validates :title, validates :title,
......
...@@ -43,7 +43,7 @@ class MailerObserver < ActiveRecord::Observer ...@@ -43,7 +43,7 @@ class MailerObserver < ActiveRecord::Observer
end end
def new_merge_request(merge_request) def new_merge_request(merge_request)
if merge_request.assignee != current_user if merge_request.assignee && merge_request.assignee != current_user
Notify.new_merge_request_email(merge_request.id).deliver Notify.new_merge_request_email(merge_request.id).deliver
end end
end end
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
- @merge_request.errors.full_messages.each do |msg| - @merge_request.errors.full_messages.each do |msg|
%li= msg %li= msg
%h3.padded.cgray 1. Select Branches %h4.cdark 1. Select Branches
%br
.row .row
.span6 .span6
...@@ -30,14 +31,21 @@ ...@@ -30,14 +31,21 @@
.bottom_commit .bottom_commit
.mr_target_commit .mr_target_commit
%h3.padded.cgray 2. Fill info %h4.cdark 2. Fill info
.clearfix .clearfix
= f.label :assignee_id, "Assign to", :class => "control-label" .main_box
.controls= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px") .top_box_content
= f.label :title do
%strong= "Title *"
.input= f.text_field :title, :class => "input-xxlarge pad", :maxlength => 255, :rows => 5
.middle_box_content
= f.label :assignee_id do
%i.icon-user
Assign to
.input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px")
.control-group .control-group
= f.label :title, :class => "control-label"
.controls= f.text_field :title, :class => "input-xxlarge pad", :maxlength => 255, :rows => 5
.form-actions .form-actions
= f.submit 'Save', :class => "btn-primary btn" = f.submit 'Save', :class => "btn-primary btn"
......
%h3 %h3.page_title
= "Edit merge request #{@merge_request.id}" = "Edit merge request #{@merge_request.id}"
%hr %hr
= render 'form' = render 'form'
%h3 New Merge Request %h3.page_title New Merge Request
%hr %hr
= render 'form' = render 'form'
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
= image_tag gravatar_icon(@merge_request.author_email), :width => 16, :class => "lil_av" = image_tag gravatar_icon(@merge_request.author_email), :width => 16, :class => "lil_av"
%strong.author= link_to_merge_request_author(@merge_request) %strong.author= link_to_merge_request_author(@merge_request)
%cite.cgray and currently assigned to - if @merge_request.assignee
= image_tag gravatar_icon(@merge_request.assignee_email), :width => 16, :class => "lil_av" %cite.cgray and currently assigned to
%strong.author= link_to_merge_request_assignee(@merge_request) = image_tag gravatar_icon(@merge_request.assignee_email), :width => 16, :class => "lil_av"
%strong.author= link_to_merge_request_assignee(@merge_request)
- if @merge_request.closed - if @merge_request.closed
......
...@@ -13,7 +13,6 @@ describe MergeRequest do ...@@ -13,7 +13,6 @@ describe MergeRequest do
it { should validate_presence_of(:title) } it { should validate_presence_of(:title) }
it { should validate_presence_of(:author_id) } it { should validate_presence_of(:author_id) }
it { should validate_presence_of(:project_id) } it { should validate_presence_of(:project_id) }
it { should validate_presence_of(:assignee_id) }
end end
describe "Scope" do describe "Scope" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment