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
b17e7cd5
Commit
b17e7cd5
authored
Sep 18, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rendering of SVG avatars
parent
0a7dff44
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
13 deletions
+15
-13
src/converse-chatview.js
src/converse-chatview.js
+2
-2
src/templates/avatar.js
src/templates/avatar.js
+1
-1
src/templates/avatar.svg
src/templates/avatar.svg
+1
-1
src/templates/chatbox_head.js
src/templates/chatbox_head.js
+1
-1
src/templates/directives/avatar.js
src/templates/directives/avatar.js
+4
-4
src/templates/user_details_modal.js
src/templates/user_details_modal.js
+6
-4
No files found.
src/converse-chatview.js
View file @
b17e7cd5
...
@@ -1093,8 +1093,8 @@ converse.plugins.add('converse-chatview', {
...
@@ -1093,8 +1093,8 @@ converse.plugins.add('converse-chatview', {
},
},
toHTML
()
{
toHTML
()
{
const
vcard
=
this
.
model
?.
vcard
,
const
vcard
=
this
.
model
?.
vcard
;
vcard_json
=
vcard
?
vcard
.
toJSON
()
:
{};
const
vcard_json
=
vcard
?
vcard
.
toJSON
()
:
{};
return
tpl_user_details_modal
(
Object
.
assign
(
return
tpl_user_details_modal
(
Object
.
assign
(
this
.
model
.
toJSON
(),
this
.
model
.
toJSON
(),
vcard_json
,
{
vcard_json
,
{
...
...
src/templates/avatar.js
View file @
b17e7cd5
...
@@ -2,5 +2,5 @@ import { html } from "lit-html";
...
@@ -2,5 +2,5 @@ import { html } from "lit-html";
export
default
(
o
)
=>
html
`
export
default
(
o
)
=>
html
`
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="
${
o
.
classes
}
" width="
${
o
.
width
}
" height="
${
o
.
height
}
">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="
${
o
.
classes
}
" width="
${
o
.
width
}
" height="
${
o
.
height
}
">
<image width="
${
o
.
width
}
" height="
${
o
.
height
}
" preserveAspectRatio="xMidYMid meet"
xlink:href="
${
o
.
image
}
"/>
<image width="
${
o
.
width
}
" height="
${
o
.
height
}
" preserveAspectRatio="xMidYMid meet"
href="data:
${
o
.
image_type
}
;base64,
${
o
.
image
}
"/>
</svg>`
;
</svg>`
;
src/templates/avatar.svg
View file @
b17e7cd5
<svg
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
class=
"{{{o.classes}}}"
width=
"{{{o.width}}}"
height=
"{{{o.height}}}"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
class=
"{{{o.classes}}}"
width=
"{{{o.width}}}"
height=
"{{{o.height}}}"
>
<image
width=
"{{{o.width}}}"
height=
"{{{o.height}}}"
preserveAspectRatio=
"xMidYMid meet"
xlink:
href=
"{{{o.image}}}"
/>
<image
width=
"{{{o.width}}}"
height=
"{{{o.height}}}"
preserveAspectRatio=
"xMidYMid meet"
href=
"{{{o.image}}}"
/>
</svg>
</svg>
src/templates/chatbox_head.js
View file @
b17e7cd5
...
@@ -18,7 +18,7 @@ export default (o) => {
...
@@ -18,7 +18,7 @@ export default (o) => {
<div class="chatbox-title
${
o
.
status
?
''
:
"
chatbox-title--no-desc
"
}
">
<div class="chatbox-title
${
o
.
status
?
''
:
"
chatbox-title--no-desc
"
}
">
<div class="chatbox-title--row">
<div class="chatbox-title--row">
${
(
!
o
.
_converse
.
api
.
settings
.
get
(
"
singleton
"
))
?
html
`<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>`
:
''
}
${
(
!
o
.
_converse
.
api
.
settings
.
get
(
"
singleton
"
))
?
html
`<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>`
:
''
}
${
(
o
.
type
!==
o
.
_converse
.
HEADLINES_TYPE
)
?
avatar
(
Object
.
assign
({},
o
,
avatar_data
))
:
''
}
${
(
o
.
type
!==
o
.
_converse
.
HEADLINES_TYPE
)
?
html
`<span class="mr-2">
${
avatar
(
Object
.
assign
({},
o
,
avatar_data
))}
</span>`
:
''
}
<div class="chatbox-title__text" title="
${
o
.
jid
}
">
<div class="chatbox-title__text" title="
${
o
.
jid
}
">
${
o
.
url
?
html
`<a href="
${
o
.
url
}
" target="_blank" rel="noopener" class="user">
${
o
.
display_name
}
</a>`
:
o
.
display_name
}
${
o
.
url
?
html
`<a href="
${
o
.
url
}
" target="_blank" rel="noopener" class="user">
${
o
.
display_name
}
</a>`
:
o
.
display_name
}
</div>
</div>
...
...
src/templates/directives/avatar.js
View file @
b17e7cd5
...
@@ -5,14 +5,14 @@ import { unsafeSVG } from 'lit-html/directives/unsafe-svg.js';
...
@@ -5,14 +5,14 @@ import { unsafeSVG } from 'lit-html/directives/unsafe-svg.js';
const
whitelist_opts
=
{
const
whitelist_opts
=
{
'
whiteList
'
:
{
'
whiteList
'
:
{
'
svg
'
:
[
'
xmlns
'
,
'
xmlns:xlink
'
,
'
class
'
,
'
width
'
,
'
height
'
],
'
svg
'
:
[
'
xmlns
'
,
'
class
'
,
'
width
'
,
'
height
'
],
'
image
'
:
[
'
width
'
,
'
height
'
,
'
preserveAspectRatio
'
,
'
xlink:
href
'
]
'
image
'
:
[
'
width
'
,
'
height
'
,
'
preserveAspectRatio
'
,
'
href
'
]
}
}
};
};
const
tpl_svg
=
(
o
)
=>
xss
.
filterXSS
(
`<image width="
${
o
.
width
}
" height="
${
o
.
height
}
" preserveAspectRatio="xMidYMid meet"
xlink:
href="
${
o
.
image
}
"/>`
,
whitelist_opts
);
const
tpl_svg
=
(
o
)
=>
xss
.
filterXSS
(
`<image width="
${
o
.
width
}
" height="
${
o
.
height
}
" preserveAspectRatio="xMidYMid meet" href="
${
o
.
image
}
"/>`
,
whitelist_opts
);
const
tpl_avatar
=
(
o
)
=>
html
`
const
tpl_avatar
=
(
o
)
=>
html
`
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
class="avatar
${
o
.
classes
}
" width="
${
o
.
width
}
" height="
${
o
.
height
}
">
<svg xmlns="http://www.w3.org/2000/svg" class="avatar
${
o
.
classes
}
" width="
${
o
.
width
}
" height="
${
o
.
height
}
">
${
unsafeSVG
(
tpl_svg
(
o
))
}
${
unsafeSVG
(
tpl_svg
(
o
))
}
</svg>
</svg>
`
;
`
;
...
...
src/templates/user_details_modal.js
View file @
b17e7cd5
...
@@ -38,8 +38,8 @@ const fingerprints = (o) => {
...
@@ -38,8 +38,8 @@ const fingerprints = (o) => {
<ul class="list-group fingerprints">
<ul class="list-group fingerprints">
<li class="list-group-item active">
${
i18n_fingerprints
}
</li>
<li class="list-group-item active">
${
i18n_fingerprints
}
</li>
${
devices
.
length
?
${
devices
.
length
?
devices
.
map
(
device
=>
device_fingerprint
(
Object
.
assign
({
device
},
o
)))
:
devices
.
map
(
device
=>
device_fingerprint
(
Object
.
assign
({
device
},
o
)))
:
html
`<li class="list-group-item">
${
i18n_no_devices
}
</li>`
}
html
`<li class="list-group-item">
${
i18n_no_devices
}
</li>`
}
</ul>
</ul>
`
;
`
;
}
}
...
@@ -65,7 +65,9 @@ export default (o) => {
...
@@ -65,7 +65,9 @@ export default (o) => {
const
i18n_url
=
__
(
'
URL
'
);
const
i18n_url
=
__
(
'
URL
'
);
const
avatar_data
=
{
const
avatar_data
=
{
'
alt_text
'
:
i18n_profile
,
'
alt_text
'
:
i18n_profile
,
'
extra_classes
'
:
'
mb-3
'
'
extra_classes
'
:
'
mb-3
'
,
'
height
'
:
'
120
'
,
'
width
'
:
'
120
'
}
}
return
html
`
return
html
`
...
@@ -76,7 +78,7 @@ export default (o) => {
...
@@ -76,7 +78,7 @@ export default (o) => {
${
modal_header_close_button
}
${
modal_header_close_button
}
</div>
</div>
<div class="modal-body">
<div class="modal-body">
${
o
.
image
?
avatar
(
Object
.
assign
(
avatar_data
,
o
))
:
''
}
${
o
.
image
?
html
`<div class="mb-4">
${
avatar
(
Object
.
assign
(
o
,
avatar_data
))}
</div>`
:
''
}
${
o
.
fullname
?
html
`<p><label>
${
i18n_full_name
}
:</label>
${
o
.
fullname
}
</p>`
:
''
}
${
o
.
fullname
?
html
`<p><label>
${
i18n_full_name
}
:</label>
${
o
.
fullname
}
</p>`
:
''
}
<p><label>
${
i18n_address
}
:</label> <a href="xmpp:
${
o
.
jid
}
">
${
o
.
jid
}
</a></p>
<p><label>
${
i18n_address
}
:</label> <a href="xmpp:
${
o
.
jid
}
">
${
o
.
jid
}
</a></p>
${
o
.
nickname
?
html
`<p><label>
${
i18n_nickname
}
:</label>
${
o
.
nickname
}
</p>`
:
''
}
${
o
.
nickname
?
html
`<p><label>
${
i18n_nickname
}
:</label>
${
o
.
nickname
}
</p>`
:
''
}
...
...
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