Skip to content

Commit

Permalink
feat: support set gravatar source. (halo-dev/console#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby authored Mar 28, 2021
1 parent f5aac99 commit be08806
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 25 deletions.
14 changes: 2 additions & 12 deletions src/components/Tools/HeaderComment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
<a-list :loading="postCommentsLoading" :dataSource="converttedPostComments">
<a-list-item slot="renderItem" slot-scope="item">
<a-list-item-meta>
<a-avatar
class="bg-white"
slot="avatar"
:src="'//cn.gravatar.com/avatar/' + item.gravatarMd5 + '&d=mm'"
size="large"
/>
<a-avatar class="bg-white" slot="avatar" :src="item.avatar" size="large" />
<template slot="title">
<a :href="item.authorUrl" target="_blank">{{ item.author }}</a
>:<span v-html="item.content"></span>
Expand All @@ -36,12 +31,7 @@
<a-list :loading="sheetCommentsLoading" :dataSource="converttedSheetComments">
<a-list-item slot="renderItem" slot-scope="item">
<a-list-item-meta>
<a-avatar
class="bg-white"
slot="avatar"
:src="'//cn.gravatar.com/avatar/' + item.gravatarMd5 + '&d=mm'"
size="large"
/>
<a-avatar class="bg-white" slot="avatar" :src="item.avatar" size="large" />
<template slot="title">
<a :href="item.authorUrl" target="_blank">{{ item.author }}</a
>:<span v-html="item.content"></span>
Expand Down
2 changes: 1 addition & 1 deletion src/views/comment/components/CommentTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<a v-if="type === 'posts'" :href="item.post.fullPath" target="_blank">《{{ item.post.title }}》</a>
<a v-if="type === 'sheets'" :href="item.sheet.fullPath" target="_blank">《{{ item.sheet.title }}》</a>
</template>
<a-avatar slot="avatar" size="large" :src="'//cn.gravatar.com/avatar/' + item.gravatarMd5 + '&d=mm'" />
<a-avatar slot="avatar" size="large" :src="item.avatar" />
<span
slot="title"
style="max-width: 300px;display: block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
Expand Down
5 changes: 1 addition & 4 deletions src/views/comment/components/TargetCommentTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<a-icon type="user" v-if="comment.isAdmin" style="margin-right: 3px;" />
{{ comment.author }}
</a>
<a-avatar size="large" slot="avatar" :src="avatar" :alt="comment.author" />
<a-avatar size="large" slot="avatar" :src="comment.avatar" :alt="comment.author" />
<p slot="content" v-html="content"></p>
<a-tooltip slot="datetime">
<span slot="title">{{ comment.createTime | moment }}</span>
Expand Down Expand Up @@ -78,9 +78,6 @@ export default {
}
},
computed: {
avatar() {
return `//cn.gravatar.com/avatar/${this.comment.gravatarMd5}/?s=256&d=mp`
},
content() {
return marked(this.comment.content)
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/dashboard/components/RecentCommentTab.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<a-list itemLayout="horizontal" :dataSource="formmatedCommentData" :loading="loading">
<a-list-item slot="renderItem" slot-scope="item, index" :key="index">
<a-comment :avatar="'//cn.gravatar.com/avatar/' + item.gravatarMd5 + '/?s=256&d=mp'">
<a-comment :avatar="item.avatar">
<template slot="author" v-if="type === 'posts'">
<a :href="item.authorUrl" target="_blank">{{ item.author }}</a> 发表在 《<a
v-if="item.post.status == 'PUBLISHED' || item.post.status == 'INTIMATE'"
Expand Down
12 changes: 5 additions & 7 deletions src/views/system/optiontabs/CommentTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@
<a-form-model-item label="API 评论开关:" help="* 关闭之后将无法进行评论">
<a-switch v-model="options.comment_api_enabled" />
</a-form-model-item>
<a-form-model-item label="评论模块 JS:">
<a-input
type="textarea"
:autoSize="{ minRows: 2 }"
v-model="options.comment_internal_plugin_js"
placeholder="该设置仅对内置的评论模块有效"
/>
<a-form-model-item label="评论模块 JS:" help="* 该设置需要主题支持">
<a-input type="textarea" :autoSize="{ minRows: 2 }" v-model="options.comment_internal_plugin_js" />
</a-form-model-item>
<a-form-model-item label="Gravatar 镜像源:" help="* 例如://gravatar.com/avatar/">
<a-input v-model="options.gravatar_source" />
</a-form-model-item>
<a-form-model-item label="每页显示条数: ">
<a-input-number v-model="options.comment_page_size" :min="1" style="width:100%" />
Expand Down

0 comments on commit be08806

Please sign in to comment.