mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Use new prop names
This commit is contained in:
parent
a87edcf99e
commit
82a7c9d4bf
@ -33,11 +33,11 @@ export function isTxnId(txnId) {
|
||||
}
|
||||
|
||||
export function formatToDeviceMessagesPayload(messages) {
|
||||
const messagesByUser = groupBy(messages, message => message.device.userId);
|
||||
const messagesByUser = groupBy(messages, message => message.device.user_id);
|
||||
const payload = {
|
||||
messages: Array.from(messagesByUser.entries()).reduce((userMap, [userId, messages]) => {
|
||||
userMap[userId] = messages.reduce((deviceMap, message) => {
|
||||
deviceMap[message.device.deviceId] = message.content;
|
||||
deviceMap[message.device.device_id] = message.content;
|
||||
return deviceMap;
|
||||
}, {});
|
||||
return userMap;
|
||||
|
@ -353,7 +353,7 @@ export class RoomEncryption {
|
||||
this._historyVisibility = await this._loadHistoryVisibilityIfNeeded(this._historyVisibility);
|
||||
await this._deviceTracker.trackRoom(this._room, this._historyVisibility, log);
|
||||
const devices = await this._deviceTracker.devicesForTrackedRoom(this._room.id, hsApi, log);
|
||||
const userIds = Array.from(devices.reduce((set, device) => set.add(device.userId), new Set()));
|
||||
const userIds = Array.from(devices.reduce((set, device) => set.add(device.user_id), new Set()));
|
||||
|
||||
let writeOpTxn = await this._storage.readWriteTxn([this._storage.storeNames.operations]);
|
||||
let operation;
|
||||
@ -431,8 +431,8 @@ export class RoomEncryption {
|
||||
await log.wrap("send", log => this._sendMessagesToDevices(ENCRYPTED_TYPE, messages, hsApi, log));
|
||||
if (missingDevices.length) {
|
||||
await log.wrap("missingDevices", async log => {
|
||||
log.set("devices", missingDevices.map(d => d.deviceId));
|
||||
const unsentUserIds = operation.userIds.filter(userId => missingDevices.some(d => d.userId === userId));
|
||||
log.set("devices", missingDevices.map(d => d.device_id));
|
||||
const unsentUserIds = operation.userIds.filter(userId => missingDevices.some(d => d.user_id === userId));
|
||||
log.set("unsentUserIds", unsentUserIds);
|
||||
operation.userIds = unsentUserIds;
|
||||
// first remove the users that we've sent the keys already from the operation,
|
||||
@ -459,11 +459,11 @@ export class RoomEncryption {
|
||||
|
||||
// TODO: make this use _sendMessagesToDevices
|
||||
async _sendSharedMessageToDevices(type, message, devices, hsApi, log) {
|
||||
const devicesByUser = groupBy(devices, device => device.userId);
|
||||
const devicesByUser = groupBy(devices, device => device.user_id);
|
||||
const payload = {
|
||||
messages: Array.from(devicesByUser.entries()).reduce((userMap, [userId, devices]) => {
|
||||
userMap[userId] = devices.reduce((deviceMap, device) => {
|
||||
deviceMap[device.deviceId] = message;
|
||||
deviceMap[device.device_id] = message;
|
||||
return deviceMap;
|
||||
}, {});
|
||||
return userMap;
|
||||
|
Loading…
Reference in New Issue
Block a user