A customer is losing page edits

On Confluence Data Center, our plugin can edit the page (on request of the user) to replace texts with macros. It is similar to selecting text and using the Jira tool to replace it with a Jira issue.

The next time the user edits the page, our changes are gone! It is as if they were editing a draft where the last version of the page isn’t reflected. What might be happening?

We edit the page using the PageManager.saveNewVersion() API.

  • Does it depend on the “Collaboration Mode”?
  • Is there a quirk/interaction with the shared drafts? Does it matter if the user has a draft being edited before we perform the modification to the page? Is Confluence sometimes unsuccessful at reconciling changes?
  • Is that the wrong API to use?
Page page = pageManager.getPage(pageId); // This is marked as deprecated, but it shouldn't be a problem, and I haven't seen any other API to edit pages anyway.
pageManager.saveNewVersion(
    page,
    content -> {
        content.setBodyAsString(newBody);
        content.setVersionComment(versionComment);
    },
    DefaultSaveContext.builder()
        .suppressNotifications(true)
        .updateLastModifier(false)
        .suppressEvents(true)
        .build()
);

Edit: This customer is using Confluence 7.13.8.

1 Like

Just to confirm, this isn’t a new problem that you expect to be result of a recent change, right?

No, the customer has 7.13.8. That was a good point to address first :wink: