Poll Defaults

AI-generated summary

Poll Defaults is a Discourse theme component that allows control over default poll behavior. The component was created in response to a meta discussion and was initially available for installation through a theme install button.

nathank created the component, which was well-received by users like wesochuck, who found it helpful in reducing mistakes on their forum.

However, the component was later reported to be broken nathank. Arkshine provided a potential fix, but noted some inconsistencies with the Ember upgrading guide.

The component is now obsolete, as its functionality has been incorporated into the Discourse core JammyDodger. To change the default poll setting to private, forum administrators can toggle the ‘poll default public’ site setting, as noted by Moin.

Install this theme component

This simple theme component allows some control over the default poll behaviour. It was inspired by this Topic:

Other settings could easily be added if needed.

9 Likes

THANK YOU! I’ve already got this installed on my forum and I’m looking forward to fewer “Oops” moments for the folks who participate on our forum.

4 Likes

This looks to be broken at the mo:

I’ll take a look when I get the chance, but PRs are always welcome!

1 Like

@nathank

I was looking at this code:

I think you can do the following:

api.modifyClass("component:modal/poll-ui-builder", {
  pluginId: 'poll-defaults',
  didInsertElement() {
    this._super(...arguments); // super.didInsertElement(...arguments); doesn't work (?)

    if (settings.Public) {this.set('publicPoll', true)}
    if (settings.Advanced) {this.set('showAdvanced', true)}
  }, 
});

It works.

However, I’m perplexed with didInsertElement.
poll-ui-builder is now a glimmer component. didInsertElement is not supposed to exist based on the ember upgrading guide.
I can see in core some usage. Maybe some specificity in Discourse?
Also, I’m not sure why super.didInsertElement doesn’t exist in this above code context.

1 Like

This is now part of core: :partying_face:

https://github.com/discourse/discourse/pull/24332

3 Likes

Nice!! This makes the TC nicely obsolete. I consider this mission accomplished :wink:

3 Likes

So .. how do we change the default to private ?

There is a site setting

2 Likes

Thanks !