Add workflow menu button to thread lists

Bug: twpowertools:74
Change-Id: I703950394d674c2084278bf9e876014d08fa5cfb
diff --git a/src/contentScripts/communityConsole/batchLock.js b/src/contentScripts/communityConsole/batchLock.js
index 86a7057..87edc6d 100644
--- a/src/contentScripts/communityConsole/batchLock.js
+++ b/src/contentScripts/communityConsole/batchLock.js
@@ -1,19 +1,12 @@
 import {isOptionEnabled} from '../../common/optionsUtils.js';
 
-import {addButtonToThreadListActions, removeChildNodes} from './utils/common.js';
+import {addButtonToThreadListActions, removeChildNodes, shouldAddBtnToActionBar} from './utils/common.js';
+
+const lockDebugId = 'twpt-batch-lock';
 
 export var batchLock = {
-  nodeIsReadToggleBtn(node) {
-    return ('tagName' in node) && node.tagName == 'MATERIAL-BUTTON' &&
-        node.getAttribute('debugid') !== null &&
-        (node.getAttribute('debugid') == 'mark-read-button' ||
-         node.getAttribute('debugid') == 'mark-unread-button') &&
-        ('parentNode' in node) && node.parentNode !== null &&
-        ('parentNode' in node.parentNode) &&
-        node.parentNode.querySelector('[debugid="twpt-lock"]') === null &&
-        node.parentNode.parentNode !== null &&
-        ('tagName' in node.parentNode.parentNode) &&
-        node.parentNode.parentNode.tagName == 'EC-BULK-ACTIONS';
+  shouldAddButton(node) {
+    return shouldAddBtnToActionBar(lockDebugId, node);
   },
   createDialog() {
     var modal = document.querySelector('.pane[pane-id="default-1"]');
@@ -119,7 +112,7 @@
       if (isEnabled) {
         let tooltip = chrome.i18n.getMessage('inject_lockbtn');
         let btn = addButtonToThreadListActions(
-            readToggle, 'lock', 'twpt-lock', tooltip);
+            readToggle, 'lock', lockDebugId, tooltip);
         btn.addEventListener('click', () => {
           this.createDialog();
         });