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;
|
||||
}
|
||||
|
||||
if (!currentUser) {
|
||||
postAtts.showLike = !topic.archived;
|
||||
}
|
||||
|
||||
if (postAtts.post_number === 1) {
|
||||
postAtts.canRecoverTopic = topic.deleted_at && details.can_recover;
|
||||
postAtts.canDeleteTopic = !topic.deleted_at && details.can_delete;
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
showFlags="showFlags"
|
||||
editPost="editPost"
|
||||
showHistory="showHistory"
|
||||
showLogin="showLogin"
|
||||
showRawEmail="showRawEmail"
|
||||
deletePost="deletePost"
|
||||
recoverPost="recoverPost"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { createWidget } from 'discourse/widgets/widget';
|
||||
import { avatarAtts } from 'discourse/widgets/actions-summary';
|
||||
import { h } from 'virtual-dom';
|
||||
import User from 'discourse/models/user';
|
||||
|
||||
const LIKE_ACTION = 2;
|
||||
|
||||
|
@ -307,6 +308,9 @@ export default createWidget('post-menu', {
|
|||
},
|
||||
|
||||
like() {
|
||||
if (!User.current()) {
|
||||
return this.sendWidgetAction('showLogin');
|
||||
}
|
||||
const attrs = this.attrs;
|
||||
if (attrs.liked) {
|
||||
return this.sendWidgetAction('toggleLike');
|
||||
|
|
Loading…
Reference in New Issue