Poll Defaults

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개의 좋아요

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개의 좋아요

This looks to be broken at the mo:

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

1개의 좋아요

@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개의 좋아요

This is now part of core: :partying_face:

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

3개의 좋아요

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

3개의 좋아요

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

There is a site setting

2개의 좋아요

Thanks !