[MGNLSLOCK-39] Notification "There are pending changes by ..." is being displayed when a preview page is accessed in first place to a different person who create that page Created: 19/Jul/16  Updated: 01/Dec/16  Resolved: 29/Nov/16

Status: Closed
Project: Magnolia Soft Locking Module
Component/s: None
Affects Version/s: 2.5
Fix Version/s: 2.6.1

Type: Bug Priority: Neutral
Reporter: Mercedes Iruela Assignee: Oanh Thai Hoang
Resolution: Fixed Votes: 1
Labels: support
Remaining Estimate: 0d
Time Spent: 2d 7h
Original Estimate: 4d

Issue Links:
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Saigon 72
Story Points: 8

 Description   

When a user creates a page and doesn´t access to preview it, the first user/editor that access to preview recieved a notification:

 'There are pending changes by {0}. Please reload the page.'

Steps to reproduce (demoauthor):

  1. Login as eric and create a page (without access to preview).
  2. Login as superuser.
  3. Preview that previous page (created by eric). Notification messages displayed: There are pending changes by eric. Please reload the page."

It seems to be related to the fact that the page was not previously rendered. The root cause seems to be similar to: https://jira.magnolia-cms.com/browse/MGNLSLOCK-38

Update in 2016/12/01: This issue doesn't occur when previewing the page, but when opening the page instead.



 Comments   
Comment by Oanh Thai Hoang [ 22/Nov/16 ]

This bug is not similar to https://jira.magnolia-cms.com/browse/MGNLSLOCK-38

Source of the problem:

Autogeneration is always executed with LockingOp. It means it will lock the parent of area node until everything is done (for more detail: lock by LockManager from Jackrabbit)

Regarding lock API: The addition or change of the properties jcr:lockIsDeep and jcr:lockOwner are persisted immediately; there is no need to call save. It means it will automatically persist node before creating area node. So changed event will fire and soft locking will receive that special event before receiving event from area node creation.

Solution: preventing the first event from lock system.

Luckily, when locking node, jackrabbit does not update our properties such as mgnl:modifiedDate and mgnl:createdDate... We can base on 2 properties to detect event from system and just only one time.

Code proposal:

Changes at DefaultSoftLockingSupport#notifyChangeListeners

                if (createdDate == null || modifiedDate == null || modifiedDate.after(createdDate)) {
                    for (Lock lock : pageLocks) {
                        lock.getListener().pageModified(userId, modifiedDate);
                    }
                }
Generated at Mon Feb 12 07:14:45 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.