Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Inline comments not working for content created with macros

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.

 

2 answers

1 accepted

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

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?

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

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. 

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

408 views 23 8
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you