Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
85b5c606
Verified
Commit
85b5c606
authored
Feb 07, 2019
by
Haelwenn
Browse files
Pleroma.Formatter: width/height to class=emoji
parent
027ded0d
Changes
5
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/formatter.ex
View file @
85b5c606
...
...
@@ -113,9 +113,7 @@ def emojify(text, emoji, strip \\ false) do
html
=
if
not
strip
do
"<img height='32px' width='32px' alt='
#{
emoji
}
' title='
#{
emoji
}
' src='
#{
MediaProxy
.
url
(
file
)
}
' />"
"<img class='emoji' alt='
#{
emoji
}
' title='
#{
emoji
}
' src='
#{
MediaProxy
.
url
(
file
)
}
' />"
else
""
end
...
...
lib/pleroma/html.ex
View file @
85b5c606
...
...
@@ -151,6 +151,7 @@ defmodule Pleroma.HTML.Scrubber.TwitterText do
Meta
.
allow_tag_with_these_attributes
(
"img"
,
[
"width"
,
"height"
,
"class"
,
"title"
,
"alt"
])
...
...
@@ -221,6 +222,7 @@ defmodule Pleroma.HTML.Scrubber.Default do
Meta
.
allow_tag_with_these_attributes
(
"img"
,
[
"width"
,
"height"
,
"class"
,
"title"
,
"alt"
])
...
...
test/formatter_test.exs
View file @
85b5c606
...
...
@@ -248,7 +248,7 @@ test "it adds cool emoji" do
text
=
"I love :firefox:"
expected_result
=
"I love <img
height=
\"
32px
\"
width=
\"
32px
\"
alt=
\"
firefox
\"
title=
\"
firefox
\"
src=
\"
/emoji/Firefox.gif
\"
/>"
"I love <img
class=
\"
emoji
\"
alt=
\"
firefox
\"
title=
\"
firefox
\"
src=
\"
/emoji/Firefox.gif
\"
/>"
assert
Formatter
.
emojify
(
text
)
==
expected_result
end
...
...
@@ -263,7 +263,7 @@ test "it does not add XSS emoji" do
}
expected_result
=
"I love <img
height=
\"
32px
\"
width=
\"
32px
\"
alt=
\"\"
title=
\"\"
src=
\"
https://placehold.it/1x1
\"
/>"
"I love <img
class=
\"
emoji
\"
alt=
\"\"
title=
\"\"
src=
\"
https://placehold.it/1x1
\"
/>"
assert
Formatter
.
emojify
(
text
,
custom_emoji
)
==
expected_result
end
...
...
test/web/twitter_api/views/activity_view_test.exs
View file @
85b5c606
...
...
@@ -100,7 +100,7 @@ test "a create activity with a summary containing emoji" do
expected
=
":firefox: meow"
expected_html
=
"<img
height=
\"
32px
\"
width=
\"
32px
\"
alt=
\"
firefox
\"
title=
\"
firefox
\"
src=
\"
http://localhost:4001/emoji/Firefox.gif
\"
/> meow"
"<img
class=
\"
emoji
\"
alt=
\"
firefox
\"
title=
\"
firefox
\"
src=
\"
http://localhost:4001/emoji/Firefox.gif
\"
/> meow"
assert
result
[
"summary"
]
==
expected
assert
result
[
"summary_html"
]
==
expected_html
...
...
test/web/twitter_api/views/user_view_test.exs
View file @
85b5c606
...
...
@@ -32,7 +32,7 @@ test "A user with an avatar object", %{user: user} do
test
"A user with emoji in username"
do
expected
=
"<img
height=
\"
32px
\"
width=
\"
32px
\"
alt=
\"
karjalanpiirakka
\"
title=
\"
karjalanpiirakka
\"
src=
\"
/file.png
\"
/> man"
"<img
class=
\"
emoji
\"
alt=
\"
karjalanpiirakka
\"
title=
\"
karjalanpiirakka
\"
src=
\"
/file.png
\"
/> man"
user
=
insert
(
:user
,
%{
...
...
Write
Preview
Supports
Markdown
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