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) {
|
export function formatToDeviceMessagesPayload(messages) {
|
||||||
const messagesByUser = groupBy(messages, message => message.device.userId);
|
const messagesByUser = groupBy(messages, message => message.device.user_id);
|
||||||
const payload = {
|
const payload = {
|
||||||
messages: Array.from(messagesByUser.entries()).reduce((userMap, [userId, messages]) => {
|
messages: Array.from(messagesByUser.entries()).reduce((userMap, [userId, messages]) => {
|
||||||
userMap[userId] = messages.reduce((deviceMap, message) => {
|
userMap[userId] = messages.reduce((deviceMap, message) => {
|
||||||
deviceMap[message.device.deviceId] = message.content;
|
deviceMap[message.device.device_id] = message.content;
|
||||||
return deviceMap;
|
return deviceMap;
|
||||||
}, {});
|
}, {});
|
||||||
return userMap;
|
return userMap;
|
||||||
|
@ -353,7 +353,7 @@ export class RoomEncryption {
|
|||||||
this._historyVisibility = await this._loadHistoryVisibilityIfNeeded(this._historyVisibility);
|
this._historyVisibility = await this._loadHistoryVisibilityIfNeeded(this._historyVisibility);
|
||||||
await this._deviceTracker.trackRoom(this._room, this._historyVisibility, log);
|
await this._deviceTracker.trackRoom(this._room, this._historyVisibility, log);
|
||||||
const devices = await this._deviceTracker.devicesForTrackedRoom(this._room.id, hsApi, 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 writeOpTxn = await this._storage.readWriteTxn([this._storage.storeNames.operations]);
|
||||||
let operation;
|
let operation;
|
||||||
@ -431,8 +431,8 @@ export class RoomEncryption {
|
|||||||
await log.wrap("send", log => this._sendMessagesToDevices(ENCRYPTED_TYPE, messages, hsApi, log));
|
await log.wrap("send", log => this._sendMessagesToDevices(ENCRYPTED_TYPE, messages, hsApi, log));
|
||||||
if (missingDevices.length) {
|
if (missingDevices.length) {
|
||||||
await log.wrap("missingDevices", async log => {
|
await log.wrap("missingDevices", async log => {
|
||||||
log.set("devices", missingDevices.map(d => d.deviceId));
|
log.set("devices", missingDevices.map(d => d.device_id));
|
||||||
const unsentUserIds = operation.userIds.filter(userId => missingDevices.some(d => d.userId === userId));
|
const unsentUserIds = operation.userIds.filter(userId => missingDevices.some(d => d.user_id === userId));
|
||||||
log.set("unsentUserIds", unsentUserIds);
|
log.set("unsentUserIds", unsentUserIds);
|
||||||
operation.userIds = unsentUserIds;
|
operation.userIds = unsentUserIds;
|
||||||
// first remove the users that we've sent the keys already from the operation,
|
// 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
|
// TODO: make this use _sendMessagesToDevices
|
||||||
async _sendSharedMessageToDevices(type, message, devices, hsApi, log) {
|
async _sendSharedMessageToDevices(type, message, devices, hsApi, log) {
|
||||||
const devicesByUser = groupBy(devices, device => device.userId);
|
const devicesByUser = groupBy(devices, device => device.user_id);
|
||||||
const payload = {
|
const payload = {
|
||||||
messages: Array.from(devicesByUser.entries()).reduce((userMap, [userId, devices]) => {
|
messages: Array.from(devicesByUser.entries()).reduce((userMap, [userId, devices]) => {
|
||||||
userMap[userId] = devices.reduce((deviceMap, device) => {
|
userMap[userId] = devices.reduce((deviceMap, device) => {
|
||||||
deviceMap[device.deviceId] = message;
|
deviceMap[device.device_id] = message;
|
||||||
return deviceMap;
|
return deviceMap;
|
||||||
}, {});
|
}, {});
|
||||||
return userMap;
|
return userMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user