route content_lock.break_lock.XYZ not working? Wrong form_op?

Created on 19 December 2022, over 2 years ago
Updated 27 March 2024, about 1 year ago

Problem/Motivation

On my site the break lock action does unlock but the break lock route does not (at least when called by the views field plugin).
Debugging I found:

  • the action calls ContentLock::release() with $form_op NULL
  • but the route calls it with $form_op '*'
  • so lockingDelete() is called with NULL (action) or '*' (route) - here is the difference:
    if (isset($form_op)) {
      $query->condition('form_op', $form_op);
    }
    

    so if $form_op is '*' this will be added to the condition.

  • checking the database table content_lock all my entries have form_op 'edit' - so nothing was deleted

I also found that the action calls ContentLock::release() with $langcode not as string but as an object (Drupal\Core\Language\Language), but I think this is no problem - in lockingDelete() $langcode is the string 'und'.

Steps to reproduce

  • duplicate view locked_content and add field 'Break link'
  • Edit a node and keep it open
  • open the views page and click 'Break lock'
  • check the view again - lock is still there
  • Break the lock with the action - lock is deleted

Proposed resolution

Looking around I found three years old #3073565: Unable to release the lock on /admin/content/locked-content view β†’ .
The patch #2 there only adds the condition if($form_op != '*').
Adding that solved my problem.

Maybe the patch was lost in the meantime or was never commited?
Issue #3073565 is marked 'fixed' - but there is no commit note.

Maybe we could also check the result of $this->lockingDelete() in release() - it returns the number of rows affected by the delete query.

Remaining tasks

See patch below.

πŸ› Bug report
Status

Postponed: needs info

Version

2.3

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany gngn

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024