Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions packages/shared/friends/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,29 +390,6 @@ function* configureMatrixClient(action: SetMatrixClient) {
handleIncomingFriendshipUpdateStatus(FriendshipAction.REJECTED, socialId)
)

client.onChannelMembers((conversation, members) => {
if (!areChannelsEnabled()) return

if (conversation.name && !conversation.name.startsWith('Empty room')) {
updateChannelInfo(conversation, client)
}

// we only notify members who are online if presence is enabled, else every joined member
const memberIds = members.map((member) => member.userId)
const onlineOrJoinedMemberIds = getOnlineOrJoinedMembers(memberIds, client)

const channelMembers: ChannelMember[] = members
.filter((member) => onlineOrJoinedMemberIds.includes(member.userId))
.map((member) => ({
userId: getUserIdFromMatrix(member.userId),
name: member.name,
isOnline: true // TODO - should we avoid this when presence is disabled? - moliva - 2022/11/09
}))

const update: UpdateChannelMembersPayload = { channelId: conversation.id, members: channelMembers }
getUnityInstance().UpdateChannelMembers(update)
})

client.onChannelMembership((conversation, membership) => {
if (!areChannelsEnabled()) return

Expand Down Expand Up @@ -479,25 +456,6 @@ function getOnlineOrJoinedMembersCount(client: SocialAPI, conversation: Conversa
return getOnlineMembersCount(client, conversation.userIds)
}

function updateChannelInfo(conversation: Conversation, client: SocialAPI) {
const onlineMembers = getOnlineOrJoinedMembersCount(client, conversation)
const profile = getCurrentUserProfile(store.getState())
const muted = profile?.muted?.includes(conversation.id) ?? false

const channel = {
name: getNormalizedRoomName(conversation.name || ''),
channelId: conversation.id,
unseenMessages: muted ? 0 : conversation.unreadMessages?.length || 0,
lastMessageTimestamp: conversation.lastEventTimestamp || undefined,
memberCount: onlineMembers,
description: '',
joined: true,
muted
}

getUnityInstance().UpdateChannelInfo({ channelInfoPayload: [channel] })
}

// this saga needs to throw in case of failure
function* initializePrivateMessaging() {
const synapseUrl: string = yield select(getSynapseUrl)
Expand Down