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
80c955f2
Commit
80c955f2
authored
Jun 11, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix "retry" feature for message errors.
By registering a one-time event handler for a unique event name
parent
3f7e5e29
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
16 deletions
+21
-16
package-lock.json
package-lock.json
+13
-7
spec/mam.js
spec/mam.js
+0
-2
src/components/message-history.js
src/components/message-history.js
+1
-1
src/components/message.js
src/components/message.js
+4
-4
src/headless/converse-chat.js
src/headless/converse-chat.js
+1
-1
src/headless/converse-mam.js
src/headless/converse-mam.js
+2
-1
No files found.
package-lock.json
View file @
80c955f2
...
...
@@ -3234,7 +3234,8 @@
"dependencies"
:
{
"filesize"
:
{
"version"
:
"6.1.0"
,
"resolved"
:
false
"resolved"
:
"https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz"
,
"integrity"
:
"sha512-LpCHtPQ3sFx67z+uh2HnSyWSLLu5Jxo21795uRDuar/EOuYWXib5EmPaGIBuSnRqH2IODiKA2k5re/K9OnN/Yg=="
},
"fs-extra"
:
{
"version"
:
"8.1.0"
,
...
...
@@ -3268,7 +3269,8 @@
},
"jed"
:
{
"version"
:
"1.1.1"
,
"resolved"
:
false
"resolved"
:
"https://registry.npmjs.org/jed/-/jed-1.1.1.tgz"
,
"integrity"
:
"sha1-elSbvZ/+FYWwzQoZHiAwVb7ldLQ="
},
"jsonfile"
:
{
"version"
:
"5.0.0"
,
...
...
@@ -3289,7 +3291,8 @@
},
"localforage"
:
{
"version"
:
"1.7.3"
,
"resolved"
:
false
,
"resolved"
:
"https://registry.npmjs.org/localforage/-/localforage-1.7.3.tgz"
,
"integrity"
:
"sha512-1TulyYfc4udS7ECSBT2vwJksWbkwwTX8BzeUIiq8Y07Riy7bDAAnxDaPU/tWyOVmQAcWJIEIFP9lPfBGqVoPgQ=="
,
"requires"
:
{
"lie"
:
"3.1.1"
}
...
...
@@ -3301,13 +3304,14 @@
},
"pluggable.js"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
false
,
"resolved"
:
"https://registry.npmjs.org/pluggable.js/-/pluggable.js-2.0.1.tgz"
,
"integrity"
:
"sha512-SBt6v6Tbp20Jf8hU0cpcc/+HBHGMY8/Q+yA6Ih0tBQE8tfdZ6U4PRG0iNvUUjLx/hVyOP53n0UfGBymlfaaXCg=="
,
"requires"
:
{
"lodash"
:
"^4.17.11"
}
},
"skeletor.js"
:
{
"version"
:
"
0.0.
1"
,
"version"
:
"
github:skeletorjs/skeletor#bf6d9c86f9fcf224fa9d9af5a25380b77aa4b56
1"
,
"from"
:
"github:skeletorjs/skeletor#bf6d9c86f9fcf224fa9d9af5a25380b77aa4b561"
,
"requires"
:
{
"lodash"
:
"^4.17.14"
...
...
@@ -3315,11 +3319,13 @@
},
"strophe.js"
:
{
"version"
:
"1.3.4"
,
"resolved"
:
false
"resolved"
:
"https://registry.npmjs.org/strophe.js/-/strophe.js-1.3.4.tgz"
,
"integrity"
:
"sha512-jSLDG8jolhAwGOSgiJ7DTMSYK3wVoEJHKtpVRyEacQZ6CWA6z2WRPJpcFMjsIweq5aP9/XIvKUQqHBu/ZhvESA=="
},
"twemoji"
:
{
"version"
:
"12.1.5"
,
"resolved"
:
false
,
"resolved"
:
"https://registry.npmjs.org/twemoji/-/twemoji-12.1.5.tgz"
,
"integrity"
:
"sha512-B0PBVy5xomwb1M/WZxf/IqPZfnoIYy1skXnlHjMwLwTNfZ9ljh8VgWQktAPcJXu8080WoEh6YwQGPVhDVqvrVQ=="
,
"requires"
:
{
"fs-extra"
:
"^8.0.1"
,
"jsonfile"
:
"^5.0.0"
,
...
...
spec/mam.js
View file @
80c955f2
...
...
@@ -1065,8 +1065,6 @@ describe("Chatboxes", function () {
`</query>`
+
`</iq>`
);
await
u
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
converse-chat-message .spinner
'
),
1000
);
const
msg1
=
$msg
({
'
id
'
:
'
aeb212
'
,
'
to
'
:
contact_jid
})
.
c
(
'
result
'
,
{
'
xmlns
'
:
'
urn:xmpp:mam:2
'
,
'
queryid
'
:
queryid
,
'
id
'
:
'
28482-98726-73623
'
})
.
c
(
'
forwarded
'
,
{
'
xmlns
'
:
'
urn:xmpp:forward:0
'
})
...
...
src/components/message-history.js
View file @
80c955f2
...
...
@@ -14,7 +14,6 @@ const tpl_message = (o) => html`
.chatview=
${
o
.
chatview
}
.hats=
${
o
.
hats
}
.model=
${
o
.
model
}
?allow_retry=
${
o
.
retry
}
?correcting=
${
o
.
correcting
}
?editable=
${
o
.
editable
}
?has_mentions=
${
o
.
has_mentions
}
...
...
@@ -44,6 +43,7 @@ const tpl_message = (o) => html`
progress=
${
o
.
progress
||
0
}
reason=
${
o
.
reason
||
''
}
received=
${
o
.
received
||
''
}
retry_event_id=
${
o
.
retry_event_id
||
''
}
sender=
${
o
.
sender
}
spoiler_hint=
${
o
.
spoiler_hint
||
''
}
subject=
${
o
.
subject
||
''
}
...
...
src/components/message.js
View file @
80c955f2
...
...
@@ -24,16 +24,15 @@ class Message extends CustomElement {
static
get
properties
()
{
return
{
allow_retry
:
{
type
:
Boolean
},
chatview
:
{
type
:
Object
},
correcting
:
{
type
:
Boolean
},
editable
:
{
type
:
Boolean
},
edited
:
{
type
:
String
},
error
:
{
type
:
String
},
error_text
:
{
type
:
String
},
from
:
{
type
:
String
},
has_mentions
:
{
type
:
Boolean
},
hats
:
{
type
:
Array
},
edited
:
{
type
:
String
},
is_delayed
:
{
type
:
Boolean
},
is_encrypted
:
{
type
:
Boolean
},
is_first_unread
:
{
type
:
Boolean
},
...
...
@@ -54,6 +53,7 @@ class Message extends CustomElement {
reason
:
{
type
:
String
},
received
:
{
type
:
String
},
retractable
:
{
type
:
Boolean
},
retry_event_id
:
{
type
:
String
},
sender
:
{
type
:
String
},
show_spinner
:
{
type
:
Boolean
},
spoiler_hint
:
{
type
:
String
},
...
...
@@ -104,7 +104,7 @@ class Message extends CustomElement {
</div>
${
this
.
reason
?
html
`<q class="reason">
${
this
.
reason
}
</q>`
:
``
}
${
this
.
error_text
?
html
`<q class="reason">
${
this
.
error_text
}
</q>`
:
``
}
${
this
.
allow_retry
?
html
`<a class="retry" @click=
${
this
.
onRetryClicked
}
>
${
i18n_retry
}
</a>`
:
''
}
${
this
.
retry_event_id
?
html
`<a class="retry" @click=
${
this
.
onRetryClicked
}
>
${
i18n_retry
}
</a>`
:
''
}
</div>
`
;
}
...
...
@@ -144,7 +144,7 @@ class Message extends CustomElement {
async
onRetryClicked
()
{
this
.
show_spinner
=
true
;
await
this
.
model
.
error
.
retry
(
);
await
api
.
trigger
(
this
.
retry_event_id
,
{
'
synchronous
'
:
true
}
);
this
.
model
.
destroy
();
this
.
parentElement
.
removeChild
(
this
);
}
...
...
src/headless/converse-chat.js
View file @
80c955f2
...
...
@@ -543,7 +543,7 @@ converse.plugins.add('converse-chat', {
const
msg
=
await
this
.
createMessage
({
'
type
'
:
'
error
'
,
'
message
'
:
error
.
message
,
'
retry
'
:
true
'
retry
_event_id
'
:
error
.
retry_event_id
});
msg
.
error
=
error
;
}
...
...
src/headless/converse-mam.js
View file @
80c955f2
...
...
@@ -63,7 +63,8 @@ const MAMEnabledChat = {
result
.
messages
.
forEach
(
m
=>
this
.
queueMessage
(
m
));
if
(
result
.
error
)
{
result
.
error
.
retry
=
()
=>
this
.
fetchArchivedMessages
(
options
,
page_direction
);
const
event_id
=
result
.
error
.
retry_event_id
=
u
.
getUniqueId
();
api
.
listen
.
once
(
event_id
,
()
=>
this
.
fetchArchivedMessages
(
options
,
page_direction
));
this
.
createMessageFromError
(
result
.
error
);
}
},
...
...
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