FIX: Show poll options when user is in a PM with a bot.

https://meta.discourse.org/t/discobot-dont-take-users-through-the-poll-tutorial-if-its-not-enabled/76604/9
This commit is contained in:
Guo Xiang Tan 2018-05-30 11:16:04 +08:00
parent 4ad924bcf5
commit c1fb111951
1 changed files with 10 additions and 7 deletions

View File

@ -4,14 +4,17 @@ import showModal from 'discourse/lib/show-modal';
function initializePollUIBuilder(api) {
api.modifyClass('controller:composer', {
@computed('siteSettings.poll_enabled', 'siteSettings.poll_minimum_trust_level_to_create')
canBuildPoll(pollEnabled, minimumTrustLevel) {
@computed('siteSettings.poll_enabled', 'siteSettings.poll_minimum_trust_level_to_create', 'model.topic.pm_with_non_human_user')
canBuildPoll(pollEnabled, minimumTrustLevel, pmWithNonHumanUser) {
return pollEnabled &&
this.currentUser &&
(
this.currentUser.staff ||
this.currentUser.trust_level >= minimumTrustLevel
);
(
pmWithNonHumanUser ||
this.currentUser &&
(
this.currentUser.staff ||
this.currentUser.trust_level >= minimumTrustLevel
)
);
},
actions: {