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

List member filter deactivated users #7876

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 3 additions & 5 deletions app/screens/manage_channel_members/manage_channel_members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {openAsBottomSheet, popTopScreen, setButtons} from '@screens/navigation';
import NavigationStore from '@store/navigation_store';
import {showRemoveChannelUserSnackbar} from '@utils/snack_bar';
import {changeOpacity, getKeyboardAppearanceFromTheme} from '@utils/theme';
import {displayUsername, filterProfilesMatchingTerm} from '@utils/user';
import {displayUsername, filterDeactivatedProfiles, filterProfilesMatchingTerm} from '@utils/user';

import type {AvailableScreens} from '@typings/screens/navigation';

Expand Down Expand Up @@ -216,10 +216,8 @@ export default function ManageChannelMembers({

const data = useMemo(() => {
const isSearch = Boolean(searchedTerm);
if (isSearch) {
return filterProfilesMatchingTerm(searchResults.length ? searchResults : sortedProfiles, searchedTerm);
}
return profiles;
const newProfiles = isSearch ? filterProfilesMatchingTerm(searchResults.length ? searchResults : sortedProfiles, searchedTerm) : profiles;
return filterDeactivatedProfiles(newProfiles);
}, [searchResults, profiles, searchedTerm, sortedProfiles]);

useEffect(() => {
Expand Down
4 changes: 4 additions & 0 deletions app/utils/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ export function filterProfilesMatchingTerm(users: UserProfile[], term: string):
});
}

export const filterDeactivatedProfiles = (users: UserProfile[]) => {
return users.filter((u) => isDeactivated(u) === false);
};

export function getNotificationProps(user?: UserModel) {
if (user && user.notifyProps) {
return user.notifyProps;
Expand Down