Inline comments not working for content created with macros

ejo November 18, 2019

Inline comments not working for content created with macros (like JIRA Issue/Filter, SQL for Confluence). It throws the below error.

Page content is out of date, please refresh and try again

 

But for other contents (which doesn't include any macro) inline commenting works without any issue.

 

3 answers

1 accepted

2 votes
Answer accepted
Sven Schatter _Lively Apps_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 19, 2019

This because how inline comments work from a technical perspective: The position of Inline comments is persisted in the storage format of the page. They are basically XML tags that wrap the content they comment on.

Since macros like the Jira Issue macro load dynamic content that is not stored inside the page, inline comments don't work. The content is not in the page, so Confluence can't put an inline comment XML tag around it in the storage format. Since it doesn't know that the content you wanted to comment on is dynamic, it (wrongly) assumes you're seeing another version than what is currently in storage. Therefore you're seeing that error message, telling you to refresh the page. But really, there's just no technical way to comment on dynamic content.

Hope this makes sense!

Cheers,
Sven

ejo November 20, 2019

Thanks Seven for the quick reply.

I believe confluence should have the intelligence to not display the inline comment icon on Dynamic content.  

Is there any option/plugin which can be used to achieve this?

Sven Schatter _Lively Apps_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 20, 2019

Well, Confluence doesn't know how to do that, because how do you actually identify dynamic content? This is not an easy problem to solve as third party macros do not have to tell Confluence whether they render dynamic content or not. For vanilla Confluence macros they could certainly do it.

The best workaround I know of, is to manually find the macro-name of the third party macros you want to hide in the DOM via your browsers devtools:

dynmacros.PNGYou can then write a script that blocks the selection menu when the selection happens to be within in that macro.

For Vanilla Confluence macros you might need to figure out yourself, how they are represented in the DOM.

Here is an example script, that blocks a given list of macro names and the vanilla Jira macro. It is not perfect by any means but at least works to some extent.

AJS.toInit(function() {
var blacklistedMacroNames = [
'dynamic-macro-1',
'dynamic-macro-2',
'something-else'
];

function inlineCommentIsAlllowedIn($selection) {
var $parentMacro = $selection.closest('.conf-macro');

// Check for blacklisted third party macros.
if ($parentMacro.length) {
var parentMacroName = $parentMacro.data('macro-name');
if (blacklistedMacroNames.includes(parentMacroName)) return false;
}

// Vanilla macros might not have a conf-macro class.
if ($selection.closest('.jira-issues').length) return false;

return true;
}

$('body').on('mouseup', function() {
var $selection = $(window.getSelection().anchorNode);
var displayInlineComments = $selection.length && inlineCommentIsAlllowedIn($selection);

if (displayInlineComments) {
$('#inline-dialog-selection-action-panel').css({
display: '',
visibility: ''
});
} else {
$('#inline-dialog-selection-action-panel').css({
display: 'none',
visibility: 'hidden'
});
}
});
});

Cheers,
Sven

ejo November 20, 2019

Thanks a lot for explaining in detail.

Is there any other way to add inline comments for MACRO content. Any plugins which supports this feature? This will really help to capture information for each JIRA issue in CONFLUENCE. 

Like Joanna Nelson likes this
3 votes
Ture Hoefner April 22, 2020

I think there are some bugs for inline comment creation and that the bugs manifest themselves as the "... please refresh and try again... " message.  If the inline comment is being prohibited because the content can't be commented on then I think that is supposed to be the "... may contain a macro... " message.

Sometimes when I try to add an inline comment to content that is in a macro I (correctly) get a warning that it cannot be done because the content is in a macro (I suspect that any HTTP 412 Precondition Failed response will result in this warning):cannot_comment_on_macro_text.png

 

However, I often get an HTTP 409 Conflict (can see that in developer console) and the message is the generic (wrong) message:

out-of-date.png

The troublesome part about this is that, once it starts happening on some pages then it blocks you from adding inline comments in some places where you formerly could add inline comments on the page.  You get HTTP 409 and can't get past it (as far as I can tell).

For example, it is allowable to add an inline comment to the content that is in the body of an excerpt macro (on the page that has the excerpt, not on a page that has a dynamic include that uses that excerpt).  Works fine most of the time.    Occasionally you will get into a situation where adding an inline comment fails due to that HTTP 409 and then it will forever (as far as I can tell) fail for more attempts to add inline comments into the body of the macro.

I've also gotten HTTP 412 Precondition Failed when trying to add an inline comment to the body of a macro, for a macro that I had successfully commented on previously.  The HTTP 412 seems to be the one that renders the "... may contain a macro or user mention..." message.

Seems to me that the inline feature might be fragile in the area of adding new comments.

John Gray
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 2, 2021

Found out that you can't add a comment to some special words (just a single word).  Works ok if you select several words around these special words.  The ones i found so far are:

comment

test

Michael Mackie
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 5, 2021

This just happened to me with the word "Suite".

Kelly Pelkie July 15, 2021

Add "Comments" to that list of words that break. Changed it to "Concurrence" and we're back in business (for the moment).

0 votes
Frank Schimmel July 19, 2023

I understand that I cannot inline comment the text of a Jira issue that is embedded by the Jira issue macro in a Confluence page.

However, what I don't understand: I cannot even inline comment a text in another table cell, if one table row contains individual Jira issues (i.e. not a filter result). IMO this is not acceptable from the user's point of view.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events