Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
caf10464
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
caf10464
编写于
10月 05, 2018
作者:
O
Oswaldo Ferreira
提交者:
Douglas Barbosa Alexandre
10月 05, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix LFS uploaded images not being rendered
上级
1bd08177
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
56 addition
and
7 deletion
+56
-7
app/assets/javascripts/diffs/components/diff_content.vue
app/assets/javascripts/diffs/components/diff_content.vue
+1
-1
app/serializers/diff_file_entity.rb
app/serializers/diff_file_entity.rb
+4
-0
app/serializers/diff_viewer_entity.rb
app/serializers/diff_viewer_entity.rb
+7
-0
changelogs/unreleased/osw-fix-lfs-images-not-rendering.yml
changelogs/unreleased/osw-fix-lfs-images-not-rendering.yml
+5
-0
spec/fixtures/api/schemas/entities/diff_viewer.json
spec/fixtures/api/schemas/entities/diff_viewer.json
+8
-0
spec/javascripts/diffs/components/diff_content_spec.js
spec/javascripts/diffs/components/diff_content_spec.js
+2
-3
spec/javascripts/diffs/components/diff_file_spec.js
spec/javascripts/diffs/components/diff_file_spec.js
+2
-3
spec/javascripts/diffs/mock_data/diff_file.js
spec/javascripts/diffs/mock_data/diff_file.js
+3
-0
spec/serializers/diff_file_entity_spec.rb
spec/serializers/diff_file_entity_spec.rb
+5
-0
spec/serializers/diff_viewer_entity_spec.rb
spec/serializers/diff_viewer_entity_spec.rb
+19
-0
未找到文件。
app/assets/javascripts/diffs/components/diff_content.vue
浏览文件 @
caf10464
...
...
@@ -28,7 +28,7 @@ export default {
return
diffModes
[
diffModeKey
]
||
diffModes
.
replaced
;
},
isTextFile
()
{
return
this
.
diffFile
.
text
;
return
this
.
diffFile
.
viewer
.
name
===
'
text
'
;
},
},
};
...
...
app/serializers/diff_file_entity.rb
浏览文件 @
caf10464
...
...
@@ -116,6 +116,10 @@ class DiffFileEntity < Grape::Entity
project_blob_path
(
project
,
tree_join
(
diff_file
.
content_sha
,
diff_file
.
new_path
))
end
expose
:viewer
,
using:
DiffViewerEntity
do
|
diff_file
|
diff_file
.
rich_viewer
||
diff_file
.
simple_viewer
end
expose
:replaced_view_path
,
if:
->
(
_
,
options
)
{
options
[
:merge_request
]
}
do
|
diff_file
|
image_diff
=
diff_file
.
rich_viewer
&&
diff_file
.
rich_viewer
.
partial_name
==
'image'
image_replaced
=
diff_file
.
old_content_sha
&&
diff_file
.
old_content_sha
!=
diff_file
.
content_sha
...
...
app/serializers/diff_viewer_entity.rb
0 → 100644
浏览文件 @
caf10464
# frozen_string_literal: true
class
DiffViewerEntity
<
Grape
::
Entity
# Partial name refers directly to a Rails feature, let's avoid
# using this on the frontend.
expose
:partial_name
,
as: :name
end
changelogs/unreleased/osw-fix-lfs-images-not-rendering.yml
0 → 100644
浏览文件 @
caf10464
---
title
:
Fix LFS uploaded images not being rendered
merge_request
:
22092
author
:
type
:
fixed
spec/fixtures/api/schemas/entities/diff_viewer.json
0 → 100644
浏览文件 @
caf10464
{
"type"
:
"object"
,
"required"
:
[
"name"
],
"properties"
:
{
"name"
:
{
"type"
:
[
"string"
]
}
},
"additionalProperties"
:
false
}
spec/javascripts/diffs/components/diff_content_spec.js
浏览文件 @
caf10464
...
...
@@ -8,13 +8,12 @@ import diffFileMockData from '../mock_data/diff_file';
describe
(
'
DiffContent
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
DiffContentComponent
);
let
vm
;
const
getDiffFileMock
=
()
=>
Object
.
assign
({},
diffFileMockData
);
beforeEach
(()
=>
{
vm
=
mountComponentWithStore
(
Component
,
{
store
,
props
:
{
diffFile
:
getDiffFileMock
(
),
diffFile
:
JSON
.
parse
(
JSON
.
stringify
(
diffFileMockData
)
),
},
});
});
...
...
@@ -43,7 +42,7 @@ describe('DiffContent', () => {
describe
(
'
Non-Text diffs
'
,
()
=>
{
beforeEach
(()
=>
{
vm
.
diffFile
.
text
=
false
;
vm
.
diffFile
.
viewer
.
name
=
'
image
'
;
});
describe
(
'
image diff
'
,
()
=>
{
...
...
spec/javascripts/diffs/components/diff_file_spec.js
浏览文件 @
caf10464
...
...
@@ -6,11 +6,10 @@ import diffFileMockData from '../mock_data/diff_file';
describe
(
'
DiffFile
'
,
()
=>
{
let
vm
;
const
getDiffFileMock
=
()
=>
Object
.
assign
({},
diffFileMockData
);
beforeEach
(()
=>
{
vm
=
createComponentWithStore
(
Vue
.
extend
(
DiffFileComponent
),
store
,
{
file
:
getDiffFileMock
(
),
file
:
JSON
.
parse
(
JSON
.
stringify
(
diffFileMockData
)
),
canCurrentUserFork
:
false
,
}).
$mount
();
});
...
...
@@ -18,7 +17,7 @@ describe('DiffFile', () => {
describe
(
'
template
'
,
()
=>
{
it
(
'
should render component with file header, file content components
'
,
()
=>
{
const
el
=
vm
.
$el
;
const
{
fileHash
,
filePath
}
=
diffFileMockData
;
const
{
fileHash
,
filePath
}
=
vm
.
file
;
expect
(
el
.
id
).
toEqual
(
fileHash
);
expect
(
el
.
classList
.
contains
(
'
diff-file
'
)).
toEqual
(
true
);
...
...
spec/javascripts/diffs/mock_data/diff_file.js
浏览文件 @
caf10464
...
...
@@ -23,6 +23,9 @@ export default {
aMode
:
'
100644
'
,
bMode
:
'
100644
'
,
text
:
true
,
viewer
:
{
name
:
'
text
'
,
},
addedLines
:
2
,
removedLines
:
0
,
diffRefs
:
{
...
...
spec/serializers/diff_file_entity_spec.rb
浏览文件 @
caf10464
...
...
@@ -26,6 +26,11 @@ describe DiffFileEntity do
)
end
it
'includes viewer'
do
expect
(
subject
[
:viewer
].
with_indifferent_access
)
.
to
match_schema
(
'entities/diff_viewer'
)
end
# Converted diff files from GitHub import does not contain blob file
# and content sha.
context
'when diff file does not have a blob and content sha'
do
...
...
spec/serializers/diff_viewer_entity_spec.rb
0 → 100644
浏览文件 @
caf10464
require
'spec_helper'
describe
DiffViewerEntity
do
include
RepoHelpers
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:commit
)
{
project
.
commit
(
sample_commit
.
id
)
}
let
(
:diff_refs
)
{
commit
.
diff_refs
}
let
(
:diff
)
{
commit
.
raw_diffs
.
first
}
let
(
:diff_file
)
{
Gitlab
::
Diff
::
File
.
new
(
diff
,
diff_refs:
diff_refs
,
repository:
repository
)
}
let
(
:viewer
)
{
diff_file
.
simple_viewer
}
subject
{
described_class
.
new
(
viewer
).
as_json
}
it
'serializes diff file viewer'
do
expect
(
subject
.
with_indifferent_access
).
to
match_schema
(
'entities/diff_viewer'
)
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录