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

Refactor companyable #15814

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft

Conversation

uberbrady
Copy link
Collaborator

It seems like every time we try to do something with the Companyable system, we have a hard time digging through what it's actually doing, and how.

This attempts to change that. First, I moved the Companyable and CompanyableChild traits into the Traits directory, and took 'Trait' off of their names.

Then, I embedded the scopes that these Traits had attached into the Traits themselves.

Then, I grabbed the appropriate parts of Company that were referred to within those scopes also into the Traits themselves.

The end result is two traits that embed all the functionality that they need directly in them.

There is also an Interface which I decided against moving - it doesn't do much and is only used in two places, and we don't have any other Interfaces within the system. Happy to move it, though, if that's something we want.

This does pass tests, but we should probably click around - some of the changes I had to make might have subtle implications that we might not necessarily test for.

Copy link

what-the-diff bot commented Nov 14, 2024

PR Summary

  • Updated User Count Retrieval
    The DashboardController has been revised to display the count of all users, not just those belonging to a specific company.

  • License Export Behavior Change
    A modification in the LicensesController possibly alters the exporting behavior of licenses. The previous restriction on the licencing related to specified companies has been commented out.

  • Refactoring of Several Models
    Numerous model files had their outdated CompanyableTrait usage replaced with a new Companyable trait to better handle company-specific responsibilities.

  • Removal of Outdated Files
    Redundant scope and trait files (CompanyableScope.php, CompanyableChildScope.php, CompanyableTrait.php, CompanyableChildTrait.php) related to company scoping were deleted, making the code cleaner.

  • Addition of New Traits
    Two new traits, Companyable and CompanyableChild, were added to streamline company-specific functionality within models.

  • Enhanced Company Scoping Logic
    The company scoping logic has been improved, now considering if a user is logged in and if the 'full_multiple_companies_support' setting is active. This results in more accurate and efficient data management.

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.

1 participant