perf(comment): 允许全局关闭评论,文章、页面评论设置生效,#64

This commit is contained in:
nineya 2023-12-01 19:51:58 +08:00
parent 7c7b5e98bf
commit b480a428cc
7 changed files with 50 additions and 49 deletions

View File

@ -1,8 +1,9 @@
<html lang="zh" xmlns:th="https://www.thymeleaf.org"
th:class="${theme.config.basic_style.theme_style}"
th:fragment="layout (title, canonical, content, isPost)">
<th:block th:if="${!#strings.equals('',param._pjax)}"
th:with="contributor = ${contributorFinder.getContributor(theme.config.basic_info.metadata_name)}">
<th:block th:with="contributor = ${contributorFinder.getContributor(theme.config.basic_info.metadata_name)},
enableComment = ${baseEnableComment && site.comment.enable && pluginFinder.available('PluginCommentWidget')}">
<th:block th:if="${!#strings.equals('',param._pjax)}">
<th:block th:replace="~{common/head :: head}"/>
<body>
<div class="column-main">
@ -10,10 +11,9 @@
</div>
<th:block th:replace="~{common/scripts}"/>
</body>
</th:block>
<th:block th:unless="${!#strings.equals('',param._pjax)}"
th:with="stats = ${siteStatsFinder.getStats()},
contributor = ${contributorFinder.getContributor(theme.config.basic_info.metadata_name)}">
</th:block>
<th:block th:unless="${!#strings.equals('',param._pjax)}"
th:with="stats = ${siteStatsFinder.getStats()}">
<th:block th:replace="~{common/head :: head}"/>
<body>
<th:block th:replace="~{common/navbar}"/>
@ -41,5 +41,6 @@
<th:block th:replace="~{common/footer}"/>
<th:block th:replace="~{common/scripts}"/>
</body>
</th:block>
</th:block>
</html>

View File

@ -14,9 +14,7 @@
<script th:if="${isJournals}" data-pjax th:src="@{/assets/js/journals.min.js(mew=${theme.spec.version})}"></script>
</th:block>
<script th:if="${isPhotos}" data-pjax th:src="@{/assets/lib/justifiedGallery@3.8.1/jquery.justifiedGallery.min.js}"></script>
<th:block th:if="${isPost || enableComment != null}">
<script th:if="${pluginFinder.available('PluginCommentWidget') && (post != null || singlePage != null || enableComment != null)}" data-pjax src="/plugins/PluginCommentWidget/assets/static/comment-widget.iife.js"></script>
</th:block>
<script th:if="${enableComment}" data-pjax src="/plugins/PluginCommentWidget/assets/static/comment-widget.iife.js"></script>
<script th:src="@{/assets/js/mew-custom.min.js(mew=${theme.spec.version})}"></script>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<th:block xmlns:th="https://www.thymeleaf.org"
th:insert="~{common/layout :: layout (title = '友链 - ' + ${site.title}, canonical = @{/links}, content = ~{::content}, isPost = false)}"
th:with="enableComment = ${!#strings.isEmpty(theme.config.page_config.link_comment_id)}">
th:with="baseEnableComment = ${!#strings.isEmpty(theme.config.page_config.link_comment_id)}">
<th:block th:fragment="content"
th:with="defaultAvatar = ${#strings.defaultString(theme.config.page_config.links_default_avatar, #theme.assets('/img/avatar.svg'))}">
<div class="card">
@ -46,7 +46,7 @@
</div>
</div>
</div>
<div class="card card-content" id="comment-wrapper" th:if="${pluginFinder.available('PluginCommentWidget') && enableComment}">
<div class="card card-content" id="comment-wrapper" th:if="${enableComment}">
<h3 class="comment-title">评论</h3>
<div class="widget-comment" th:data-id="${theme.config.page_config.link_comment_id}" data-target="SinglePage"></div>
</div>

View File

@ -89,7 +89,7 @@
</div>
</th:block>
<div class="card card-content" id="comment-wrapper" th:if="${pluginFinder.available('PluginCommentWidget')}">
<div class="card card-content" id="comment-wrapper" th:if="${enableComment}">
<h3 class="comment-title">评论</h3>
<div class="widget-comment" th:data-id="${post.metadata.name}" th:data-target="${type}"></div>
</div>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<th:block
th:insert="~{common/layout :: layout (title = '瞬间 - ' + ${site.title}, canonical = @{/moments}, content = ~{::content}, isPost = true)}"
th:with="isJournals = true, enableShare = ${theme.config.post.enable_post_share}, enableComment = ${theme.config.page_config.enable_journals_comment}"
th:with="isJournals = true, enableShare = ${theme.config.post.enable_post_share}, baseEnableComment = ${theme.config.page_config.enable_journals_comment}"
xmlns:th="https://www.thymeleaf.org">
<th:block th:fragment="content">
<div class="card card-content journal" th:each="moment : ${moments.items}">
@ -37,7 +37,7 @@
<a class="share"><i class="ri-share-forward-line"></i><em>分享</em></a>
</span>
</div>
<div class="journal-comment" th:if="${enableComment && pluginFinder.available('PluginCommentWidget')}">
<div class="journal-comment" th:if="${enableComment}">
<div class="widget-comment" data-target="Moment" th:data-id="${moment.metadata.name}"></div>
</div>
</div>

View File

@ -4,5 +4,6 @@
th:with="enableKatex = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_katex'))? singlePage.metadata.annotations.get('enable_katex') : theme.config.post.enable_katex},
enableShare = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_share'))? singlePage.metadata.annotations.get('enable_share') : theme.config.post.enable_post_share},
enableCopyright = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_copyright'))? singlePage.metadata.annotations.get('enable_copyright') : theme.config.post.enable_copyright},
enableDonate = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_donate'))? singlePage.metadata.annotations.get('enable_donate') : theme.config.post.enable_post_donate}">
enableDonate = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_donate'))? singlePage.metadata.annotations.get('enable_donate') : theme.config.post.enable_post_donate},
baseEnableComment = ${singlePage.spec.allowComment}">
</th:block>

View File

@ -4,5 +4,6 @@
th:with="enableKatex = ${!#strings.isEmpty(post.metadata.annotations.get('enable_katex'))? post.metadata.annotations.get('enable_katex') : theme.config.post.enable_katex},
enableShare = ${!#strings.isEmpty(post.metadata.annotations.get('enable_share'))? post.metadata.annotations.get('enable_share') : theme.config.post.enable_post_share},
enableCopyright = ${!#strings.isEmpty(post.metadata.annotations.get('enable_copyright'))? post.metadata.annotations.get('enable_copyright') : theme.config.post.enable_copyright},
enableDonate = ${!#strings.isEmpty(post.metadata.annotations.get('enable_donate'))? post.metadata.annotations.get('enable_donate') : theme.config.post.enable_post_donate}">
enableDonate = ${!#strings.isEmpty(post.metadata.annotations.get('enable_donate'))? post.metadata.annotations.get('enable_donate') : theme.config.post.enable_post_donate},
baseEnableComment = ${post.spec.allowComment}">
</th:block>