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
e7ceb22a
Commit
e7ceb22a
authored
May 17, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid duplication by keeping track of message views
parent
0fa6bcdc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
src/converse-chatview.js
src/converse-chatview.js
+8
-4
No files found.
src/converse-chatview.js
View file @
e7ceb22a
...
@@ -309,7 +309,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -309,7 +309,7 @@ converse.plugins.add('converse-chatview', {
* @namespace _converse.ChatBoxView
* @namespace _converse.ChatBoxView
* @memberOf _converse
* @memberOf _converse
*/
*/
_converse
.
ChatBoxView
=
Backbone
.
NativeV
iew
.
extend
({
_converse
.
ChatBoxView
=
Backbone
.
Overv
iew
.
extend
({
length
:
200
,
length
:
200
,
className
:
'
chatbox hidden
'
,
className
:
'
chatbox hidden
'
,
is_chatroom
:
false
,
// Leaky abstraction from MUC
is_chatroom
:
false
,
// Leaky abstraction from MUC
...
@@ -804,7 +804,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -804,7 +804,7 @@ converse.plugins.add('converse-chatview', {
// text to show.
// text to show.
return
message
.
destroy
();
return
message
.
destroy
();
}
}
const
view
=
new
_converse
.
MessageView
({
'
model
'
:
message
}
);
const
view
=
this
.
add
(
message
.
get
(
'
id
'
),
new
_converse
.
MessageView
({
'
model
'
:
message
})
);
await
view
.
render
();
await
view
.
render
();
// Clear chat state notifications
// Clear chat state notifications
...
@@ -838,8 +838,12 @@ converse.plugins.add('converse-chatview', {
...
@@ -838,8 +838,12 @@ converse.plugins.add('converse-chatview', {
* @method _converse.ChatBoxView#onMessageAdded
* @method _converse.ChatBoxView#onMessageAdded
* @param { object } message - The message Backbone object that was added.
* @param { object } message - The message Backbone object that was added.
*/
*/
onMessageAdded
(
message
)
{
async
onMessageAdded
(
message
)
{
this
.
showMessage
(
message
);
if
(
this
.
get
(
message
.
get
(
'
id
'
)))
{
// We already have a view for this message
return
;
}
await
this
.
showMessage
(
message
);
if
(
message
.
get
(
'
correcting
'
))
{
if
(
message
.
get
(
'
correcting
'
))
{
this
.
insertIntoTextArea
(
message
.
get
(
'
message
'
),
true
,
true
);
this
.
insertIntoTextArea
(
message
.
get
(
'
message
'
),
true
,
true
);
}
}
...
...
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