Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
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
0
Merge Requests
0
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
converse.js
Commits
30e784b8
Commit
30e784b8
authored
Nov 26, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: `use_system_emojis` was `false` but unicode emojis shown in picker
parent
33f62bb9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
+21
-14
spec/emojis.js
spec/emojis.js
+10
-5
src/headless/converse-emoji.js
src/headless/converse-emoji.js
+11
-9
No files found.
spec/emojis.js
View file @
30e784b8
...
...
@@ -5,7 +5,7 @@ const u = converse.env.utils;
const
original_timeout
=
jasmine
.
DEFAULT_TIMEOUT_INTERVAL
;
describe
(
"
Emojis
"
,
function
()
{
f
describe
(
"
Emojis
"
,
function
()
{
describe
(
"
The emoji picker
"
,
function
()
{
beforeEach
(()
=>
(
jasmine
.
DEFAULT_TIMEOUT_INTERVAL
=
10000
));
...
...
@@ -347,18 +347,19 @@ describe("Emojis", function () {
async
function
(
done
,
_converse
)
{
await
mock
.
waitForRoster
(
_converse
,
'
current
'
);
const
sender
_jid
=
mock
.
cur_names
[
1
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@montague.lit
'
;
const
contact
_jid
=
mock
.
cur_names
[
1
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@montague.lit
'
;
_converse
.
handleMessageStanza
(
$msg
({
'
from
'
:
sender
_jid
,
'
from
'
:
contact
_jid
,
'
to
'
:
_converse
.
connection
.
jid
,
'
type
'
:
'
chat
'
,
'
id
'
:
_converse
.
connection
.
getUniqueId
()
}).
c
(
'
body
'
).
t
(
'
😇
'
).
up
()
.
c
(
'
active
'
,
{
'
xmlns
'
:
'
http://jabber.org/protocol/chatstates
'
}).
tree
());
await
new
Promise
(
resolve
=>
_converse
.
on
(
'
chatBoxViewInitialized
'
,
resolve
));
const
view
=
_converse
.
api
.
chatviews
.
get
(
sender
_jid
);
const
view
=
_converse
.
api
.
chatviews
.
get
(
contact
_jid
);
await
new
Promise
(
resolve
=>
view
.
model
.
messages
.
once
(
'
rendered
'
,
resolve
));
await
u
.
waitUntil
(()
=>
u
.
hasClass
(
'
chat-msg__text--larger
'
,
view
.
content
.
querySelector
(
'
.chat-msg__text
'
)));
await
u
.
waitUntil
(()
=>
view
.
content
.
querySelector
(
'
.chat-msg__text
'
).
innerHTML
.
replace
(
/<!---->/g
,
''
)
===
'
<img class="emoji" draggable="false" title=":innocent:" alt="😇" src="https://twemoji.maxcdn.com/v/12.1.6//72x72/1f607.png">
'
);
const
last_msg_sel
=
'
converse-chat-message:last-child .chat-msg__text
'
;
let
message
=
view
.
content
.
querySelector
(
last_msg_sel
);
...
...
@@ -381,6 +382,10 @@ describe("Emojis", function () {
expect
(
imgs
.
length
).
toBe
(
2
);
expect
(
imgs
[
0
].
src
).
toBe
(
_converse
.
api
.
settings
.
get
(
'
emoji_image_path
'
)
+
'
/72x72/1f4a9.png
'
);
expect
(
imgs
[
1
].
src
).
toBe
(
_converse
.
api
.
settings
.
get
(
'
emoji_image_path
'
)
+
'
/72x72/1f607.png
'
);
const
sent_stanzas
=
_converse
.
connection
.
sent_stanzas
;
const
sent_stanza
=
sent_stanzas
.
filter
(
s
=>
s
.
nodeName
===
'
message
'
).
pop
();
expect
(
sent_stanza
.
querySelector
(
'
body
'
).
innerHTML
).
toBe
(
'
💩 😇
'
);
done
()
}));
...
...
src/headless/converse-emoji.js
View file @
30e784b8
...
...
@@ -119,19 +119,21 @@ export function getEmojiMarkup (data, options={unicode_only: false, add_title_wr
const
emoji
=
data
.
emoji
;
const
shortname
=
data
.
shortname
;
if
(
emoji
)
{
if
(
options
.
add_title_wrapper
)
{
if
(
api
.
settings
.
get
(
'
use_system_emojis
'
))
{
if
(
options
.
unicode_only
)
{
return
emoji
;
}
else
if
(
api
.
settings
.
get
(
'
use_system_emojis
'
))
{
if
(
options
.
add_title_wrapper
)
{
return
shortname
?
html
`<span title="
${
shortname
}
">
${
emoji
}
</span>`
:
emoji
;
}
else
{
const
path
=
api
.
settings
.
get
(
'
emoji_image_path
'
);
return
html
`<img class="emoji"
draggable="false"
title="
${
shortname
}
"
alt="
${
emoji
}
"
src="
${
path
}
/72x72/
${
data
.
cp
}
.png"/>`
;
return
emoji
;
}
}
else
{
return
emoji
;
const
path
=
api
.
settings
.
get
(
'
emoji_image_path
'
);
return
html
`<img class="emoji"
draggable="false"
title="
${
shortname
}
"
alt="
${
emoji
}
"
src="
${
path
}
/72x72/
${
data
.
cp
}
.png"/>`
;
}
}
else
if
(
options
.
unicode_only
)
{
return
shortname
;
...
...
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