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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e2dc6628
Commit
e2dc6628
authored
Apr 05, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'merge-ce-a55fc4-to-master' into 'master'
Merge CE a55fc4 to master See merge request !317
parents
f7661996
ce689fdf
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
99 additions
and
2 deletions
+99
-2
CHANGELOG
CHANGELOG
+1
-0
app/assets/stylesheets/framework/typography.scss
app/assets/stylesheets/framework/typography.scss
+6
-0
app/models/repository.rb
app/models/repository.rb
+5
-0
app/services/projects/import_service.rb
app/services/projects/import_service.rb
+2
-0
features/steps/project/wiki.rb
features/steps/project/wiki.rb
+1
-1
lib/banzai/filter/image_link_filter.rb
lib/banzai/filter/image_link_filter.rb
+27
-0
lib/banzai/pipeline/gfm_pipeline.rb
lib/banzai/pipeline/gfm_pipeline.rb
+1
-0
spec/features/atom/users_spec.rb
spec/features/atom/users_spec.rb
+1
-1
spec/lib/banzai/filter/image_link_filter_spec.rb
spec/lib/banzai/filter/image_link_filter_spec.rb
+24
-0
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+14
-0
spec/services/projects/import_service_spec.rb
spec/services/projects/import_service_spec.rb
+17
-0
No files found.
CHANGELOG
View file @
e2dc6628
Please view this file on the master branch, on stable branches it's out of date.
v 8.7.0 (unreleased)
- All images in discussions and wikis now link to their source files !3464 (Connor Shea).
- Improved Markdown rendering performance !3389 (Yorick Peterse)
- Don't attempt to look up an avatar in repo if repo directory does not exist (Stan hu)
- Preserve time notes/comments have been updated at when moving issue
...
...
app/assets/stylesheets/framework/typography.scss
View file @
e2dc6628
...
...
@@ -138,6 +138,12 @@
}
}
a
.no-attachment-icon
{
&
:before
{
display
:
none
;
}
}
/* Link to current header. */
h1
,
h2
,
h3
,
h4
,
h5
,
h6
{
position
:
relative
;
...
...
app/models/repository.rb
View file @
e2dc6628
...
...
@@ -402,6 +402,11 @@ class Repository
expire_tag_count_cache
end
def
before_import
expire_emptiness_caches
expire_exists_cache
end
# Runs code after a repository has been forked/imported.
def
after_import
expire_emptiness_caches
...
...
app/services/projects/import_service.rb
View file @
e2dc6628
...
...
@@ -46,6 +46,8 @@ module Projects
def
import_data
return
unless
has_importer?
project
.
repository
.
before_import
unless
importer
.
execute
raise
Error
,
'The remote data could not be imported.'
end
...
...
features/steps/project/wiki.rb
View file @
e2dc6628
...
...
@@ -85,7 +85,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end
step
'I have an existing Wiki page with images linked on page'
do
wiki
.
create_page
(
"pictures"
,
"Look at this [image](image.jpg)
\n\n
"
,
:markdown
,
"first commit"
)
wiki
.
create_page
(
"pictures"
,
"Look at this [image](image.jpg)
\n\n
"
,
:markdown
,
"first commit"
)
@wiki_page
=
wiki
.
find_page
(
"pictures"
)
end
...
...
lib/banzai/filter/image_link_filter.rb
0 → 100644
View file @
e2dc6628
module
Banzai
module
Filter
# HTML filter that wraps links around inline images.
class
ImageLinkFilter
<
HTML
::
Pipeline
::
Filter
# Find every image that isn't already wrapped in an `a` tag, create
# a new node (a link to the image source), copy the image as a child
# of the anchor, and then replace the img with the link-wrapped version.
def
call
doc
.
xpath
(
'descendant-or-self::img[not(ancestor::a)]'
).
each
do
|
img
|
link
=
doc
.
document
.
create_element
(
'a'
,
class:
'no-attachment-icon'
,
href:
img
[
'src'
],
target:
'_blank'
)
link
.
children
=
img
.
clone
img
.
replace
(
link
)
end
doc
end
end
end
end
lib/banzai/pipeline/gfm_pipeline.rb
View file @
e2dc6628
...
...
@@ -7,6 +7,7 @@ module Banzai
Filter
::
SanitizationFilter
,
Filter
::
UploadLinkFilter
,
Filter
::
ImageLinkFilter
,
Filter
::
EmojiFilter
,
Filter
::
TableOfContentsFilter
,
Filter
::
AutolinkFilter
,
...
...
spec/features/atom/users_spec.rb
View file @
e2dc6628
...
...
@@ -61,7 +61,7 @@ describe "User Feed", feature: true do
end
it
'should have XHTML summaries in merge request descriptions'
do
expect
(
body
).
to
match
/Here is the fix: <
img[^>]*\/
>/
expect
(
body
).
to
match
/Here is the fix: <
a[^>]*><img[^>]*\/><\/a
>/
end
end
end
...
...
spec/lib/banzai/filter/image_link_filter_spec.rb
0 → 100644
View file @
e2dc6628
require
'spec_helper'
describe
Banzai
::
Filter
::
ImageLinkFilter
,
lib:
true
do
include
FilterSpecHelper
def
image
(
path
)
%(<img src="#{path}" />)
end
it
'wraps the image with a link to the image src'
do
doc
=
filter
(
image
(
'/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg'
))
expect
(
doc
.
at_css
(
'img'
)[
'src'
]).
to
eq
doc
.
at_css
(
'a'
)[
'href'
]
end
it
'does not wrap a duplicate link'
do
exp
=
act
=
%q(<a href="/whatever">#{image('/uploads/e90decf88d8f96fe9e1389afc2e4a91f/test.jpg')}</a>)
expect
(
filter
(
act
).
to_html
).
to
eq
exp
end
it
'works with external images'
do
doc
=
filter
(
image
(
'https://i.imgur.com/DfssX9C.jpg'
))
expect
(
doc
.
at_css
(
'img'
)[
'src'
]).
to
eq
doc
.
at_css
(
'a'
)[
'href'
]
end
end
spec/models/repository_spec.rb
View file @
e2dc6628
...
...
@@ -612,6 +612,20 @@ describe Repository, models: true do
end
end
describe
'#before_import'
do
it
'flushes the emptiness cachess'
do
expect
(
repository
).
to
receive
(
:expire_emptiness_caches
)
repository
.
before_import
end
it
'flushes the exists cache'
do
expect
(
repository
).
to
receive
(
:expire_exists_cache
)
repository
.
before_import
end
end
describe
'#after_import'
do
it
'flushes the emptiness cachess'
do
expect
(
repository
).
to
receive
(
:expire_emptiness_caches
)
...
...
spec/services/projects/import_service_spec.rb
View file @
e2dc6628
...
...
@@ -72,6 +72,23 @@ describe Projects::ImportService, services: true do
expect
(
result
[
:status
]).
to
eq
:success
end
it
'flushes various caches'
do
expect_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:import_repository
).
with
(
project
.
path_with_namespace
,
project
.
import_url
).
and_return
(
true
)
expect_any_instance_of
(
Gitlab
::
GithubImport
::
Importer
).
to
receive
(
:execute
).
and_return
(
true
)
expect_any_instance_of
(
Repository
).
to
receive
(
:expire_emptiness_caches
).
and_call_original
expect_any_instance_of
(
Repository
).
to
receive
(
:expire_exists_cache
).
and_call_original
subject
.
execute
end
it
'fails if importer fails'
do
expect_any_instance_of
(
Gitlab
::
Shell
).
to
receive
(
:import_repository
).
with
(
project
.
path_with_namespace
,
project
.
import_url
).
and_return
(
true
)
expect_any_instance_of
(
Gitlab
::
GithubImport
::
Importer
).
to
receive
(
:execute
).
and_return
(
false
)
...
...
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