PM-5996 orgs search - #333
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a significant change to how Gitea team searches are performed and configured, shifting from a static, environment-configured list of organizations to dynamically searching only the organizations the signed-in user belongs to (including private organizations). It also introduces a new caching mechanism for these organization lookups, improves the API endpoint and documentation, and refactors related tests and configuration code.
Key changes:
Gitea Team Search Functionality
GiteaTeamSearchService) that searches Gitea teams only within the organizations the signed-in user belongs to (public and private), mapping the user to their Gitea account by handle or email, and memoizing organization lookups per user for performance. The search returns nothing if the user has no Gitea account or belongs to no organizations./gitea/teamsto/reviews/gitea/teamsand refactored it to use the new service, passing the signed-in user context and updating documentation to reflect the new behavior. [1] [2] [3]Configuration and Environment
GITEA_ORGANIZATIONSenvironment variable and related code, and introduced a newGITEA_ORGANIZATIONS_CACHE_TTL_MSenvironment variable to control how long a user's organizations are cached (default 5 minutes). Updated documentation and.env.sampleaccordingly. [1] [2] [3] [4]Testing
GiteaTeamSearchService, covering user mapping, caching, error handling, and edge cases.GiteaService.searchTeamstests to decouple them from the removed static organization configuration. [1] [2] [3] [4] [5] [6]