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
299fa4f3
Commit
299fa4f3
authored
Aug 17, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nicer error logging when translations are not found
parent
e123c690
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
13 deletions
+25
-13
dist/converse.js
dist/converse.js
+11
-6
src/converse-chatboxes.js
src/converse-chatboxes.js
+9
-3
src/converse-core.js
src/converse-core.js
+1
-1
src/i18n.js
src/i18n.js
+4
-3
No files found.
dist/converse.js
View file @
299fa4f3
...
@@ -69476,8 +69476,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -69476,8 +69476,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
* Parameters:
* Parameters:
* (XMLElement) stanza - The incoming message stanza
* (XMLElement) stanza - The incoming message stanza
*/
*/
let from_jid = stanza.getAttribute('from'),
let to_jid = stanza.getAttribute('to');
to_jid = stanza.getAttribute('to');
const to_resource = Strophe.getResourceFromJid(to_jid);
const to_resource = Strophe.getResourceFromJid(to_jid);
if (_converse.filter_by_resource && to_resource && to_resource !== _converse.resource) {
if (_converse.filter_by_resource && to_resource && to_resource !== _converse.resource) {
...
@@ -69488,11 +69487,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -69488,11 +69487,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
// XXX: Ideally we wouldn't have to check for headline
// XXX: Ideally we wouldn't have to check for headline
// messages, but Prosody sends headline messages with the
// messages, but Prosody sends headline messages with the
// wrong type ('chat'), so we need to filter them out here.
// wrong type ('chat'), so we need to filter them out here.
_converse.log(`onMessage: Ignoring incoming headline message sent with type 'chat' from JID: ${
from_jid
}`, Strophe.LogLevel.INFO);
_converse.log(`onMessage: Ignoring incoming headline message sent with type 'chat' from JID: ${
stanza.getAttribute('from')
}`, Strophe.LogLevel.INFO);
return true;
return true;
}
}
let from_jid = stanza.getAttribute('from');
const forwarded = stanza.querySelector('forwarded'),
const forwarded = stanza.querySelector('forwarded'),
original_stanza = stanza;
original_stanza = stanza;
...
@@ -69519,6 +69519,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -69519,6 +69519,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
if (is_me) {
if (is_me) {
// I am the sender, so this must be a forwarded message...
// I am the sender, so this must be a forwarded message...
if (_.isNull(to_jid)) {
return _converse.log(`Don't know how to handle message stanza without 'to' attribute. ${stanza.outerHTML}`, Strophe.LogLevel.ERROR);
}
contact_jid = Strophe.getBareJidFromJid(to_jid);
contact_jid = Strophe.getBareJidFromJid(to_jid);
} else {
} else {
contact_jid = from_bare_jid;
contact_jid = from_bare_jid;
...
@@ -73139,7 +73143,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -73139,7 +73143,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
} else {
} else {
i18n.fetchTranslations(_converse.locale, _converse.locales, u.interpolate(_converse.locales_url, {
i18n.fetchTranslations(_converse.locale, _converse.locales, u.interpolate(_converse.locales_url, {
'locale': _converse.locale
'locale': _converse.locale
})).catch(
_.partial(_converse.log, _
, Strophe.LogLevel.FATAL)).then(finishInitialization).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
})).catch(
e => _converse.log(e.message
, Strophe.LogLevel.FATAL)).then(finishInitialization).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}
}
return init_promise;
return init_promise;
...
@@ -84619,8 +84623,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
...
@@ -84619,8 +84623,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
}
};
};
xhr.onerror = function () {
xhr.onerror = e => {
reject(xhr.statusText);
const err_message = e ? ` Error: ${e.message}` : '';
reject(new Error(`Could not fetch translations. Status: ${xhr.statusText}. ${err_message}`));
};
};
xhr.send();
xhr.send();
src/converse-chatboxes.js
View file @
299fa4f3
...
@@ -667,8 +667,7 @@
...
@@ -667,8 +667,7 @@
* Parameters:
* Parameters:
* (XMLElement) stanza - The incoming message stanza
* (XMLElement) stanza - The incoming message stanza
*/
*/
let
from_jid
=
stanza
.
getAttribute
(
'
from
'
),
let
to_jid
=
stanza
.
getAttribute
(
'
to
'
);
to_jid
=
stanza
.
getAttribute
(
'
to
'
);
const
to_resource
=
Strophe
.
getResourceFromJid
(
to_jid
);
const
to_resource
=
Strophe
.
getResourceFromJid
(
to_jid
);
if
(
_converse
.
filter_by_resource
&&
(
to_resource
&&
to_resource
!==
_converse
.
resource
))
{
if
(
_converse
.
filter_by_resource
&&
(
to_resource
&&
to_resource
!==
_converse
.
resource
))
{
...
@@ -682,12 +681,13 @@
...
@@ -682,12 +681,13 @@
// messages, but Prosody sends headline messages with the
// messages, but Prosody sends headline messages with the
// wrong type ('chat'), so we need to filter them out here.
// wrong type ('chat'), so we need to filter them out here.
_converse
.
log
(
_converse
.
log
(
`onMessage: Ignoring incoming headline message sent with type 'chat' from JID:
${
from_jid
}
`
,
`onMessage: Ignoring incoming headline message sent with type 'chat' from JID:
${
stanza
.
getAttribute
(
'
from
'
)
}
`
,
Strophe
.
LogLevel
.
INFO
Strophe
.
LogLevel
.
INFO
);
);
return
true
;
return
true
;
}
}
let
from_jid
=
stanza
.
getAttribute
(
'
from
'
);
const
forwarded
=
stanza
.
querySelector
(
'
forwarded
'
),
const
forwarded
=
stanza
.
querySelector
(
'
forwarded
'
),
original_stanza
=
stanza
;
original_stanza
=
stanza
;
...
@@ -713,6 +713,12 @@
...
@@ -713,6 +713,12 @@
let
contact_jid
;
let
contact_jid
;
if
(
is_me
)
{
if
(
is_me
)
{
// I am the sender, so this must be a forwarded message...
// I am the sender, so this must be a forwarded message...
if
(
_
.
isNull
(
to_jid
))
{
return
_converse
.
log
(
`Don't know how to handle message stanza without 'to' attribute.
${
stanza
.
outerHTML
}
`
,
Strophe
.
LogLevel
.
ERROR
);
}
contact_jid
=
Strophe
.
getBareJidFromJid
(
to_jid
);
contact_jid
=
Strophe
.
getBareJidFromJid
(
to_jid
);
}
else
{
}
else
{
contact_jid
=
from_bare_jid
;
contact_jid
=
from_bare_jid
;
...
...
src/converse-core.js
View file @
299fa4f3
...
@@ -1189,7 +1189,7 @@
...
@@ -1189,7 +1189,7 @@
_converse
.
locale
,
_converse
.
locale
,
_converse
.
locales
,
_converse
.
locales
,
u
.
interpolate
(
_converse
.
locales_url
,
{
'
locale
'
:
_converse
.
locale
}))
u
.
interpolate
(
_converse
.
locales_url
,
{
'
locale
'
:
_converse
.
locale
}))
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
))
.
catch
(
e
=>
_converse
.
log
(
e
.
message
,
Strophe
.
LogLevel
.
FATAL
))
.
then
(
finishInitialization
)
.
then
(
finishInitialization
)
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
.
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
}
...
...
src/i18n.js
View file @
299fa4f3
...
@@ -159,9 +159,10 @@
...
@@ -159,9 +159,10 @@
xhr
.
onerror
();
xhr
.
onerror
();
}
}
};
};
xhr
.
onerror
=
function
()
{
xhr
.
onerror
=
(
e
)
=>
{
reject
(
xhr
.
statusText
);
const
err_message
=
e
?
` Error:
${
e
.
message
}
`
:
''
;
};
reject
(
new
Error
(
`Could not fetch translations. Status:
${
xhr
.
statusText
}
.
${
err_message
}
`
));
}
xhr
.
send
();
xhr
.
send
();
});
});
}
}
...
...
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