top of page

COMMENT HISTORY for Jira Data Center

Buy Now
ask-a-question.png
book-a-demo.png

Comment History allows you to track all changes and deletions of comments in Jira (Jira currently only keeps the last change of a comment). 

Sections:

Comment Tab

CH - Comment Tab

A comments history can be view directly from the Comment tab.  The history of a comment can be viewed by clicking on the icon of a clock surrounded by a backward arrow icon, as shown below.

Comment tab with history icon
History of Comment

The history of the comment will be shown in a popup, as shown below.

Comment History tab showing the history of a comment
CH - History of Comment
CH - Comment History Tab

Comment History Tab

The Comment History tab appears in the Activity section of an Issue.  The Comment History tab shows existing comments, deletions and any historical changes to those comments grouped together to provide a linear history.  The image below shows an example Comment tab and the corresponding Comment History tab.  

 

The comments are ordered by the date of the parent comment.  This ordering can be changed between ascending and descending by clicking the arrow on the right hand side of the Comment History tab.

Comparison of he comment and comment history tabs

NOTE: Deleted comments (that no longer appear in the Comments tab) show an empty comment area as they no longer have a comment.

Filtering

CH - Filtering

The Comment History comments can be filtered by one or both of:

Only Show Edited Comments

Hide Comment History

This hides all current comments that appear in the Comment tab but do not have any history.

This collapses all comments with history so that only the current comment is shown.  For each collapsed comment the current comment can be clicked on to expand/collapse the comment and its history.

Clicking on the current comment, for any comment with a history, will either expand or collapse the history.  An example of the different filters are shown below.

Comment History tab showing the different options for displaying comments
CH - View Comment Privileges

View Comment Privileges

The privileges for viewing individual comment is determined when the comment is created, updated or deleted.  If the user does not have privileges to see the comment then it will not be shown.

CH - Last Comment

Last Comment

The Comment History plugin allows you to show the last comment at the bottom of the detail section.  By default, this is disabled and can be enabled through the admin screen (see the Configuration page for more details).

The last comment field with a detailed comment

If alternate renderers (i.e. JEditor) are used for comments then these will be used to render the comment.  Any restrictions applied are enforced for the comment display.  For example if the user is does not have permission to see the comment then the lozenge Access Denied will be shown.

Last comment field where is user does not have access to see the comment

The last comment can also be searched for in the Issue filtering screen using JQL.  There are two fields that can be used when searching: LastUpdatedComment (the last comment that was either created or updated) and LastCreatedComment (the last comment that was created).  Use the ~ operator for searching (i.e. LastUpdatedComment ~ "Closed").  This is limited to the first 255 characters of the comment.

NOTE: If values can't be searched for a re-index may be required.

NOTE: When this feature is first used the LastUpdatedComment and LastCreatedComment fields will start to be populated with values.  Searches will not be able to be used on old comments created/updated before this feature was used/added.

Configuration

CH - Config

Configuration for Comment History is found in the admin "System" section, "Comment History" (in the top sub-menu section).  This screen allows you to configure the visibility of the history tab and the displaying of last comment.

History Tab

There are three different viewing permissions for the Comment History tab. These permissions are "To Admin users only", "Always" and "Never".

The "To Admin users only" means that only project admins will be able to see the Comment History tab.  The "Always" option means that everyone will be able to see the tab, although individual viewing permissions still apply for each comment.  The Never options hides the tab completely, this can be for cases when viewing history from the Comment tab is sufficient.

Last Comment

The Last Comment section allows you to specify if the Last Comment will be displayed (in the details area of an Issue) and what is classified as the last comment.  The last comment will only be displayed if the "Show Last Comment" checkbox is checked.  

If "Show Last Comment" is checked then you have the option of specifying if the last comment is defined as the last updated comment or the last created.  For the last updated comment option, the creation of a new comment is classified as an update.

If the last comment is shown then two custom fields are automatically created (LastCreatedComment and LastUpdatedComment).  These fields can then be used for searching for an Issue using JQL in the Issue filter screen.  The custom fields are limited to 255 characters so only the first 255 characters are in these fields.

NOTE: If values can't be searched for a re-index may be required.

NOTE: When this feature is first used the LastUpdatedComment and LastCreatedComment fields will start to be populated with values.  Searches will not be able to be used on old comments created/updated before this feature was used/added. The comment is only added to these fields if the comment is viewable to all users (secure comments are not searchable).

Rest Token

The REST Token is used for accessing the REST API.  This token tells the REST API that you are authorised to access it.

comment history configuration page

REST API

CH - REST API

Comment history offers a REST API for retrieving comments and their history for an Issue.  There is a single endpoint with the following details:

Example URL: http://myWebSite.com/rest/commenthistory/1.0/history?issueKey=TEST-1&userKey=admin&token=36f2514c-caa2-4beb-bf058dc61a9e26e7

Method: GET

Parameters:

issueKey - The key for the issue (mandatory)

userKey - The key of the user that will look at the comments (mandatory)

token - The REST API token from the configuration page

Return Type: JSON

HTTP Status: 200 for success and 400 for invalid params

The user key is used to identify which comments are returned if there is any security level set for a comment.  An example of the returned data is shown below.

The information returned is a JSON array containing objects.  The object and history objects contain the following fields:

body: The text of the comment

updateAuthorName: The name of the author

updateAuthorKey: The user key for the author

updatedDate: The text (in Jira format) for when the comment was updated

updated: The long value of the updated date

commentId: The Jira comment Id

deleted: If this comment is deleted.  Only true when comment has no history

updatedAuthorUrl: The URL for the authors icon

history: A JSON array of objects containing the comments history. Same objects as this

id: The comment history id for the history.  Not on the top level object

Examples

A comment with history would look:

CH - REST Examples

[
   {
      "history":[
         {
            "body":"<p>Comment one, two</p>",
            "updateAuthorName":"Paul Clark",
            "updateAuthorKey":"admin",
            "updatedDate":"Today 5:10 AM",
            "updated":1505365825183,
            "commentId":10102,
            "id":9,
            "deleted":false,
            "updateAuthorUrl":"http://www.gravatar.com/avatar/fef32fe5aeac22c365167cb4764554e3?d=mm&s=32"
         },
         {
            "body":"<p>Comment one</p>",
            "updateAuthorName":"Paul Clark",
            "updateAuthorKey":"admin",
            "updatedDate":"Today 5:10 AM",
            "updated":1505365817481,
            "commentId":10102,
            "id":8,
            "deleted":false,
            "updateAuthorUrl":"http://www.gravatar.com/avatar/fef32fe5aeac22c365167cb4764554e3?d=mm&s=32"
         }
      ],
      "body":"<p>Comment one, two, three</p>",
      "updateAuthorName":"Paul Clark",
      "updateAuthorKey":"admin",
      "updatedDate":"Today 5:10 AM",
      "updated":1505365832381,
      "commentId":10102,
      "deleted":false,
      "updateAuthorUrl":"http://www.gravatar.com/avatar/fef32fe5aeac22c365167cb4764554e3?d=mm&s=32"
   }
]

A comment with no history

[
   {
      "body":"<p>My first comment</p>",
      "updateAuthorName":"Paul Clark",
      "updateAuthorKey":"admin",
      "updatedDate":"Today 5:10 AM",
      "updated":1505365809226,
      "commentId":10101,
      "deleted":false,
      "updateAuthorUrl":"http://www.gravatar.com/avatar/fef32fe5aeac22c365167cb4764554e3?d=mm&s=32"
   }
]

A deleted comment with history

[
   {
      "history":[
         {
            "updateAuthorName":"Paul Clark",
            "updateAuthorKey":"admin",
            "updatedDate":"Today 5:11 AM",
            "updated":1505365861886,
            "commentId":10103,
            "id":11,
            "deleted":true,
            "updateAuthorUrl":"http://www.gravatar.com/avatar/fef32fe5aeac22c365167cb4764554e3?d=mm&s=32"
         },
         {
            "body":"<p>No history</p>",
            "updateAuthorName":"Paul Clark",
            "updateAuthorKey":"admin",
            "updatedDate":"Today 5:10 AM",
            "updated":1505365847143,
            "commentId":10103,
            "id":10,
            "deleted":false,
            "updateAuthorUrl":"http://www.gravatar.com/avatar/fef32fe5aeac22c365167cb4764554e3?d=mm&s=32"
         }
      ]
   }
]

A deleted comment with no history

[
   {
      "body":"<p>My first comment</p>",
      "updateAuthorName":"Paul Clark",
      "updateAuthorKey":"admin",
      "updatedDate":"Today 5:10 AM",
      "updated":1505365809226,
      "commentId":10101,
      "deleted":true,
      "updateAuthorUrl":"http://www.gravatar.com/avatar/fef32fe5aeac22c365167cb4764554e3?d=mm&s=32"
   }
]

bottom of page