Fix error for duplicate room memberships
This commit is contained in:
parent
5d5c751de8
commit
4a54b63cc0
@ -64,10 +64,13 @@ export async function mapRoom(rcRoom: RcRoom): Promise<MatrixRoom> {
|
|||||||
|
|
||||||
if (rcRoom.uids) {
|
if (rcRoom.uids) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
rcRoom.uids.map(async (uid) => {
|
[...new Set(rcRoom.uids)] // Deduplicate users
|
||||||
await createMembership(rcRoom._id, uid)
|
.map(async (uid) => {
|
||||||
log.debug(`${uid} membership in direct chat ${rcRoom._id} created`)
|
await createMembership(rcRoom._id, uid)
|
||||||
})
|
log.debug(
|
||||||
|
`${uid} membership in direct chat ${rcRoom._id} created`
|
||||||
|
)
|
||||||
|
})
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Found a direct chat without uids. This is unexpected.')
|
throw new Error('Found a direct chat without uids. This is unexpected.')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user