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
1b08df89
Commit
1b08df89
authored
Mar 30, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't send OMEMO message when we don't have any devices for contact
parent
1a2e7b23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
dist/converse.js
dist/converse.js
+13
-2
src/converse-omemo.js
src/converse-omemo.js
+10
-2
No files found.
dist/converse.js
View file @
1b08df89
...
...
@@ -56393,6 +56393,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.api.alert.show(Strophe.LogLevel.ERROR, __('Error'), err_msgs);
_converse.log(e, Strophe.LogLevel.ERROR);
} else if (e.user_facing) {
_converse.api.alert.show(Strophe.LogLevel.ERROR, __('Error'), [e.message]);
_converse.log(e, Strophe.LogLevel.ERROR);
} else {
throw e;
...
...
@@ -56628,8 +56632,15 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
const collections = await Promise.all(chatbox.occupants.map(o => getDevicesForContact(o.get('jid'))));
devices = collections.reduce((a, b) => _.concat(a, b.models), []);
} else if (chatbox.get('type') === _converse.PRIVATE_CHAT_TYPE) {
const their_devices = await getDevicesForContact(chatbox.get('jid')),
own_devices = _converse.devicelists.get(_converse.bare_jid).devices;
const their_devices = await getDevicesForContact(chatbox.get('jid'));
if (their_devices.length === 0) {
const err = new Error(__("Sorry, we aren't able to fetch any devices to send an OMEMO encrypted message to."));
err.user_facing = true;
throw err;
}
const own_devices = _converse.devicelists.get(_converse.bare_jid).devices;
devices = _.concat(own_devices.models, their_devices.models);
}
src/converse-omemo.js
View file @
1b08df89
...
...
@@ -338,6 +338,9 @@ converse.plugins.add('converse-omemo', {
}
_converse
.
api
.
alert
.
show
(
Strophe
.
LogLevel
.
ERROR
,
__
(
'
Error
'
),
err_msgs
);
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
}
else
if
(
e
.
user_facing
)
{
_converse
.
api
.
alert
.
show
(
Strophe
.
LogLevel
.
ERROR
,
__
(
'
Error
'
),
[
e
.
message
]);
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
}
else
{
throw
e
;
}
...
...
@@ -553,8 +556,13 @@ converse.plugins.add('converse-omemo', {
const
collections
=
await
Promise
.
all
(
chatbox
.
occupants
.
map
(
o
=>
getDevicesForContact
(
o
.
get
(
'
jid
'
))));
devices
=
collections
.
reduce
((
a
,
b
)
=>
_
.
concat
(
a
,
b
.
models
),
[]);
}
else
if
(
chatbox
.
get
(
'
type
'
)
===
_converse
.
PRIVATE_CHAT_TYPE
)
{
const
their_devices
=
await
getDevicesForContact
(
chatbox
.
get
(
'
jid
'
)),
own_devices
=
_converse
.
devicelists
.
get
(
_converse
.
bare_jid
).
devices
;
const
their_devices
=
await
getDevicesForContact
(
chatbox
.
get
(
'
jid
'
));
if
(
their_devices
.
length
===
0
)
{
const
err
=
new
Error
(
__
(
"
Sorry, we aren't able to fetch any devices to send an OMEMO encrypted message to.
"
));
err
.
user_facing
=
true
;
throw
err
;
}
const
own_devices
=
_converse
.
devicelists
.
get
(
_converse
.
bare_jid
).
devices
;
devices
=
_
.
concat
(
own_devices
.
models
,
their_devices
.
models
);
}
await
Promise
.
all
(
devices
.
map
(
d
=>
d
.
getBundle
()));
...
...
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