Even with the option to "Use javascript to detect leaving the node form", lock is not removed upon navigating away. Have to click Save or Cancel explicitly. Furthermore, it fails silently to remove the lock.

I traced it back to a 403 Forbidden error using the Inpect Element + Network Monitor features in Firefox. The 403 code is the response of the AJAX callback that is supposed to remove the lock, for example :

http://mysite/ajax/content_lock/<nodeid>/canceledit?k=567816212&token=Y7onBnXopNIj4vO-4ZhmnmxRi9m6sVnLMlDoUD8osFY&_=1459778612610

I further traced this back to some issue with permissions/user access. As far as I know, the permissions were set correctly, with Authenticated users having the Check Out/Lock Documents permission.

Initial fix: I had to revert line 81 of content_lock.module

  78   $items['ajax/content_lock/%/canceledit'] = array(
  79     'page callback' => 'content_lock_release_own_item',
  80     'page arguments' => array(2, FALSE, FALSE),
  81     'access callback' => 'user_access',
  82   );

to:

  79   $items['ajax/content_lock/%/canceledit'] = array(
  78     'page callback' => 'content_lock_release_own_item',
  80     'page arguments' => array(2, FALSE, FALSE),
  81     'access callback' => TRUE,
  82   );

, which was the code used in 7.x-2.0 (at line 80 for that version).

Better fix: please see patch submitted in #9.

A temporary workaround for me was to unset "Use javascript to detect leaving the node form", but I would much rather keep this enabled.

Comments

leducvin created an issue. See original summary.

isolate’s picture

I have the same issue. Your suggestion fixes it for me. Added the patch

isolate’s picture

Status: Active » Needs review
mfb’s picture

How about keeping user_access as the callback, but also providing 'access arguments' => array('check out documents')?

leducvin’s picture

Sounds reasonable, given my very limited understanding of Drupal programming. There should be some way to pass along the fact that the user has permission to check out/lock documents.

isolate’s picture

You are right. Updated patch.

rohnjeynolds’s picture

The patch in #6 patches the patch in #1, not the original file. This patch applies the suggestion in #4 to the actual module file. Hope the maintainer rolls this into the next stable version soon.

leducvin’s picture

Issue summary: View changes
isolate’s picture

Thanks for pointing that out!
The patch in #7 does not apply on latest stable release. Rolled patch to make our .make file work properly.

angel.h’s picture

Status: Needs review » Reviewed & tested by the community

I think #9 now looks good.

Steel Rat’s picture

Please disregard this comment. I uploaded my changes to the wrong folder. Brain fart.

leducvin’s picture

Issue summary: View changes
amir simantov’s picture

#9 works for me, as well. Thanks!

  • Joseph Zhao committed 79f9ff9 on 7.x-2.x
    Issue #2699803 by iSoLate, rohnjeynolds: Lock isn't removed...
pandaski’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution. We are looking forward to seeing a new release very soon.

  • Joseph Zhao committed 79f9ff9 on 7.x-3.x
    Issue #2699803 by iSoLate, rohnjeynolds: Lock isn't removed...

  • Joseph Zhao committed 2fd55bc on 7.x-2.x
    Revert "Issue #2699803 by iSoLate, rohnjeynolds: Lock isn't removed...

  • Joseph Zhao committed b3c5b32 on 7.x-2.x
    Issue #2699803 by iSoLate, rohnjeynolds, leducvin, Amir Simantov, mfb,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.