We have the setting qa enable likes on answers
enabled but the are no to be seen.
We also have the official plugin Discourse Reactions installed. Can this be the cause of this bug?
We have the setting qa enable likes on answers
enabled but the are no to be seen.
We also have the official plugin Discourse Reactions installed. Can this be the cause of this bug?
I’ve just toggled Reactions on/off on my test site to check this out and it seems like it is connected. I wonder if this is a consequence of this bug fix Thumbs up, twice?
Hello,
Reactions are disabled (hide) by default on post voting topics with css.
You can reactivate it with adding a little css to a component Common/CSS
.post-voting-topic,
.post-voting-topic-sort-by-activity {
.discourse-reactions-actions {
display: inline-flex;
}
}
Thank you very much!
The limitation by default is understandable (too many options to give feedback can be confusing) but if there is a setting allowing admins to enable “likes” and those admins had enabled reactions in their site, then it would be logical to enable reactions in voting posts when they enable the setting.
And in any case, I guess more admins are likely to think that there is a bug rather than checking the code and fix the CSS.
reactions installed | post voting installed | enable likes on answers | invoke removePostMenuButton(‘like’)? |
---|---|---|---|
no | no | no (NA) | no, keep |
yes | no | NA | yes, remove the like button, show reactions |
no | yes | no | yes, remove the like button for answers |
no | yes | yes | no, keep for every post |
yes | yes | no | yes, remove the like button, also only show reactions for the first post not answers |
yes | yes | yes | yes, remove the like button, show reactions for all |
Sketched out something like a truth table here. We need to programmatically make reactions show up for posts different posts depending on the site settings, especially the enable likes on answers one
, instead of a straight up css display:none.
@tgxworld sort of caught this one back then suggesting that we should probably expose an API on discourse-reactions (t/67550/10). Perhaps we should consider that.
// Removing the `like` button
api.removePostMenuButton("like");
// And adding it again
api.decorateWidget("post-menu:before-extra-controls", (dec) => {
return dec.attach("discourse-reactions-actions", {
Instead of doing this we should add a replacePostMenuButton
method in core plugin api and use it in reactions plugin. In that case, we don’t need a separate logic for reaction button in post voting plugin.
Since there is a workaround, I will make this change after the upcoming release.
This required 3 PRs but you’re implementation idea was awesome @vinothkannans, works like a charm. Once these are all merge I’ll post again
The PRs have been merged and now and (when your Discourse instance is updated), reactions respect the qa_enable_likes_on_answers
setting. Thanks for the bug report @icaria36 !
The merged PRs break the stable release of discourse. The site does not load due to a javascript error.
Uncaught (in promise) TypeError: e.replacePostMenuButton is not a function
u discourse-reactions.js:12
withPluginApi plugin-api.js:2247
initialize discourse-reactions.js:165
initialize app.js:173
runInstanceInitializers Ember
each dag-map.js:192
walk dag-map.js:121
each dag-map.js:66
topsort dag-map.js:72
Ember 4
invoke queue.ts:201
flush queue.ts:98
flush deferred-action-queues.ts:75
_end index.ts:616
_boundAutorunEnd index.ts:257
discourse-reactions.js:12
Yeah, I should have anticipated this. I’ll push a fix to the reactions plugin to fall back when replacePostMenuButton
is not present.
Edit: I’ve merged a change that adds backwards compatability.
This topic was automatically closed after 4 days. New replies are no longer allowed.