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
29c2a964
Commit
29c2a964
authored
May 25, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bot message doesn't appear when it has the same id as its command
parent
aaaacf25
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
9 deletions
+20
-9
docs/CHANGES.md
docs/CHANGES.md
+2
-0
src/converse-core.js
src/converse-core.js
+2
-4
src/converse-muc.js
src/converse-muc.js
+16
-5
No files found.
docs/CHANGES.md
View file @
29c2a964
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
-
Bugfix. Login form doesn't render after logging out, when
`auto_reconnect = false`
-
Bugfix. Login form doesn't render after logging out, when
`auto_reconnect = false`
[jcbrand]
[jcbrand]
-
Also indicate new day for the first day's messages. [jcbrand]
-
Also indicate new day for the first day's messages. [jcbrand]
-
Chat bot messages don't appear when they have the same ids as their commands.
[jcbrand]
## 1.0.2 (2016-05-24)
## 1.0.2 (2016-05-24)
...
...
src/converse-core.js
View file @
29c2a964
...
@@ -1134,7 +1134,6 @@
...
@@ -1134,7 +1134,6 @@
this
.
Message
=
Backbone
.
Model
.
extend
({
this
.
Message
=
Backbone
.
Model
.
extend
({
idAttribute
:
'
msgid
'
,
defaults
:
function
(){
defaults
:
function
(){
return
{
return
{
msgid
:
converse
.
connection
.
getUniqueId
()
msgid
:
converse
.
connection
.
getUniqueId
()
...
@@ -1173,7 +1172,6 @@
...
@@ -1173,7 +1172,6 @@
delayed
=
$delay
.
length
>
0
,
delayed
=
$delay
.
length
>
0
,
fullname
=
this
.
get
(
'
fullname
'
),
fullname
=
this
.
get
(
'
fullname
'
),
is_groupchat
=
$message
.
attr
(
'
type
'
)
===
'
groupchat
'
,
is_groupchat
=
$message
.
attr
(
'
type
'
)
===
'
groupchat
'
,
msgid
=
$message
.
attr
(
'
id
'
),
chat_state
=
$message
.
find
(
converse
.
COMPOSING
).
length
&&
converse
.
COMPOSING
||
chat_state
=
$message
.
find
(
converse
.
COMPOSING
).
length
&&
converse
.
COMPOSING
||
$message
.
find
(
converse
.
PAUSED
).
length
&&
converse
.
PAUSED
||
$message
.
find
(
converse
.
PAUSED
).
length
&&
converse
.
PAUSED
||
$message
.
find
(
converse
.
INACTIVE
).
length
&&
converse
.
INACTIVE
||
$message
.
find
(
converse
.
INACTIVE
).
length
&&
converse
.
INACTIVE
||
...
@@ -1205,13 +1203,13 @@
...
@@ -1205,13 +1203,13 @@
delayed
:
delayed
,
delayed
:
delayed
,
fullname
:
fullname
,
fullname
:
fullname
,
message
:
body
||
undefined
,
message
:
body
||
undefined
,
msgid
:
msgid
,
msgid
:
$message
.
attr
(
'
id
'
)
,
sender
:
sender
,
sender
:
sender
,
time
:
time
time
:
time
});
});
}
}
});
});
this
.
ChatBoxes
=
Backbone
.
Collection
.
extend
({
this
.
ChatBoxes
=
Backbone
.
Collection
.
extend
({
model
:
converse
.
ChatBox
,
model
:
converse
.
ChatBox
,
comparator
:
'
time_opened
'
,
comparator
:
'
time_opened
'
,
...
...
src/converse-muc.js
View file @
29c2a964
...
@@ -830,7 +830,6 @@
...
@@ -830,7 +830,6 @@
var
$message
=
$
(
message
),
var
$message
=
$
(
message
),
$forwarded
=
$message
.
find
(
'
forwarded
'
),
$forwarded
=
$message
.
find
(
'
forwarded
'
),
$delay
;
$delay
;
if
(
$forwarded
.
length
)
{
if
(
$forwarded
.
length
)
{
$message
=
$forwarded
.
children
(
'
message
'
);
$message
=
$forwarded
.
children
(
'
message
'
);
$delay
=
$forwarded
.
children
(
'
delay
'
);
$delay
=
$forwarded
.
children
(
'
delay
'
);
...
@@ -839,10 +838,22 @@
...
@@ -839,10 +838,22 @@
msgid
=
$message
.
attr
(
'
id
'
),
msgid
=
$message
.
attr
(
'
id
'
),
resource
=
Strophe
.
getResourceFromJid
(
jid
),
resource
=
Strophe
.
getResourceFromJid
(
jid
),
sender
=
resource
&&
Strophe
.
unescapeNode
(
resource
)
||
''
,
sender
=
resource
&&
Strophe
.
unescapeNode
(
resource
)
||
''
,
subject
=
$message
.
children
(
'
subject
'
).
text
();
subject
=
$message
.
children
(
'
subject
'
).
text
(),
text
=
$message
.
find
(
'
body
'
).
text
(),
if
(
msgid
&&
this
.
model
.
messages
.
findWhere
({
msgid
:
msgid
}))
{
collision
=
msgid
&&
this
.
model
.
messages
.
findWhere
({
'
msgid
'
:
msgid
});
return
true
;
// We already have this message stored.
if
(
collision
)
{
// We already have a message with this id stored.
// It might therefore be a duplicate, but we cannot yet be
// 100% sure. Some bots (like HAL in the prosody
// chatroom) respond to commands with the same ID as
// the original message. We therefore also check whether
// the sender is the same and then lastly whether the
// message text is the same.
if
(
collision
.
get
(
'
fullname
'
)
===
sender
)
{
if
(
this
.
model
.
messages
.
findWhere
({
'
message
'
:
text
}))
{
return
true
;
}
}
}
}
if
(
subject
)
{
if
(
subject
)
{
this
.
$el
.
find
(
'
.chatroom-topic
'
).
text
(
subject
).
attr
(
'
title
'
,
subject
);
this
.
$el
.
find
(
'
.chatroom-topic
'
).
text
(
subject
).
attr
(
'
title
'
,
subject
);
...
...
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