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: remove channel constants - isAdmin, isOwner and isModerator #2778

Merged
merged 5 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
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
14 changes: 0 additions & 14 deletions package/src/components/Channel/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -764,17 +764,6 @@ const ChannelWithContext = <

useAppStateListener(undefined, handleAppBackground);

/**
* CHANNEL CONSTANTS
*/
const isAdmin = client?.user?.role === 'admin' || channel?.state.membership.role === 'admin';

const isModerator =
channel?.state.membership.role === 'channel_moderator' ||
channel?.state.membership.role === 'moderator';

const isOwner = channel?.state.membership.role === 'owner';

/**
* CHANNEL METHODS
*/
Expand Down Expand Up @@ -2156,10 +2145,7 @@ const ChannelWithContext = <
!!(clientChannelConfig?.commands || [])?.some((command) => command.name === 'giphy'),
hideDateSeparators,
hideStickyDateHeader,
isAdmin,
isChannelActive: shouldSyncChannel,
isModerator,
isOwner,
lastRead,
loadChannelAroundMessage,
loading,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ export const useCreateChannelContext = <
giphyEnabled,
hideDateSeparators,
hideStickyDateHeader,
isAdmin,
isChannelActive,
isModerator,
isOwner,
lastRead,
loadChannelAroundMessage,
loading,
Expand Down Expand Up @@ -58,10 +55,7 @@ export const useCreateChannelContext = <
giphyEnabled,
hideDateSeparators,
hideStickyDateHeader,
isAdmin,
isChannelActive,
isModerator,
isOwner,
lastRead,
loadChannelAroundMessage,
loading,
Expand Down
12 changes: 0 additions & 12 deletions package/src/contexts/channelContext/ChannelContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,6 @@ export type ChannelContextValue<
*/
hideDateSeparators: boolean;
hideStickyDateHeader: boolean;
/**
* Returns true if the current user has admin privileges
*/
isAdmin: boolean;
/**
* Returns true if the current user is a moderator
*/
isModerator: boolean;
/**
* Returns true if the current user is a owner
*/
isOwner: boolean;
/**
* Loads channel around a specific message
*
Expand Down
Loading