Fixed bug with multiple comment widgets on a single page
authorMarcel Werk <burntime@woltlab.com>
Wed, 10 Jun 2020 18:10:23 +0000 (20:10 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 10 Jun 2020 18:10:23 +0000 (20:10 +0200)
com.woltlab.wcf/templates/__commentJavaScript.tpl

index 51eeea8ffcbca2e3ea5b7bb986442dc55ab6290f..a19edfa5ac769a4d39e08cd7d09847c0a9933c94 100644 (file)
@@ -14,7 +14,7 @@
                        'wcf.moderation.report.success': '{lang}wcf.moderation.report.success{/lang}'
                });
                
-               new {if $commentHandlerClass|isset}{@$commentHandlerClass}{else}WCF.Comment.Handler{/if}('{$commentContainerID}');
+               new {if $commentHandlerClass|isset}{@$commentHandlerClass}{else}WCF.Comment.Handler{/if}('{@$commentContainerID}');
                {if MODULE_LIKE && $commentList->getCommentManager()->supportsLike() && $__wcf->getSession()->getPermission('user.like.canViewLike')}
                        require(['WoltLabSuite/Core/Ui/Like/Handler'], function(UiLikeHandler) {
                                var canDislike = {if LIKE_ENABLE_DISLIKE}true{else}false{/if};
@@ -36,7 +36,7 @@
                                        // selectors
                                        badgeContainerSelector: '.commentContent:not(.commentResponseContent) > .containerHeadline > h3',
                                        buttonAppendToSelector: '.commentContent .buttonList',
-                                       containerSelector: '.comment',
+                                       containerSelector: '#{@$commentContainerID} .comment',
                                        summarySelector: ''
                                });
                                
                                        // selectors
                                        badgeContainerSelector: '.commentResponseContent > .containerHeadline > h3',
                                        buttonAppendToSelector: '.commentContent .buttonList',
-                                       containerSelector: '.commentResponse',
+                                       containerSelector: '#{@$commentContainerID} .commentResponse',
                                        summarySelector: ''
                                });
                        });
                {/if}
                
                {if $commentList->getCommentManager()->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
-                       new WCF.Moderation.Report.Content('com.woltlab.wcf.comment.comment', '.jsReportCommentComment');
-                       new WCF.Moderation.Report.Content('com.woltlab.wcf.comment.response', '.jsReportCommentResponse');
+                       new WCF.Moderation.Report.Content('com.woltlab.wcf.comment.comment', '#{@$commentContainerID} .jsReportCommentComment');
+                       new WCF.Moderation.Report.Content('com.woltlab.wcf.comment.response', '#{@$commentContainerID} .jsReportCommentResponse');
                {/if}
        });
 </script>