Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
1c61ac1c
Commit
1c61ac1c
authored
Feb 18, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor MR code reload
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
e1c93a6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+0
-3
app/models/merge_request.rb
app/models/merge_request.rb
+9
-0
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+0
-2
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
1c61ac1c
...
...
@@ -106,9 +106,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
params
[
:merge_request
].
delete
(
:target_project_id
)
if
@merge_request
.
update_attributes
(
params
[
:merge_request
].
merge
(
author_id_of_changes:
current_user
.
id
))
@merge_request
.
reload_code
@merge_request
.
mark_as_unchecked
@merge_request
.
reset_events_cache
respond_to
do
|
format
|
...
...
app/models/merge_request.rb
View file @
1c61ac1c
...
...
@@ -32,7 +32,9 @@ class MergeRequest < ActiveRecord::Base
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
after_update
:update_merge_request_diff
delegate
:commits
,
:diffs
,
:last_commit
,
:last_commit_short_sha
,
to: :merge_request_diff
,
prefix:
nil
...
...
@@ -125,6 +127,13 @@ class MergeRequest < ActiveRecord::Base
end
end
def
update_merge_request_diff
if
source_branch_changed?
||
target_branch_changed?
reload_code
mark_as_unchecked
end
end
def
reload_code
if
merge_request_diff
&&
opened?
merge_request_diff
.
reload_content
...
...
lib/api/merge_requests.rb
View file @
1c61ac1c
...
...
@@ -116,8 +116,6 @@ module API
authorize!
:modify_merge_request
,
merge_request
if
merge_request
.
update_attributes
attrs
merge_request
.
reload_code
merge_request
.
mark_as_unchecked
present
merge_request
,
with:
Entities
::
MergeRequest
else
handle_merge_request_errors!
merge_request
.
errors
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment