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
876a07b3
Commit
876a07b3
authored
Apr 27, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the failing tests
parent
1405d9cb
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
205 additions
and
163 deletions
+205
-163
css/converse.css
css/converse.css
+8
-3
css/inverse.css
css/inverse.css
+8
-3
mockup/chatbox.html
mockup/chatbox.html
+15
-15
mockup/chatroom.html
mockup/chatroom.html
+25
-25
sass/_messages.scss
sass/_messages.scss
+12
-2
spec/chatbox.js
spec/chatbox.js
+84
-71
spec/chatroom.js
spec/chatroom.js
+29
-24
src/templates/message.html
src/templates/message.html
+2
-2
src/templates/new_day.html
src/templates/new_day.html
+1
-1
src/templates/spoiler_message.html
src/templates/spoiler_message.html
+1
-1
src/utils/core.js
src/utils/core.js
+20
-16
No files found.
css/converse.css
View file @
876a07b3
...
...
@@ -8360,7 +8360,7 @@ body.reset {
color
:
#3AA569
;
font-size
:
14px
;
line-height
:
14px
;
padding
:
0.5rem
1rem
;
}
padding
:
0.
3
5rem
1rem
;
}
#conversejs
.message.chat-info.badge
{
color
:
white
;
}
#conversejs
.message.chat-info.chat-state-notification
{
...
...
@@ -8408,9 +8408,13 @@ body.reset {
margin-left
:
0
;
}
#conversejs
.message.chat-msg
.chat-msg-text
{
padding
:
0
;
color
:
#666
;
}
color
:
#666
;
word-wrap
:
break-word
;
word-break
:
break-all
;
}
#conversejs
.message.chat-msg
.chat-msg-text
.emojione
{
margin-bottom
:
-6px
;
}
#conversejs
.message.chat-msg
.chat-msg-media
audio
{
width
:
100%
;
}
#conversejs
.message.chat-msg
.avatar
{
margin-top
:
0.5em
;
background
:
#818479
;
...
...
@@ -8425,7 +8429,8 @@ body.reset {
#conversejs
.message.chat-msg
.chat-msg-heading
.chat-msg-author
{
font-weight
:
bold
;
}
#conversejs
.message.chat-msg
.chat-msg-heading
.chat-msg-time
{
padding-left
:
0.5em
;
}
padding-left
:
0.25em
;
color
:
#9d9d9d
;
}
#conversejs
.message.chat-msg.chat-action
.chat-msg-heading
{
margin-top
:
0
;
}
#conversejs
.message.chat-msg.chat-msg-followup
{
...
...
css/inverse.css
View file @
876a07b3
...
...
@@ -8548,7 +8548,7 @@ body {
color
:
#3AA569
;
font-size
:
14px
;
line-height
:
20px
;
padding
:
0.5rem
1rem
;
}
padding
:
0.
3
5rem
1rem
;
}
#conversejs
.message.chat-info.badge
{
color
:
white
;
}
#conversejs
.message.chat-info.chat-state-notification
{
...
...
@@ -8596,9 +8596,13 @@ body {
margin-left
:
0
;
}
#conversejs
.message.chat-msg
.chat-msg-text
{
padding
:
0
;
color
:
#666
;
}
color
:
#666
;
word-wrap
:
break-word
;
word-break
:
break-all
;
}
#conversejs
.message.chat-msg
.chat-msg-text
.emojione
{
margin-bottom
:
-6px
;
}
#conversejs
.message.chat-msg
.chat-msg-media
audio
{
width
:
100%
;
}
#conversejs
.message.chat-msg
.avatar
{
margin-top
:
0.5em
;
background
:
#818479
;
...
...
@@ -8613,7 +8617,8 @@ body {
#conversejs
.message.chat-msg
.chat-msg-heading
.chat-msg-author
{
font-weight
:
bold
;
}
#conversejs
.message.chat-msg
.chat-msg-heading
.chat-msg-time
{
padding-left
:
0.5em
;
}
padding-left
:
0.25em
;
color
:
#9d9d9d
;
}
#conversejs
.message.chat-msg.chat-action
.chat-msg-heading
{
margin-top
:
0
;
}
#conversejs
.message.chat-msg.chat-msg-followup
{
...
...
mockup/chatbox.html
View file @
876a07b3
...
...
@@ -46,11 +46,11 @@
<div
class=
"chat-msg-content"
>
<span
class=
"chat-msg-heading"
>
<span
class=
"chat-msg-author"
>
Romeo Montague
</span>
<span
class=
"chat-msg-time
text-muted
"
>
15:31
</span>
<span
class=
"chat-msg-time"
>
15:31
</span>
</span>
<
p
class=
"chat-msg-text"
>
<
span
class=
"chat-msg-text"
>
He jests at scars that never felt a wound.
</
p
>
</
span
>
</div>
</div>
...
...
@@ -64,11 +64,11 @@
<div
class=
"chat-msg-content"
>
<span
class=
"chat-msg-heading"
>
<span
class=
"chat-msg-author"
>
Romeo Montague
</span>
<span
class=
"chat-msg-time
text-muted
"
>
15:31
</span>
<span
class=
"chat-msg-time"
>
15:31
</span>
</span>
<
p
class=
"chat-msg-text"
>
<
span
class=
"chat-msg-text"
>
But soft, what light through yonder window breaks?
</
p
>
</
span
>
</div>
</div>
...
...
@@ -77,11 +77,11 @@
<div
class=
"chat-msg-content"
>
<span
class=
"chat-msg-heading"
>
<span
class=
"chat-msg-author"
>
Romeo Montague
</span>
<span
class=
"chat-msg-time
text-muted
"
>
15:31
</span>
<span
class=
"chat-msg-time"
>
15:31
</span>
</span>
<
p
class=
"chat-msg-text"
>
<
span
class=
"chat-msg-text"
>
It is the east and Juliet is the sun!
</
p
>
</
span
>
</div>
</div>
...
...
@@ -90,11 +90,11 @@
<div
class=
"chat-msg-content"
>
<span
class=
"chat-msg-heading"
>
<span
class=
"chat-msg-author"
>
Romeo Montague
</span>
<span
class=
"chat-msg-time
text-muted
"
>
15:31
</span>
<span
class=
"chat-msg-time"
>
15:31
</span>
</span>
<
p
class=
"chat-msg-text"
>
<
span
class=
"chat-msg-text"
>
Arise, fair sun, and kill the envious moon,
</
p
>
</
span
>
</div>
</div>
...
...
@@ -105,14 +105,14 @@
<div
class=
"chat-msg-content"
>
<span
class=
"chat-msg-heading"
>
<span
class=
"chat-msg-author"
>
Juliet Capulet
</span>
<span
class=
"chat-msg-time
text-muted
"
>
15:31
</span>
<span
class=
"chat-msg-time"
>
15:31
</span>
</span>
<
p
class=
"chat-msg-text"
>
<
span
class=
"chat-msg-text"
>
O Romeo, Romeo! wherefore art thou Romeo?
Deny thy father and refuse thy name;
Or, if thou wilt not, be but sworn my love,
And I'll no longer be a Capulet.
</
p
>
</
span
>
</div>
</div>
</div>
...
...
mockup/chatroom.html
View file @
876a07b3
This diff is collapsed.
Click to expand it.
sass/_messages.scss
View file @
876a07b3
...
...
@@ -32,7 +32,7 @@
color
:
$chat-head-color
;
font-size
:
$message-font-size
;
line-height
:
$line-height-small
;
padding
:
0
.5rem
1rem
;
padding
:
0
.
3
5rem
1rem
;
&
.badge
{
color
:
$chat-head-text-color
;
...
...
@@ -105,11 +105,20 @@
.chat-msg-text
{
padding
:
0
;
color
:
$message-text-color
;
word-wrap
:
break-word
;
word-break
:
break-all
;
.emojione
{
margin-bottom
:
-6px
;
}
}
.chat-msg-media
{
audio
{
width
:
100%
;
}
}
.avatar
{
margin-top
:
0
.5em
;
background
:
$gray-color
;
...
...
@@ -127,7 +136,8 @@
font-weight
:
bold
;
}
.chat-msg-time
{
padding-left
:
0
.5em
;
padding-left
:
0
.25em
;
color
:
lighten
(
$text-color
,
15%
);
}
}
&
.chat-action
{
...
...
spec/chatbox.js
View file @
876a07b3
This diff is collapsed.
Click to expand it.
spec/chatroom.js
View file @
876a07b3
...
...
@@ -619,11 +619,11 @@
var
view
=
_converse
.
chatboxviews
.
get
(
'
coven@chat.shakespeare.lit
'
);
var
chat_content
=
view
.
el
.
querySelector
(
'
.chat-content
'
);
var
$chat_content
=
$
(
chat_content
);
var
time
=
chat_content
.
querySelector
(
'
time
'
);
expect
(
time
).
not
.
toBe
(
null
);
expect
(
time
.
getAttribute
(
'
class
'
)).
toEqual
(
'
message chat-info chat-date badge badge-info
'
);
expect
(
time
.
getAttribute
(
'
data-isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
time
.
textContent
).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
var
indicator
=
chat_content
.
querySelector
(
'
.date-separator
'
);
expect
(
indicator
).
not
.
toBe
(
null
);
expect
(
indicator
.
getAttribute
(
'
class
'
)).
toEqual
(
'
message date-separator
'
);
expect
(
indicator
.
getAttribute
(
'
data-isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
indicator
.
querySelector
(
'
time
'
)
.
textContent
).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
expect
(
chat_content
.
querySelectorAll
(
'
div.chat-info
'
).
length
).
toBe
(
1
);
expect
(
chat_content
.
querySelector
(
'
div.chat-info
'
).
textContent
).
toBe
(
"
dummy has entered the room
"
...
...
@@ -654,11 +654,13 @@
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
time
=
chat_content
.
querySelector
(
'
time[data-isodate="
'
+
moment
().
startOf
(
'
day
'
).
format
()
+
'
"]
'
);
expect
(
time
).
not
.
toBe
(
null
);
expect
(
time
.
getAttribute
(
'
class
'
)).
toEqual
(
'
message chat-info chat-date badge badge-info
'
);
expect
(
time
.
getAttribute
(
'
data-isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
time
.
textContent
).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
indicator
=
chat_content
.
querySelector
(
'
.date-separator[data-isodate="
'
+
moment
().
startOf
(
'
day
'
).
format
()
+
'
"]
'
);
expect
(
indicator
).
not
.
toBe
(
null
);
expect
(
indicator
.
getAttribute
(
'
class
'
)).
toEqual
(
'
message date-separator
'
);
expect
(
indicator
.
getAttribute
(
'
data-isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
indicator
.
querySelector
(
'
time
'
).
getAttribute
(
'
class
'
)).
toEqual
(
'
separator-text
'
);
expect
(
indicator
.
querySelector
(
'
time
'
).
textContent
).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
expect
(
chat_content
.
querySelector
(
'
div.chat-info:last-child
'
).
textContent
).
toBe
(
"
some1 has entered the room
"
);
...
...
@@ -680,11 +682,13 @@
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
time
=
chat_content
.
querySelector
(
'
time[data-isodate="
'
+
moment
().
startOf
(
'
day
'
).
format
()
+
'
"]
'
);
expect
(
time
).
not
.
toBe
(
null
);
expect
(
time
.
getAttribute
(
'
class
'
)).
toEqual
(
'
message chat-info chat-date badge badge-info
'
);
expect
(
time
.
getAttribute
(
'
data-isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
time
.
textContent
).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
indicator
=
chat_content
.
querySelector
(
'
.date-separator[data-isodate="
'
+
moment
().
startOf
(
'
day
'
).
format
()
+
'
"]
'
);
expect
(
indicator
).
not
.
toBe
(
null
);
expect
(
indicator
.
getAttribute
(
'
class
'
)).
toEqual
(
'
message date-separator
'
);
expect
(
indicator
.
getAttribute
(
'
data-isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
indicator
.
querySelector
(
'
time
'
).
textContent
).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
expect
(
$
(
chat_content
).
find
(
'
div.chat-info
'
).
length
).
toBe
(
4
);
expect
(
$
(
chat_content
).
find
(
'
div.chat-info:last
'
).
html
()).
toBe
(
'
some1 has left the room.
'
+
...
...
@@ -716,10 +720,10 @@
var
$time
=
$chat_content
.
find
(
'
time
'
);
expect
(
$time
.
length
).
toEqual
(
4
);
$time
=
$chat_content
.
find
(
'
time
:eq(3)
'
);
expect
(
$
time
.
attr
(
'
class
'
)).
toEqual
(
'
message chat-info chat-date badge badge-info
'
);
expect
(
$
time
.
data
(
'
isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
$
time
.
text
()).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
var
$indicator
=
$chat_content
.
find
(
'
.date-separator
:eq(3)
'
);
expect
(
$
indicator
.
attr
(
'
class
'
)).
toEqual
(
'
message date-separator
'
);
expect
(
$
indicator
.
data
(
'
isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
$
indicator
.
find
(
'
time
'
)
.
text
()).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
length
).
toBe
(
5
);
expect
(
$chat_content
.
find
(
'
div.chat-info:last
'
).
html
()).
toBe
(
"
newguy has entered the room
"
);
...
...
@@ -755,10 +759,11 @@
$time
=
$chat_content
.
find
(
'
time
'
);
expect
(
$time
.
length
).
toEqual
(
6
);
$time
=
$chat_content
.
find
(
'
time:eq(5)
'
);
expect
(
$time
.
attr
(
'
class
'
)).
toEqual
(
'
message chat-info chat-date badge badge-info
'
);
expect
(
$time
.
data
(
'
isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
$time
.
text
()).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
$indicator
=
$chat_content
.
find
(
'
.date-separator:eq(5)
'
);
expect
(
$indicator
.
attr
(
'
class
'
)).
toEqual
(
'
message date-separator
'
);
expect
(
$indicator
.
data
(
'
isodate
'
)).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
());
expect
(
$indicator
.
find
(
'
time
'
).
text
()).
toEqual
(
moment
().
startOf
(
'
day
'
).
format
(
"
dddd MMM Do YYYY
"
));
expect
(
$chat_content
.
find
(
'
div.chat-info
'
).
length
).
toBe
(
6
);
expect
(
$chat_content
.
find
(
'
div.chat-info:last
'
).
html
()).
toBe
(
'
newguy has left the room.
'
+
...
...
@@ -2298,7 +2303,7 @@
.
c
(
'
status
'
,
{
'
code
'
:
'
307
'
});
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-info
'
)[
3
].
textContent
).
toBe
(
view
.
el
.
querySelectorAll
(
'
.chat-info
'
)[
2
].
textContent
).
toBe
(
"
annoyingGuy has been kicked out
"
);
done
();
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
...
...
src/templates/message.html
View file @
876a07b3
...
...
@@ -5,9 +5,9 @@
<div
class=
"chat-msg-content"
>
<span
class=
"chat-msg-heading"
>
<span
class=
"chat-msg-author"
>
{{{o.username}}}
</span>
<span
class=
"chat-msg-time
tex{{{o.username}}}t-muted
"
>
{{{o.pretty_time}}}
</span>
<span
class=
"chat-msg-time"
>
{{{o.pretty_time}}}
</span>
</span>
<
p
class=
"chat-msg-text"
>
<
span
class=
"chat-msg-text"
></span
>
<div
class=
"chat-msg-media"
></div>
</div>
</div>
src/templates/new_day.html
View file @
876a07b3
<div
class=
"message date-separator"
>
<div
class=
"message date-separator"
data-isodate=
"{{{o.isodate}}}"
>
<hr
class=
"separator"
>
<time
class=
"separator-text"
datetime=
"{{{o.isodate}}}"
><span>
{{{o.datestring}}}
</span></time>
</div>
src/templates/spoiler_message.html
View file @
876a07b3
...
...
@@ -3,7 +3,7 @@
<div
class=
"chat-msg-content"
>
<span
class=
"chat-msg-heading"
>
<span
class=
"chat-msg-author"
>
{{{o.username}}}
</span>
<span
class=
"chat-msg-time
text-muted
"
>
{{{o.pretty_time}}}
</span>
<span
class=
"chat-msg-time"
>
{{{o.pretty_time}}}
</span>
</span>
<div>
<span
class=
"spoiler-hint"
>
{{{o.spoiler_hint}}}
</span>
...
...
src/utils/core.js
View file @
876a07b3
...
...
@@ -66,18 +66,6 @@
'
warn
'
:
_
.
get
(
console
,
'
log
'
)
?
console
.
log
.
bind
(
console
)
:
_
.
noop
},
console
);
var
unescapeHTML
=
function
(
htmlEscapedText
)
{
/* Helper method that replace HTML-escaped symbols with equivalent characters
* (e.g. transform occurrences of '&' to '&')
*
* Parameters:
* (String) htmlEscapedText: a String containing the HTML-escaped symbols.
*/
var
div
=
document
.
createElement
(
'
div
'
);
div
.
innerHTML
=
htmlEscapedText
;
return
div
.
innerText
;
};
var
isImage
=
function
(
url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
var
img
=
new
Image
();
...
...
@@ -200,6 +188,18 @@
return
matches
;
}
u
.
unescapeHTML
=
function
(
htmlEscapedText
)
{
/* Helper method that replace HTML-escaped symbols with equivalent characters
* (e.g. transform occurrences of '&' to '&')
*
* Parameters:
* (String) htmlEscapedText: a String containing the HTML-escaped symbols.
*/
var
div
=
document
.
createElement
(
'
div
'
);
div
.
innerHTML
=
htmlEscapedText
;
return
div
.
innerText
;
};
u
.
escapeHTML
=
function
(
string
)
{
return
string
.
replace
(
/&/g
,
"
&
"
)
...
...
@@ -212,7 +212,11 @@
return
URI
.
withinString
(
text
,
function
(
url
)
{
var
uri
=
new
URI
(
url
);
uri
.
normalize
();
return
`<a href="
${
u
.
escapeHTML
(
url
)}
">
${
u
.
escapeHTML
(
uri
.
readable
())}
</a>`
;
if
(
!
url
.
startsWith
(
'
http://
'
)
&&
!
url
.
startsWith
(
'
https://
'
))
{
url
=
'
http://
'
+
url
;
}
url
=
encodeURI
(
decodeURI
(
url
)).
replace
(
/
[
!'()
]
/g
,
escape
).
replace
(
/
\*
/g
,
"
%2A
"
);
return
`<a target="_blank" rel="noopener" href="
${
u
.
escapeHTML
(
url
)}
">
${
u
.
escapeHTML
(
uri
.
readable
())}
</a>`
;
});
};
...
...
@@ -233,9 +237,9 @@
i
.
addEventListener
(
'
error
'
,
resolve
);
_
.
each
(
sizzle
(
`a[href="
${
url
}
"]`
,
obj
),
(
a
)
=>
{
a
.
innerHTML
=
tpl_image
({
a
.
outerHTML
=
tpl_image
({
'
url
'
:
url
,
'
label_download
'
:
__
(
'
Download
image file
'
)
'
label_download
'
:
__
(
'
Download
'
)
})
});
}).
catch
(
resolve
)
...
...
@@ -268,7 +272,7 @@
return
tpl_image
({
'
url
'
:
url
,
'
label_download
'
:
__
(
'
Download
image file
'
)
'
label_download
'
:
__
(
'
Download
'
)
})
}
return
url
;
...
...
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