OMEMO fixes for completely new user

Fix bugs related to there not being a server-side device list (not even an empty one) for a new user.
This commit is contained in:
JC Brand 2022-03-12 19:54:42 +01:00
parent 89a3c81a19
commit 731e98b07c
3 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ export default {
async get (jid, create=false) {
const list = _converse.devicelists.get(jid) ||
(create ? _converse.devicelists.create({ jid }) : null);
await list.initialized;
await list?.initialized;
return list;
}
},

View File

@ -30,7 +30,7 @@ const DeviceList = Model.extend({
async onDevicesFound (collection) {
if (collection.length === 0) {
let ids;
let ids = [];
try {
ids = await this.fetchDevicesFromServer();
} catch (e) {

View File

@ -453,7 +453,7 @@ export async function getDevicesForContact (jid) {
export async function generateDeviceID () {
/* Generates a device ID, making sure that it's unique */
const devicelist = await api.omemo.devicelists.get(_converse.bare_jid);
const devicelist = await api.omemo.devicelists.get(_converse.bare_jid, true);
const existing_ids = devicelist.devices.pluck('id');
let device_id = libsignal.KeyHelper.generateRegistrationId();