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

Unlocking a record doesn't create a new lock #53

Open
kwumr opened this issue Jun 25, 2024 · 0 comments
Open

Unlocking a record doesn't create a new lock #53

kwumr opened this issue Jun 25, 2024 · 0 comments

Comments

@kwumr
Copy link

kwumr commented Jun 25, 2024

When resourceLockObserverUnlock() is called in src/Resources/Pages/Concerns/UsesResourceLock.php by clicking the button to "Unlock page" the record isn't locked by the user that clicked the button.

I noticed that save() has a call to $this->record->refresh(). I tried adding this to resourceLockObserverUnlock() before attempting to lock the record and it appears to work:

public function resourceLockObserverUnlock()
    {
        if ($this->record->unlock(force: true)) {
            $this->closeLockedResourceModal();
            // refresh the record before attempting to re-lock
            $this->record->refresh();
            $this->record->lock();
        }
    }

Should the record be refreshed prior to attempting to gain a new lock?

Thanks for this great plugin!

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

No branches or pull requests

1 participant