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

[1.x] Delete the users profile picture #399

Merged
merged 10 commits into from
Oct 27, 2020
Merged

[1.x] Delete the users profile picture #399

merged 10 commits into from
Oct 27, 2020

Conversation

lostdesign
Copy link
Contributor

When a user deletes an account, the image will now be deleted as well. fixes #396

delete the users profile image
delete the users profile picture
@lostdesign
Copy link
Contributor Author

lostdesign commented Oct 26, 2020

I just realized that the profile picture feature has to be enabled, otherwise the method to delete the profile image is not available on the User model. Guess this should then be rather added to the docs?

So when a user is deleted and the profile feature is enabled, it should also delete the image or more like they need to call $user->deleteProfilePhoto()

@lostdesign lostdesign marked this pull request as draft October 26, 2020 19:00
@driesvints driesvints changed the title Delete the users profile picture [1.x] Delete the users profile picture Oct 27, 2020
Copy link
Contributor

@Chrissi2812 Chrissi2812 left a comment

Choose a reason for hiding this comment

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

You could check if the Feature is enabled before, so no errors if it's not enabled

@lostdesign lostdesign marked this pull request as ready for review October 27, 2020 15:47
lostdesign and others added 2 commits October 27, 2020 16:56
Co-authored-by: Claudio Dekker <1752195+claudiodekker@users.noreply.github.com>
Co-authored-by: Claudio Dekker <1752195+claudiodekker@users.noreply.github.com>
Co-authored-by: Claudio Dekker <1752195+claudiodekker@users.noreply.github.com>
@taylorotwell
Copy link
Member

Personally I would move that feature check into the deleteProfilePhoto method so you can just always call it from the stub.

@taylorotwell
Copy link
Member

Looks like tests are failing...

@lostdesign
Copy link
Contributor Author

@taylorotwell adjusted, guess that's the way you meant? The test now fails because the tests\Fixture\User.php doesnt have the HasProfilePicture trait. Is that intended? Otherwise I'd add it so the test passes 👍

use HasApiTokens, HasTeams;

@taylorotwell
Copy link
Member

You can add it to the fixture. Yes that looks fine. Thanks.

@taylorotwell taylorotwell merged commit e04d80d into laravel:1.x Oct 27, 2020
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.

Deleting a profile does not delete avatar
5 participants