List All Comments Including Unresolved Inline Comments
Scenario
You can create an overview report of comment activities in your space, to see where discussions are happening and to keep track of comments that require attention.
This recipe creates a report that compiles and displays all comments from a space in a form of a table on a page. It includes inline comments and the statuses - Resolved, Open, Dangling, as well as inline comment replies.
Result
Recipe
Apps |
Reporting for Confluence Server & Data Center
|
---|---|
Level | Intermediate |
Estimated time | 10 minutes |
Macros | Content Reporter, Report Column, Report Info, Report Table |
Suppliers | Comment Supplier |
Storage format
You can copy and paste this code into the Confluence Source Editor:
<ac:structured-macro ac:macro-id="d23a274e-44e4-4efc-98cd-032d38b8356b" ac:name="report-table" ac:schema-version="1">
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="294e14ca-ab92-4eec-b94f-fd3496295237" ac:name="content-reporter" ac:schema-version="1">
<ac:parameter ac:name="types">comment</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="e9c32c80-5336-4afb-b1d2-12be296100b2" ac:name="text-sort" ac:schema-version="1">
<ac:parameter ac:name="order">descending</ac:parameter>
<ac:parameter ac:name="">comment:creation date</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="757d5ce9-6f6c-4079-ba2a-2962399c29cf" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Page</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="b5be5382-8892-419b-b766-460281736c9e" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="link">true</ac:parameter>
<ac:parameter ac:name="">content:page</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="b9c82afd-f576-4352-b19b-ccc793daab8b" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Comment</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="baaf8229-438f-40c9-8d20-7acfd35951c8" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="link">true</ac:parameter>
<ac:parameter ac:name="render">richtext</ac:parameter>
<ac:parameter ac:name="">content:body</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="192b97cc-e68c-46f3-b183-b9b58fe3440a" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Comment Type</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="43136f98-e1d9-4c87-8192-82310763eb33" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">comment:comment-type</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="4e5887b0-516d-48c9-bd5a-7147ce71fb0c" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Inline Comment Highlighted Text</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="bcc9f2fc-6c12-4390-8111-4bb921e06b17" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="link">true</ac:parameter>
<ac:parameter ac:name="">comment:inline-selection</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="a2fb23b2-3cd3-4adc-849e-6ea4e448d6d6" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Inline Comment Status</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="3d950c47-e5c1-4842-ba8b-c62aa536255d" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">comment:inline-status</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="4bca3fc4-47df-45ee-9322-09e735442863" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="title">Comment Author</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="949c6b97-9c22-4721-a25b-150b552236fb" ac:name="report-info" ac:schema-version="1">
<ac:parameter ac:name="">comment:creator</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="e0ffec20-e544-4c6d-9a3f-afe524b41c40" ac:name="report-column" ac:schema-version="1">
<ac:parameter ac:name="injected">true</ac:parameter>
<ac:parameter ac:name="title">Days ago</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="52952d4d-d3ae-4ba0-8fe5-339c4bfb5f72" ac:name="report-eval" ac:schema-version="1">
<ac:parameter ac:name="format">#</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:plain-text-body><![CDATA[(%global:current date>date:milliseconds% - %comment:creation date>date:milliseconds%)/1000/60/60/24]]></ac:plain-text-body>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
Macro structure
You can recreate the example in the editor view:
Steps
Create a Report Table macro to host the report inside a table.
Add a Content Reporter macro inside the report-table macro. To list only comments, make sure type is set to "comment". Optionally, add a Text Sort macro to automatically sort your report items e.g. by page name, created date or inline comment status. In this example, we use "comment:creation date" as the key for the text-sort macro.
Now, create as many Report Column macros with Report Info macros as you wish. These would host all the details of each comment. To retrieve details of the comments, we can make use of the keys available through Comment Supplier.
In this example, we create these columns with corresponding key for report-info macros:
The comment text, with key "comment:body". Make sure the macro Render parameter is set to "richtext" so it renders HTML well.
Type of comments, with key "comment:comment type"
The highlighted comment (if it's an inline comment), with key "comment:inline-selection"
The inline comment status (if it's an inline comment), with key "comment:inline-status"
The user who commented, with key "comment:creator"
(Bonus) To calculate the time lapsed since the comment was made, create another report-column macro called "Days ago". Enable injection, because we are going to use an advanced notation. Create a Report Eval macro and set format to "#" so the number of days will be rounded. To calculate, use this notation for the report-eval macro:
(%global:current date>date:milliseconds% - %comment:creation date>date:milliseconds%)/1000/60/60/24