Commit 21fa421c authored by Douwe Maan's avatar Douwe Maan

Merge branch 'fix/13458-eager-load-blob-data' into 'master'

Eager-load image blob data in diffs

Since gitlab_git 8.0, blob data are lazy-loaded so we have to call
`blob.load_all_data!(repo)` to eager-load them.

Fixes #13458.

/cc @jacobvosmaer @dblessing @rspeicher 

### New image in commit view

#### Before
![Screen_Shot_2016-02-16_at_11.28.18](/uploads/01c2afa2d25f3249b27744154ab2069b/Screen_Shot_2016-02-16_at_11.28.18.png)

#### After
![Screen_Shot_2016-02-16_at_11.30.56](/uploads/5ef72f717f22dfd0c1efa9e6d8ed926f/Screen_Shot_2016-02-16_at_11.30.56.png)

### Replaced image in commit view

#### Before
![Screen_Shot_2016-02-16_at_11.28.20](/uploads/39bb61851608643a86d9d7616139fc6c/Screen_Shot_2016-02-16_at_11.28.20.png)

#### After
![Screen_Shot_2016-02-16_at_11.30.59](/uploads/27e754fe8b57a838ac695bace27618c3/Screen_Shot_2016-02-16_at_11.30.59.png)

### Deleted image in commit view

#### Before
![Screen_Shot_2016-02-16_at_11.28.22](/uploads/3648dcc2c36bc644556080e203a29fca/Screen_Shot_2016-02-16_at_11.28.22.png)

#### After
![Screen_Shot_2016-02-16_at_11.31.01](/uploads/2585915d994bb6e245dd8c8553730bbf/Screen_Shot_2016-02-16_at_11.31.01.png)

### Image diff in merge request diff view

#### Before
![Screen_Shot_2016-02-16_at_11.28.37](/uploads/a7963f7139fc91975ca40568570ce4f0/Screen_Shot_2016-02-16_at_11.28.37.png)

#### After
![Screen_Shot_2016-02-16_at_11.31.04](/uploads/6773dbf3b870f082f0262febc9722d20/Screen_Shot_2016-02-16_at_11.31.04.png)

See merge request !2830
parents 42d088fc 5cd20de7
- diff = diff_file.diff
- file.load_all_data!(@project.repository)
- if diff.renamed_file || diff.new_file || diff.deleted_file
.image
%span.wrap
......@@ -6,6 +7,7 @@
%img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
%p.image-info= "#{number_to_human_size file.size}"
- else
- old_file.load_all_data!(@project.repository)
.image
%div.two-up.view
%span.wrap
......
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