Skip to end of metadata
Go to start of metadata

Overview

Page Comment Locking allows forum topics to be locked preventing comments from being added, edited or removed. This functionality is implemented user servlet filters, blocking access to the default Confluence comment actions.

Unfortunately while the comment actions can be blocked there is no way for a plugin to prevent the links to those actions from being displayed without theme modifications. Therefore when you are considering enabling this functionality you should also consider some of the theme modifications mentioned below.

Enabling Comment Locking

Comment locking can enabled from the Confluence adminustration console.

On the Page Locking Configuration page you can select to enable or disable page comment locking, and choose the permission that users require to be able to lock and unlock pages.

 

 

Space Permissions

If the allow space override option is selected, Space Administrators will be able to choose the permission required to lock pages in their space.

 

Theme Modifications

While the plugin can prevent the comment actions being used, it can't actually get rid of the links to those actions. To create a better user experience some theme modifications should be considered to hide the comment links when a page is marked as being locked.

Default Comment Area Hiding

By default the plugin ships with a servlet filter which prevents the comment edit boxes from appearing on a page. This doesn't actually remove the links to add a comment, but when these comment links are clicked on will prevent the edit area being displayed.

Simple Javascript link hiding

The simplest way to hide some of the comment modification links is to use some javascript included with every page.

If you are using a theme that supports Custom HTML (such as default Confluence theme or Theme Builder), you can add the script to the "End of <body>" section of Custom HTML (found in Confluence's main Administration Console). If using Theme Builder, make sure you have not disabled the Custom HTML features on the Options Tab.

<script type="text/javascript">
jQuery(function(){
  if( jQuery("#add-menu-link-page span:contains('Comments Locked')").length ){
    jQuery("#add-comment-bottom, .comment-action-edit, .comment-action-remove, .action-reply-comment").hide();
    jQuery("#add-menu-link-page li:has(#add-comment-menu-link)").remove();
    jQuery("#comment-top-links li:has(#add-comment-top)").remove();
  }
 });
</script>

This script will hide the comment links based on the presence of the Comments Locked menu item under the Add menu. This should go at the of the html body to make sure every thing else has loaded before it executes.

Using the Bubbles Show macro

The bubbles-show macro allows content to be displayed based on different properties on a page. If you are creating your own theme this macro can be used to only include javascript to hide comment links only on pages that are actually locked. This macro would also allow you to include a more obvious indication that the page is locked as well.