Skip to content

Fix 404 bug

yanhui requested to merge zhyhchg/gitlab:yanhui_feature into master

What does this MR do and why?

this MR for fixing similar issue as #23841.
if it has no diff between the version with merge branch then we visit
diffs_metadata.json?diff_head=true&diff_id=3&start_sha=860fc39564f1102e42a7b3b5deacba251bb259ac&view=inline&w=0
it return 404

Screenshots or screen recordings

image

Steps to reproduce

1.create one merge request
2.change the commit file same with branch will merge
3.click compare with previous version

Describe something about code

1.the code file is app/controllers/projects/merge_requests/diffs_controller.rb
2.remove viewable which is query condition from the function find_merge_request_diff_compare
in the line @merge_request.merge_request_diffs.viewable.find_by(id: params[:diff_id]) to fix 404 bug
3.only one function call find_merge_request_diff_compare
4.origin author may think that the mr's commit file must not be same with the branch that will merge, but it is not

after remove viewable pipeline is passed。 @daveliu

Edited by yanhui

Merge request reports