Commit a3bb9ca1 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Feature: Unassigned Merge Requests

parent 80f2ef2d
......@@ -22,7 +22,6 @@ class MergeRequest < ActiveRecord::Base
:should_remove_source_branch
validates_presence_of :project_id
validates_presence_of :assignee_id
validates_presence_of :author_id
validates_presence_of :source_branch
validates_presence_of :target_branch
......@@ -36,6 +35,7 @@ class MergeRequest < ActiveRecord::Base
delegate :name,
:email,
:to => :assignee,
:allow_nil => true,
:prefix => true
validates :title,
......
......@@ -43,7 +43,7 @@ class MailerObserver < ActiveRecord::Observer
end
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
end
end
......
......@@ -5,7 +5,8 @@
- @merge_request.errors.full_messages.each do |msg|
%li= msg
%h3.padded.cgray 1. Select Branches
%h4.cdark 1. Select Branches
%br
.row
.span6
......@@ -30,14 +31,21 @@
.bottom_commit
.mr_target_commit
%h3.padded.cgray 2. Fill info
%h4.cdark 2. Fill info
.clearfix
= f.label :assignee_id, "Assign to", :class => "control-label"
.controls= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px")
.main_box
.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
= f.label :title, :class => "control-label"
.controls= f.text_field :title, :class => "input-xxlarge pad", :maxlength => 255, :rows => 5
.form-actions
= f.submit 'Save', :class => "btn-primary btn"
......
%h3
%h3.page_title
= "Edit merge request #{@merge_request.id}"
%hr
= render 'form'
%h3 New Merge Request
%h3.page_title New Merge Request
%hr
= render 'form'
......@@ -13,6 +13,7 @@
= image_tag gravatar_icon(@merge_request.author_email), :width => 16, :class => "lil_av"
%strong.author= link_to_merge_request_author(@merge_request)
- if @merge_request.assignee
%cite.cgray and currently assigned to
= image_tag gravatar_icon(@merge_request.assignee_email), :width => 16, :class => "lil_av"
%strong.author= link_to_merge_request_assignee(@merge_request)
......
......@@ -13,7 +13,6 @@ describe MergeRequest do
it { should validate_presence_of(:title) }
it { should validate_presence_of(:author_id) }
it { should validate_presence_of(:project_id) }
it { should validate_presence_of(:assignee_id) }
end
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