Skip to content

Commit

Permalink
Add payload to userStreamMembershipChanged (#278)
Browse files Browse the repository at this point in the history
so that it’s useful on it’s own
  • Loading branch information
texuf authored Jun 25, 2024
1 parent cda56e4 commit d72d6b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/sdk/src/streamEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
FullyReadMarker,
UserInboxPayload_GroupEncryptionSessions,
UserSettingsPayload_UserBlock,
UserPayload_UserMembership,
} from '@river-build/proto'

import {
Expand Down Expand Up @@ -60,7 +61,7 @@ export type StreamStateEvents = {
userJoinedStream: (streamId: string) => void
userInvitedToStream: (streamId: string) => void
userLeftStream: (streamId: string) => void
userStreamMembershipChanged: (streamId: string) => void
userStreamMembershipChanged: (streamId: string, payload: UserPayload_UserMembership) => void
spaceChannelCreated: (spaceId: string, channelId: string) => void
spaceChannelUpdated: (spaceId: string, channelId: string) => void
spaceChannelDeleted: (spaceId: string, channelId: string) => void
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/streamStateView_User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ export class StreamStateView_User extends StreamStateView_AbstractContent {
switch (op) {
case MembershipOp.SO_INVITE:
emitter?.emit('userInvitedToStream', streamId)
emitter?.emit('userStreamMembershipChanged', streamId)
emitter?.emit('userStreamMembershipChanged', streamId, payload)
break
case MembershipOp.SO_JOIN:
emitter?.emit('userJoinedStream', streamId)
emitter?.emit('userStreamMembershipChanged', streamId)
emitter?.emit('userStreamMembershipChanged', streamId, payload)
break
case MembershipOp.SO_LEAVE:
if (wasInvited || wasJoined) {
emitter?.emit('userLeftStream', streamId)
emitter?.emit('userStreamMembershipChanged', streamId)
emitter?.emit('userStreamMembershipChanged', streamId, payload)
}
break
case MembershipOp.SO_UNSPECIFIED:
Expand Down

0 comments on commit d72d6b4

Please sign in to comment.