Skip to content

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

@kwumr

Description

@kwumr

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions