FEATURE: show like button to anon

This commit is contained in:
Sam 2016-07-05 12:11:48 +10:00
parent 473363e0fa
commit bd46bc62ff
3 changed files with 9 additions and 0 deletions

View File

@ -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;

View File

@ -98,6 +98,7 @@
showFlags="showFlags"
editPost="editPost"
showHistory="showHistory"
showLogin="showLogin"
showRawEmail="showRawEmail"
deletePost="deletePost"
recoverPost="recoverPost"

View File

@ -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');