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

Allow to get responsible when user is soft deleted #398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sebastienheyd
Copy link
Contributor

I've made a package that modify the users to allow to soft delete them.

When a user is soft deleted, the method userResponsible will return null, but the user is still in the database and is responsible for the revision. This can cause errors like "cannot get property ...... on null".

I've made my own Revision class to fix this, but I think this must be included by default because the user is responsible and must be loaded, deleted or not.

The fix is very simple, I just added withTrashed when getting the user.

@fakeheal
Copy link

fakeheal commented May 2, 2022

+1 for this, but maybe we should add a property to allow other users to opt-in/opt-out of this feature.

For the time being, if you'd like to use @sebastienheyd changes:

  1. Install cweagans/composer-patches:
composer require cweagans/composer-patches
  1. Download this PR's changes as .patch and places it ./{PROJECT_ROOT}/patches/venturecraft-revisionable.patch

  2. Update composer.json with:

....
"extra": {
    "laravel": {
        "dont-discover": []
    },
    "patches": {
        "venturecraft/revisionable": {
            "Get responsible when user is soft deleted": "./patches/venturecraft-revisionable.patch"
        }
    }
},
...
  1. Run composer install

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