mirror of
https://github.com/discourse/discourse.git
synced 2025-03-26 21:56:06 +08:00
FEATURE: show like button to anon
This commit is contained in:
parent
473363e0fa
commit
bd46bc62ff
@ -194,6 +194,10 @@ export default function transformPost(currentUser, site, post, prevPost, nextPos
|
|||||||
postAtts.likeCount = likeAction.count;
|
postAtts.likeCount = likeAction.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!currentUser) {
|
||||||
|
postAtts.showLike = !topic.archived;
|
||||||
|
}
|
||||||
|
|
||||||
if (postAtts.post_number === 1) {
|
if (postAtts.post_number === 1) {
|
||||||
postAtts.canRecoverTopic = topic.deleted_at && details.can_recover;
|
postAtts.canRecoverTopic = topic.deleted_at && details.can_recover;
|
||||||
postAtts.canDeleteTopic = !topic.deleted_at && details.can_delete;
|
postAtts.canDeleteTopic = !topic.deleted_at && details.can_delete;
|
||||||
|
@ -98,6 +98,7 @@
|
|||||||
showFlags="showFlags"
|
showFlags="showFlags"
|
||||||
editPost="editPost"
|
editPost="editPost"
|
||||||
showHistory="showHistory"
|
showHistory="showHistory"
|
||||||
|
showLogin="showLogin"
|
||||||
showRawEmail="showRawEmail"
|
showRawEmail="showRawEmail"
|
||||||
deletePost="deletePost"
|
deletePost="deletePost"
|
||||||
recoverPost="recoverPost"
|
recoverPost="recoverPost"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { createWidget } from 'discourse/widgets/widget';
|
import { createWidget } from 'discourse/widgets/widget';
|
||||||
import { avatarAtts } from 'discourse/widgets/actions-summary';
|
import { avatarAtts } from 'discourse/widgets/actions-summary';
|
||||||
import { h } from 'virtual-dom';
|
import { h } from 'virtual-dom';
|
||||||
|
import User from 'discourse/models/user';
|
||||||
|
|
||||||
const LIKE_ACTION = 2;
|
const LIKE_ACTION = 2;
|
||||||
|
|
||||||
@ -307,6 +308,9 @@ export default createWidget('post-menu', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
like() {
|
like() {
|
||||||
|
if (!User.current()) {
|
||||||
|
return this.sendWidgetAction('showLogin');
|
||||||
|
}
|
||||||
const attrs = this.attrs;
|
const attrs = this.attrs;
|
||||||
if (attrs.liked) {
|
if (attrs.liked) {
|
||||||
return this.sendWidgetAction('toggleLike');
|
return this.sendWidgetAction('toggleLike');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user