Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix channel.membership type #1300

Merged
merged 6 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 1 addition & 2 deletions src/channel_state.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Channel } from './channel';
import {
ChannelMemberResponse,
ChannelMembership,
FormatMessageResponse,
Event,
ExtendableGenerics,
Expand Down Expand Up @@ -42,7 +41,7 @@ export class ChannelState<StreamChatGenerics extends ExtendableGenerics = Defaul
watchers: Record<string, UserResponse<StreamChatGenerics>>;
members: Record<string, ChannelMemberResponse<StreamChatGenerics>>;
unreadCount: number;
membership: ChannelMembership<StreamChatGenerics>;
membership: ChannelMemberResponse<StreamChatGenerics>;
last_message_at: Date | null;
/**
* Flag which indicates if channel state contain latest/recent messages or no.
Expand Down
27 changes: 11 additions & 16 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export type ChannelAPIResponse<StreamChatGenerics extends ExtendableGenerics = D
messages: MessageResponse<StreamChatGenerics>[];
pinned_messages: MessageResponse<StreamChatGenerics>[];
hidden?: boolean;
membership?: ChannelMembership<StreamChatGenerics> | null;
membership?: ChannelMemberResponse<StreamChatGenerics> | null;
pending_messages?: PendingMessageResponse<StreamChatGenerics>[];
read?: ReadResponse<StreamChatGenerics>[];
threads?: ThreadResponse[];
Expand All @@ -331,6 +331,7 @@ export type ChannelMemberAPIResponse<StreamChatGenerics extends ExtendableGeneri
};

export type ChannelMemberResponse<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
ban_expires?: string;
banned?: boolean;
channel_role?: Role;
created_at?: string;
Expand Down Expand Up @@ -1667,9 +1668,9 @@ export type UserFilters<StreamChatGenerics extends ExtendableGenerics = DefaultG
| PrimitiveFilter<UserResponse<StreamChatGenerics>['name']>;
notifications_muted?:
| RequireOnlyOne<{
$eq?: PrimitiveFilter<UserResponse<StreamChatGenerics>['notifications_muted']>;
}>
| boolean;
$eq?: PrimitiveFilter<UserResponse<StreamChatGenerics>['notifications_muted']>;
}>
| boolean;
teams?:
| RequireOnlyOne<{
$contains?: PrimitiveFilter<string>;
Expand Down Expand Up @@ -2042,18 +2043,12 @@ export type ChannelData<
name?: string;
};

export type ChannelMembership<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
banned?: boolean;
channel_role?: Role;
created_at?: string;
is_moderator?: boolean;
notifications_muted?: boolean;
role?: string;
shadow_banned?: boolean;
status?: string;
updated_at?: string;
user?: UserResponse<StreamChatGenerics>;
};
/**
* @deprecated Use ChannelMemberResponse instead
*/
export type ChannelMembership<
StreamChatGenerics extends ExtendableGenerics = DefaultGenerics
> = ChannelMemberResponse<StreamChatGenerics>;

export type ChannelMute<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
user: UserResponse<StreamChatGenerics>;
Expand Down
Loading