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
de6ecbf0
Commit
de6ecbf0
authored
Apr 16, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render messages via a new MessageView view
updates #161
parent
264e6830
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
45 additions
and
146 deletions
+45
-146
CHANGES.md
CHANGES.md
+2
-2
spec/chatbox.js
spec/chatbox.js
+3
-1
src/config.js
src/config.js
+1
-0
src/converse-chatboxes.js
src/converse-chatboxes.js
+3
-4
src/converse-chatview.js
src/converse-chatview.js
+20
-117
src/converse-core.js
src/converse-core.js
+5
-5
src/converse-http-file-upload.js
src/converse-http-file-upload.js
+0
-1
src/converse-message-view.js
src/converse-message-view.js
+2
-2
src/converse-modal.js
src/converse-modal.js
+6
-0
src/converse-muc-views.js
src/converse-muc-views.js
+2
-13
src/templates/spoiler_message.html
src/templates/spoiler_message.html
+1
-1
No files found.
CHANGES.md
View file @
de6ecbf0
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
## New Features
## New Features
-
files can now be sent via http-file-upload (XEP-0363)
-
#161 XEP-0363: HTTP File Upload
-
mp4 and mp3 files will now be playable directly in chat
.
-
mp4 and mp3 files will now be playable directly in chat
## 4.0.0 (Unreleased)
## 4.0.0 (Unreleased)
...
...
spec/chatbox.js
View file @
de6ecbf0
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
var
u
=
converse
.
env
.
utils
;
var
u
=
converse
.
env
.
utils
;
return
describe
(
"
Chatboxes
"
,
function
()
{
return
describe
(
"
Chatboxes
"
,
function
()
{
describe
(
"
A Chatbox
"
,
function
()
{
describe
(
"
A Chatbox
"
,
function
()
{
it
(
"
has a /help command to show the available commands
"
,
it
(
"
has a /help command to show the available commands
"
,
...
@@ -239,7 +240,6 @@
...
@@ -239,7 +240,6 @@
});
});
}));
}));
it
(
"
can be saved to, and retrieved from, browserStorage
"
,
it
(
"
can be saved to, and retrieved from, browserStorage
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
...
@@ -654,6 +654,8 @@
...
@@ -654,6 +654,8 @@
return
chatbox
.
get
(
'
fullname
'
)
===
mock
.
cur_names
[
0
];
return
chatbox
.
get
(
'
fullname
'
)
===
mock
.
cur_names
[
0
];
},
100
);
},
100
);
}).
then
(
function
()
{
}).
then
(
function
()
{
var
author_el
=
chatboxview
.
el
.
querySelector
(
'
.chat-msg-author
'
);
expect
(
_
.
includes
(
author_el
.
textContent
,
'
Max Frankfurter
'
)).
toBeTruthy
();
done
();
done
();
});
});
}));
}));
...
...
src/config.js
View file @
de6ecbf0
...
@@ -77,6 +77,7 @@ require.config({
...
@@ -77,6 +77,7 @@ require.config({
"
converse-headline
"
:
"
src/converse-headline
"
,
"
converse-headline
"
:
"
src/converse-headline
"
,
"
converse-http-file-upload
"
:
"
src/converse-http-file-upload
"
,
"
converse-http-file-upload
"
:
"
src/converse-http-file-upload
"
,
"
converse-mam
"
:
"
src/converse-mam
"
,
"
converse-mam
"
:
"
src/converse-mam
"
,
"
converse-message-view
"
:
"
src/converse-message-view
"
,
"
converse-minimize
"
:
"
src/converse-minimize
"
,
"
converse-minimize
"
:
"
src/converse-minimize
"
,
"
converse-modal
"
:
"
src/converse-modal
"
,
"
converse-modal
"
:
"
src/converse-modal
"
,
"
converse-muc
"
:
"
src/converse-muc
"
,
"
converse-muc
"
:
"
src/converse-muc
"
,
...
...
src/converse-chatboxes.js
View file @
de6ecbf0
// Converse.js
(A browser based XMPP chat client)
// Converse.js
// http://conversejs.org
// http://conversejs.org
//
//
// Copyright (c) 2012-201
7, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2012-201
8, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define */
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
define
([
...
@@ -106,6 +104,7 @@
...
@@ -106,6 +104,7 @@
this
.
messages
=
new
_converse
.
Messages
();
this
.
messages
=
new
_converse
.
Messages
();
this
.
messages
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
message_storage
](
this
.
messages
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
message_storage
](
b64_sha1
(
`converse.messages
${
this
.
get
(
'
jid
'
)}${
_converse
.
bare_jid
}
`
));
b64_sha1
(
`converse.messages
${
this
.
get
(
'
jid
'
)}${
_converse
.
bare_jid
}
`
));
this
.
messages
.
chatbox
=
this
;
this
.
save
({
this
.
save
({
// The chat_state will be set to ACTIVE once the chat box is opened
// The chat_state will be set to ACTIVE once the chat box is opened
...
...
src/converse-chatview.js
View file @
de6ecbf0
This diff is collapsed.
Click to expand it.
src/converse-core.js
View file @
de6ecbf0
// Converse.js
(A browser based XMPP chat client)
// Converse.js
// http://conversejs.org
// http
s
://conversejs.org
//
//
// Copyright (c) 2012-201
7, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2012-201
8, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
// Licensed under the Mozilla Public License (MPLv2)
//
/*global Backbone, define, window, JSON */
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
"
sizzle
"
,
define
([
"
sizzle
"
,
"
es6-promise
"
,
"
es6-promise
"
,
...
@@ -80,6 +79,7 @@
...
@@ -80,6 +79,7 @@
'
converse-headline
'
,
'
converse-headline
'
,
'
converse-http-file-upload
'
,
'
converse-http-file-upload
'
,
'
converse-mam
'
,
'
converse-mam
'
,
'
converse-message-view
'
,
'
converse-minimize
'
,
'
converse-minimize
'
,
'
converse-modal
'
,
'
converse-modal
'
,
'
converse-muc
'
,
'
converse-muc
'
,
...
...
src/converse-http-file-upload.js
View file @
de6ecbf0
...
@@ -34,7 +34,6 @@
...
@@ -34,7 +34,6 @@
'
click .upload-file
'
:
'
toggleFileUpload
'
,
'
click .upload-file
'
:
'
toggleFileUpload
'
,
'
change input.fileupload
'
:
'
onFileSelection
'
'
change input.fileupload
'
:
'
onFileSelection
'
},
},
toggleFileUpload
(
ev
)
{
toggleFileUpload
(
ev
)
{
this
.
el
.
querySelector
(
'
input.fileupload
'
).
click
();
this
.
el
.
querySelector
(
'
input.fileupload
'
).
click
();
...
...
src/converse-message-view.js
View file @
de6ecbf0
...
@@ -90,11 +90,11 @@
...
@@ -90,11 +90,11 @@
msg_content
.
innerHTML
=
u
.
addEmoji
(
msg_content
.
innerHTML
=
u
.
addEmoji
(
_converse
,
emojione
,
u
.
addHyperlinks
(
xss
.
filterXSS
(
text
,
{
'
whiteList
'
:
{}}))
_converse
,
emojione
,
u
.
addHyperlinks
(
xss
.
filterXSS
(
text
,
{
'
whiteList
'
:
{}}))
);
);
if
(
msg_content
.
textContent
.
endsWith
(
'
mp4
'
))
{
if
(
msg_content
.
textContent
.
endsWith
(
'
mp4
'
))
{
msg_content
.
innerHTML
=
u
.
renderMovieURLs
(
msg_content
);
msg_content
.
innerHTML
=
u
.
renderMovieURLs
(
msg_content
);
}
else
if
(
msg_content
.
textContent
.
endsWith
(
'
mp3
'
))
{
}
else
if
(
msg_content
.
textContent
.
endsWith
(
'
mp3
'
))
{
msg_content
.
innerHTML
=
u
.
renderAudioURLs
(
msg_content
);
msg_content
.
innerHTML
=
u
.
renderAudioURLs
(
msg_content
);
}
else
{
}
else
{
u
.
renderImageURLs
(
msg_content
).
then
(()
=>
{
u
.
renderImageURLs
(
msg_content
).
then
(()
=>
{
this
.
model
.
collection
.
trigger
(
'
rendered
'
);
this
.
model
.
collection
.
trigger
(
'
rendered
'
);
...
...
src/converse-modal.js
View file @
de6ecbf0
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
if
(
typeof
define
===
'
function
'
&&
define
.
amd
)
{
if
(
typeof
define
===
'
function
'
&&
define
.
amd
)
{
define
([
define
([
...
...
src/converse-muc-views.js
View file @
de6ecbf0
...
@@ -515,6 +515,8 @@
...
@@ -515,6 +515,8 @@
this
.
markScrolled
=
_
.
debounce
(
this
.
_markScrolled
,
100
);
this
.
markScrolled
=
_
.
debounce
(
this
.
_markScrolled
,
100
);
this
.
model
.
messages
.
on
(
'
add
'
,
this
.
onMessageAdded
,
this
);
this
.
model
.
messages
.
on
(
'
add
'
,
this
.
onMessageAdded
,
this
);
this
.
model
.
messages
.
on
(
'
rendered
'
,
this
.
scrollDown
,
this
);
this
.
model
.
on
(
'
change:affiliation
'
,
this
.
renderHeading
,
this
);
this
.
model
.
on
(
'
change:affiliation
'
,
this
.
renderHeading
,
this
);
this
.
model
.
on
(
'
change:chat_state
'
,
this
.
sendChatState
,
this
);
this
.
model
.
on
(
'
change:chat_state
'
,
this
.
sendChatState
,
this
);
this
.
model
.
on
(
'
change:connection_status
'
,
this
.
afterConnected
,
this
);
this
.
model
.
on
(
'
change:connection_status
'
,
this
.
afterConnected
,
this
);
...
@@ -654,19 +656,6 @@
...
@@ -654,19 +656,6 @@
}
}
},
},
getExtraMessageClasses
(
attrs
)
{
let
extra_classes
=
_converse
.
ChatBoxView
.
prototype
.
getExtraMessageClasses
.
apply
(
this
,
arguments
);
if
(
this
.
is_chatroom
&&
attrs
.
sender
===
'
them
'
&&
this
.
model
.
isUserMentioned
(
attrs
.
message
))
{
// Add special class to mark groupchat messages
// in which we are mentioned.
extra_classes
+=
'
mentioned
'
;
}
return
extra_classes
;
},
getToolbarOptions
()
{
getToolbarOptions
()
{
return
_
.
extend
(
return
_
.
extend
(
_converse
.
ChatBoxView
.
prototype
.
getToolbarOptions
.
apply
(
this
,
arguments
),
_converse
.
ChatBoxView
.
prototype
.
getToolbarOptions
.
apply
(
this
,
arguments
),
...
...
src/templates/spoiler_message.html
View file @
de6ecbf0
<div
class=
"message chat-message {{{o.extra_classes}}}"
data-isodate=
"{{{o.isodate}}}"
data-msgid=
"{{{o.msgid}}}"
>
<div
class=
"message chat-message {{{o.extra_classes}}}"
data-isodate=
"{{{o.isodate}}}"
data-msgid=
"{{{o.msgid}}}"
>
<span
class=
"chat-msg-author chat-msg-{{{o.sender}}}"
>
{{{o.time}}} {{{o.username}}}:
</span>
<span
class=
"chat-msg-author chat-msg-{{{o.sender}}}"
>
{{{o.time}}} {{{o.username}}}:
</span>
<div
class=
"spoiler-hint"
>
<!-- message gets added here via renderMessage -->
</div>
<div
class=
"spoiler-hint"
>
{{{o.spoiler_hint}}}
</div>
<a
class=
"icon-eye toggle-spoiler"
data-toggle-state=
"closed"
href=
"#"
>
{{{o.label_show}}}
</a>
<a
class=
"icon-eye toggle-spoiler"
data-toggle-state=
"closed"
href=
"#"
>
{{{o.label_show}}}
</a>
<div
class=
"chat-msg-content spoiler collapsed"
>
<!-- message gets added here via renderMessage -->
</div>
<div
class=
"chat-msg-content spoiler collapsed"
>
<!-- message gets added here via renderMessage -->
</div>
</div>
</div>
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