Problem/Motivation

In Views, the "Is Locked" field does not get updated after a lock break

Steps to reproduce

  1. Edit the Content view (/admin/structure/views/view/content)
  2. Add field of "Is Locked"
  3. Try to edit a node so it gets locked
  4. Visit the content view (/admin/content)
  5. Break the lock using either Action or Operations

Proposed resolution

Flush/clear the specific entity id cache when lock is released and also when it gets locked.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

No Sssweat created an issue. See original summary.

no sssweat’s picture

Issue summary: View changes
no sssweat’s picture

Issue summary: View changes
no sssweat’s picture

Issue summary: View changes
no sssweat’s picture

StatusFileSize
new1.4 KB

 

no sssweat’s picture

Assigned: no sssweat » Unassigned
Status: Active » Needs review
nikhil_110’s picture

Status: Needs review » Needs work

I reproduced this issue on my local and added MR or checked it, but when I add a node, only when I edit the node from admin, the lock status changes, but when I edit the node from another user. the locked status of the node does not change and is also not shown to other users.

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)

Tried replicating following the steps in the issue summary and the view is updating fine for me with the latest 8.x-2.x changes.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Needs review

Still not able to replicate but now that we have a views test file I expanded on that to verify this.

smustgrave’s picture

Hiding patches.

smustgrave changed the visibility of the branch 3381841-in-views-the to hidden.

alexpott’s picture

Title: In Views, the "Is Locked" field does not get updated after a lock break » Add test coverage to ensure the "Is Locked" views field is updated after a lock break

Fixing issue title.

alexpott’s picture

Title: Add test coverage to ensure the "Is Locked" views field is updated after a lock break » In Views, the "Is Locked" field does not get updated after a lock break
Status: Needs review » Needs work

I followed the steps as defined in the issue summary and this is definitely still an issue. Which is good because nothing has been committed recently that would fix this.

The reason the tests pass is that view provided by the module has cache set to none - while the views.view.content has the cache type of tag.

alexpott changed the visibility of the branch 3381841-in-views-the to active.

alexpott’s picture

I've fixed the view so that it works - but I'm scared... this means views an edit screen and locking a node will impact the cache. This does not feel like the correct solution.

I think what we should do is introduce a content_lock cache tag and cause views which use it's fields to add that.

penyaskito made their first commit to this issue’s fork.

alexpott’s picture

The changes to config/optional/views.view.locked_content.yml and src/ContentLock/ContentLock.php can be removed. They’re not necessary.

We also should add an upgrade path that finds views and resaves them if they use the content_lock table.

penyaskito’s picture

Status: Needs work » Needs review

Completed the upgrade and tested it manually.
Do we expect an upgrade test too? If not this is ready for reviews.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Applied MR locally
Hook ran fine without issue
Tests appear all green

Believe this is good, based also on the slack thread I was on.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Added some comments to the MR - I think we need to add test coverage of the new code.

alexpott’s picture

Status: Needs work » Needs review

Adding a test and changed a few things.

alexpott’s picture

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

Okay - we've got test coverage of the view and saving the view while trying to change the cache plugin. This is looking good. I manually tested the post update and it is was working.

  • alexpott committed 1cfba052 on 8.x-2.x authored by No Sssweat
    Issue #3381841 by alexpott, penyaskito, No Sssweat, smustgrave: In Views...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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