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

Add mediator classes #211

Merged
merged 8 commits into from
Apr 2, 2025
Merged

Add mediator classes #211

merged 8 commits into from
Apr 2, 2025

Conversation

lauren-ciha
Copy link
Member

This pull request focuses on refactoring the GitHubQueryValidationTests and SaveSearchFormTest classes to improve code maintainability and readability by introducing a helper method for creating SaveSearchForm instances and adding a SavedSearchesMediator parameter to the SaveSearchForm constructor.

Refactoring for code maintainability:

@lauren-ciha lauren-ciha requested a review from guimafelipe April 2, 2025 05:16
@lauren-ciha lauren-ciha marked this pull request as ready for review April 2, 2025 05:16
@Copilot Copilot bot review requested due to automatic review settings April 2, 2025 05:16
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request refactors the mediator-related functionality to improve code maintainability by introducing dependency injection for mediator classes in various components, and updates related tests accordingly.

  • Introduced and injected SavedSearchesMediator and AuthenticationMediator instances to replace static event handling.
  • Updated constructor signatures and mediator event subscriptions across forms, commands, and tests.
  • Minor cleanups in GlobalSuppressions and dependency adjustments in Program.cs.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
GitHubExtension/Program.cs Injects mediator instances into page factories and command providers and manages disposables.
GitHubExtension/GlobalSuppressions.cs Removes an obsolete suppression, reducing noise.
GitHubExtension/GitHubExtensionCommandsProvider.cs Replaces static event hooks with mediator-based event subscriptions.
GitHubExtension/GitHubExtension.cs Updates Dispose behavior to use the Release event.
GitHubExtension/Controls/SavedSearchesMediator.cs Adds a new mediator class for saved search events.
GitHubExtension/Controls/Pages/SearchPages/SearchPageFactory.cs Passes mediator instance into SaveSearchForm creation.
GitHubExtension/Controls/Pages/SavedSearchesPage.cs Updates mediator event subscriptions and changes refresh behavior on removal.
GitHubExtension/Controls/Forms/SignInForm.cs & SignOutForm.cs Updates forms to use the AuthenticationMediator instead of static events.
GitHubExtension/Controls/Forms/SaveSearchForm.cs Updates constructor signatures to include mediator dependency.
GitHubExtension/Controls/Commands/RemoveSavedSearchCommand.cs Uses mediator calls when removing a saved search instead of raising static events.
GitHubExtension/Controls/AuthenticationMediator.cs Adds a new mediator class for authentication events.
GitHubExtension.Test Updates tests to supply mediator instances into SaveSearchForm and SavedSearchesPage constructors.
Comments suppressed due to low confidence (1)

GitHubExtension/Controls/Pages/SavedSearchesPage.cs:63

  • Replacing the call to RaiseItemsChanged with a hardcoded 0 may clear the UI even when not all saved searches have been removed. Consider reloading the count from the repository to accurately reflect the remaining items.
RaiseItemsChanged(0);

@guimafelipe guimafelipe merged commit fdb73ea into main Apr 2, 2025
3 checks passed
@guimafelipe guimafelipe deleted the user/laurenciha/dispose branch April 2, 2025 16:21
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.

2 participants