Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit 4c2efba

Browse files
authored
fix: do not send channel member update on every member (#701)
1 parent e650bdf commit 4c2efba

1 file changed

Lines changed: 0 additions & 42 deletions

File tree

packages/shared/friends/sagas.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -390,29 +390,6 @@ function* configureMatrixClient(action: SetMatrixClient) {
390390
handleIncomingFriendshipUpdateStatus(FriendshipAction.REJECTED, socialId)
391391
)
392392

393-
client.onChannelMembers((conversation, members) => {
394-
if (!areChannelsEnabled()) return
395-
396-
if (conversation.name && !conversation.name.startsWith('Empty room')) {
397-
updateChannelInfo(conversation, client)
398-
}
399-
400-
// we only notify members who are online if presence is enabled, else every joined member
401-
const memberIds = members.map((member) => member.userId)
402-
const onlineOrJoinedMemberIds = getOnlineOrJoinedMembers(memberIds, client)
403-
404-
const channelMembers: ChannelMember[] = members
405-
.filter((member) => onlineOrJoinedMemberIds.includes(member.userId))
406-
.map((member) => ({
407-
userId: getUserIdFromMatrix(member.userId),
408-
name: member.name,
409-
isOnline: true // TODO - should we avoid this when presence is disabled? - moliva - 2022/11/09
410-
}))
411-
412-
const update: UpdateChannelMembersPayload = { channelId: conversation.id, members: channelMembers }
413-
getUnityInstance().UpdateChannelMembers(update)
414-
})
415-
416393
client.onChannelMembership((conversation, membership) => {
417394
if (!areChannelsEnabled()) return
418395

@@ -479,25 +456,6 @@ function getOnlineOrJoinedMembersCount(client: SocialAPI, conversation: Conversa
479456
return getOnlineMembersCount(client, conversation.userIds)
480457
}
481458

482-
function updateChannelInfo(conversation: Conversation, client: SocialAPI) {
483-
const onlineMembers = getOnlineOrJoinedMembersCount(client, conversation)
484-
const profile = getCurrentUserProfile(store.getState())
485-
const muted = profile?.muted?.includes(conversation.id) ?? false
486-
487-
const channel = {
488-
name: getNormalizedRoomName(conversation.name || ''),
489-
channelId: conversation.id,
490-
unseenMessages: muted ? 0 : conversation.unreadMessages?.length || 0,
491-
lastMessageTimestamp: conversation.lastEventTimestamp || undefined,
492-
memberCount: onlineMembers,
493-
description: '',
494-
joined: true,
495-
muted
496-
}
497-
498-
getUnityInstance().UpdateChannelInfo({ channelInfoPayload: [channel] })
499-
}
500-
501459
// this saga needs to throw in case of failure
502460
function* initializePrivateMessaging() {
503461
const synapseUrl: string = yield select(getSynapseUrl)

0 commit comments

Comments
 (0)