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

Searchable teams filter #61

Merged
merged 4 commits into from
Nov 21, 2024
Merged

Searchable teams filter #61

merged 4 commits into from
Nov 21, 2024

Conversation

harshilsharma63
Copy link
Member

@harshilsharma63 harshilsharma63 commented Nov 21, 2024

Summary

Updated team filter dropdown to search all teams on server.

Ticket Link

Fixes https://mattermost.atlassian.net/browse/MM-61902

const initialFilterTypeValue = savedSetting?.filterType || 'everyone';
setTeamFilterType(initialFilterTypeValue);
// fetch selected teams
const teams = await getTeamsByIds(savedSetting.filteredTeamIDs);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this can make many API calls all together, but this would be once, in a very in-frequently accused part of the app.

@harshilsharma63 harshilsharma63 added 2: Dev Review Requires review by a core committer 2: QA Review Requires review by a QA tester labels Nov 21, 2024
Copy link

@yasserfaraazkhan yasserfaraazkhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this locally by creating 300 teams and searching them in both the Send to selected teams and Do not send to selected teams options.

I search for the team that's not in the initial 200 fetched names.

Screenshot 2024-11-21 at 12 50 32 PM Screenshot 2024-11-21 at 12 50 50 PM

Copy link
Member

@M-ZubairAhmed M-ZubairAhmed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just few questions

// fetch all teams to populate options
const teams: Team[] = await Client4.getTeams(0, 10000, false) as Team[];
// getTeams always returns Team[] when includeTotalCount param is set to false
const teams = await Client4.getTeams(0, 20, false) as Team[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this standard way of doing this in this repo. In web we usually have an action.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is how we do it in simple plugins, like this one.

const initialFilterTypeValue = savedSetting?.filterType || 'everyone';
setTeamFilterType(initialFilterTypeValue);
// fetch selected teams
const teams = await getTeamsByIds(savedSetting.filteredTeamIDs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if getTeamsByIds is only used in this useEffect then cant we define it in this closure itself? 0/5

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@harshilsharma63 harshilsharma63 merged commit e3b81f4 into main Nov 21, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core committer 2: QA Review Requires review by a QA tester
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants