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

Get rid of Laravel Gate contract #2181

Merged
merged 4 commits into from
May 28, 2020

Conversation

askvortsov1
Copy link
Member

@askvortsov1 askvortsov1 commented May 24, 2020

**Refs #2055 #2092 **

Changes proposed in this pull request:
As of right now, the only piece of the gate we actually use is the before callback in UserServiceProvider. This PR replaces the gate with that callback, freeing us from the Laravel Gate contract that we don't use anyway. Unless I made a mistake somewhere, no functionality has actually been changed.

Next steps:

Reviewers should focus on:

  • What here, if anything, do we need to provide a BC layer for? $user->can has been around for a while now, and Im assuming that is being used instead of directly calling the gate.

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).

Copy link
Contributor

@franzliedke franzliedke left a comment

Choose a reason for hiding this comment

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

Please rebase!

The changes from #2186 now need to be applied in the new Gate class, not in the UserServiceProvider, I believe.

Copy link
Contributor

@franzliedke franzliedke left a comment

Choose a reason for hiding this comment

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

Code looks good!

src/Api/Serializer/DiscussionSerializer.php Show resolved Hide resolved
src/Discussion/DiscussionPolicy.php Show resolved Hide resolved
@askvortsov1 askvortsov1 force-pushed the as/get_rid_of_laravel_gate_contract branch from 924204c to b7b0f3c Compare May 28, 2020 01:40
[ci skip] [skip ci]
@askvortsov1 askvortsov1 merged commit 7b12692 into master May 28, 2020
@askvortsov1 askvortsov1 deleted the as/get_rid_of_laravel_gate_contract branch May 28, 2020 22:00
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