Poll Defaults

Install this theme component

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

image

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:

3 Likes

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

So … how do we change the default to private ?

There is a site setting

2 Likes

Thanks !