diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-01-22 22:22:20 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-01-22 22:22:20 +0400 |
commit | 4b3afe2325e063943bdec123154a576f6a300bce (patch) | |
tree | c5d75c49d15cd08b4709ec5ac9499b7b4e131316 /app | |
parent | 94865a607b6189b29457d4afc02704c43e1ec0c2 (diff) |
Always create merge_request_diff if MR created
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 1 | ||||
-rw-r--r-- | app/models/merge_request.rb | 2 | ||||
-rw-r--r-- | app/observers/merge_request_observer.rb | 1 |
3 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 0c7a44274e3..baaa3c7ba0b 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -76,7 +76,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request.author = current_user @target_branches ||= [] if @merge_request.save - @merge_request.reload_code redirect_to [@merge_request.target_project, @merge_request], notice: 'Merge request was successfully created.' else @source_project = @merge_request.source_project diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 076463f6c40..c53b24b817d 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -30,7 +30,9 @@ class MergeRequest < ActiveRecord::Base belongs_to :target_project, foreign_key: :target_project_id, class_name: "Project" belongs_to :source_project, foreign_key: :source_project_id, class_name: "Project" + has_one :merge_request_diff, dependent: :destroy + after_create :create_merge_request_diff delegate :commits, :diffs, :last_commit, :last_commit_short_sha, to: :merge_request_diff, prefix: nil diff --git a/app/observers/merge_request_observer.rb b/app/observers/merge_request_observer.rb index 9a3e90d83e8..0ac555fce7c 100644 --- a/app/observers/merge_request_observer.rb +++ b/app/observers/merge_request_observer.rb @@ -6,7 +6,6 @@ class MergeRequestObserver < ActivityObserver create_event(merge_request, Event.determine_action(merge_request)) end - merge_request.create_merge_request_diff notification.new_merge_request(merge_request, current_user) merge_request.create_cross_references!(merge_request.project, current_user) execute_hooks(merge_request) |