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

Feature/with feature flags #1716

Merged
merged 28 commits into from
Nov 27, 2023
Merged

Feature/with feature flags #1716

merged 28 commits into from
Nov 27, 2023

Conversation

joanreyero
Copy link
Contributor

@joanreyero joanreyero commented Oct 17, 2023

Changes proposed ✍️

What

🤖 Generated by Copilot at 374d76e

This pull request adds a feature to find GitHub profiles for members who do not have one, using the GitHub search API and a feature flag. It modifies the backend and frontend services, components, routes, controllers, configuration, and types to implement the feature. It also reformats some code and simplifies a script.

🤖 Generated by Copilot at 374d76e

We're finding GitHub profiles for the members of the crew
We're using FeatureFlag.FIND_GITHUB to make it true
We're heaving on the memberFindGithub route with all our might
We're hoping that the githubToken will work alright

Why

How

🤖 Generated by Copilot at 374d76e

  • Add a new feature to find GitHub profiles for members based on their identities (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Add a new environment variable CROWD_GITHUB_TOKEN to store the GitHub personal access token for the API calls to GitHub (link)
  • Add a new configuration object githubToken to map the environment variable to the githubToken.token value (link, link, link, link)
  • Add a new route /tenant/:tenantId/member/github/:id to handle the GET requests to find the GitHub profiles for a given member ID (link)
  • Add a new controller memberFindGithub to validate the user permissions, call the MemberService.findGithub method, and send the response using the responseHandler (link)
  • Add a new method findGithub to the MemberService class to make a GET request to the GitHub search API, passing the member identities as a query string and the GitHub token as a header, and map the response data to a simpler format (link, link)
  • Add a new value FIND_GITHUB to the FeatureFlag enum to represent the feature flag for finding GitHub profiles for members (link)
  • Add a new error message for the case when a feature is not enabled for the user account (link)
  • Add a new component app-member-find-github-drawer to render a drawer that shows the GitHub profile suggestions for the member, and allow the user to select and update the member username with the GitHub identity (link)
  • Add a new method findGithub to the MemberService class in the frontend to make a GET request to the backend route and return the suggestions array (link)
  • Add a new value findGitHub to the FEATURE_FLAGS object in the frontend to represent the feature flag for finding GitHub profiles for members (link)
  • Add a new condition v-if="isFindGitHubFeatureEnabled" to the el-tooltip and span elements in the member-dropdown and member-enrichment components to check if the feature flag is enabled before rendering the tooltip and the button for the enrichment feature (link, link)
  • Add a new element el-dropdown-item with the command memberFindGitHub to the member-dropdown component to render a button to find GitHub profiles for the member, and make it visible only if the feature flag is enabled and the member does not have a GitHub identity already (link)
  • Add a new data property openFindGitHubDrawer to the member-dropdown and member-enrichment components to control the visibility of the drawer component (link, link)
  • Add a new computed property isFindGitHubFeatureEnabled to the member-dropdown and member-enrichment components to check if the feature flag is enabled or not using the FeatureFlag.isFlagEnabled method (link, link)
  • Add a new computed property isFindingGitHubDisabled to the member-dropdown component to check if the member has a GitHub identity or not, and disable the button if so (link)
  • Add a new condition v-else to the span element in the member-enrichment component to render the enrichment button only if the feature flag for finding GitHub profiles is not enabled, and add a new condition v-else to the el-button element to render the button with the text "Find GitHub" and a GitHub icon if the member does not have a GitHub identity or an email (link)
  • Add a new method handleCommand to the member-dropdown component to handle the case when the user clicks the button to find GitHub profiles for the member, and set the openFindGitHubDrawer data property to true (link)
  • Add a new method onFindGithubClick to the member-enrichment component to set the openFindGitHubDrawer data property to true when the user clicks the button to find GitHub profiles (link)
  • Add a new method handleSubmit to the member-find-github-drawer component to call the MemberService.update method to update the member username with the selected GitHub identity, and dispatch the member/doFind action to refresh the member data (link)
  • Reformat the code in several files to break the long lines and use consistent quotes and spacing (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Modify the install_lib_packages.sh script to simplify the script and remove the unnecessary color variables (link)
  • Add a console log statement to the FeatureFlagService class for debugging purposes (link)
  • Remove an empty line in the frontend/src/utils/featureFlag/index.js file (link)

Checklist ✅

  • Label appropriately with Feature, Improvement, or Bug.
  • Add screehshots to the PR description for relevant FE changes
  • New backend functionality has been unit-tested.
  • API documentation has been updated (if necessary) (see docs on API documentation).
  • Quality standards are met.

@gitguardian
Copy link

gitguardian bot commented Oct 17, 2023

⚠️ GitGuardian has uncovered 4 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
8013672 GitHub Access Token 1f1b0f7 backend/src/services/memberService.ts View secret
8013672 GitHub Access Token 07a48b6 backend/src/services/memberService.ts View secret
8013672 GitHub Access Token 3692f5b backend/src/services/memberService.ts View secret
8013672 GitHub Access Token 8a9e204 backend/src/services/memberService.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@@ -7,6 +7,8 @@ export enum FeatureFlag {
MEMBER_ENRICHMENT = 'member-enrichment',
ORGANIZATION_ENRICHMENT = 'organization-enrichment',
SEGMENTS = 'segments',
FIND_GITHUB = 'find-github',
QUICKSTART_V2 = 'quickstart-v2',
Copy link
Contributor

Choose a reason for hiding this comment

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

quickstart is not there anymore so just delete this line.

@joanreyero joanreyero merged commit b055db4 into main Nov 27, 2023
9 checks passed
@joanreyero joanreyero deleted the feature/with-feature-flags branch November 27, 2023 17:11
sausage-todd pushed a commit that referenced this pull request Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants