# Elections Plugin

**URL:** https://meta.discourse.org/t/elections-plugin/68521
**Category:** Plugin
**Tags:** broken
**Created:** [August 22, 2017, 9:13am UTC](https://meta.discourse.org/t/elections-plugin/68521 "2017-08-22T09:13:06Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![Yuun](https://avatars.discourse-cdn.com/v4/letter/y/977dab/32.png) [@Yuun](https://meta.discourse.org/u/Yuun)
#### Post date: [August 28, 2017, 1:37am UTC](https://meta.discourse.org/t/elections-plugin/68521/21 "2017-08-28T01:37:20Z")

</div>

Ah, okay. Yeah that would be it, everyone can vote but only admins can see the results.

I thought it might be a task for the poll plugin, but since this was the specific application I had in mind for admin-only results I thought it was worth asking, just in case. 🙂

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [August 28, 2017, 8:28am UTC](https://meta.discourse.org/t/elections-plugin/68521/22 "2017-08-28T08:28:08Z")

</div>

More updates

The poll itself now also has the full nominee details, i.e. avatar, @username and nomination statement excerpt. The results pane uses usernames only (it is too cramped otherwise).

 ![15 PM](https://global.discourse-cdn.com/meta/original/3X/d/4/d464ed9ac0863ec2cabab42b562d51e2a2015ee2.png)  
 ![25 PM](https://global.discourse-cdn.com/meta/original/3X/7/b/7b3bcdf06f6c55dd51dd0cb4443932fbb64afa79.png)

Admins can toggle back and forth between the ‘nominate’ and ‘electing’ states at will, via topic edits. For example, rather than clicking “Start Election” you could update the state via this dropdown. Or if you wanted to go back to the nomination stage after starting the election, you can do so.

 ![46 PM](https://global.discourse-cdn.com/meta/original/3X/e/a/ea989a733985d0b21a9d93c48b21d7f4b6fe8f30.png)

> [@Yuun](#):
>
> everyone can vote but only admins can see the results.

We can still add that as a setting in this plugin by overriding certain aspects of the polls plugin. I’ll do that tomorrow or the day after.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [August 28, 2017, 3:11pm UTC](https://meta.discourse.org/t/elections-plugin/68521/23 "2017-08-28T15:11:28Z")

</div>

> [@angus](#):
>
> You mean all users are allowed to vote, but only admins can see the results? This would be an edit of the polls plugin itself, as that handles the voting. Possible to do though.

I personally think this would be a great expansion to the polls plugin. I see two neat areas for expansion: results only visible to admins, and users only visible to admins (everyone can see results). Your thoughts @erlend_sh?

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [August 28, 2017, 11:54pm UTC](https://meta.discourse.org/t/elections-plugin/68521/24 "2017-08-28T23:54:09Z")

</div>

> [@angus](#):
>
> Nominees get a little ‘nominated’ badge next to their name.

How about making that “badge” global, i.e. visible on all posts by the user and linking back to the election topic? This could help advertize the ongoing election.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [August 29, 2017, 12:48am UTC](https://meta.discourse.org/t/elections-plugin/68521/25 "2017-08-29T00:48:58Z")

</div>

> [@tophee](#):
>
> How about making that “badge” global, i.e. visible on all posts by the user and linking back to the election topic? This could help advertize the ongoing election.

Good idea. Will take a look at this.

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [August 29, 2017, 8:19am UTC](https://meta.discourse.org/t/elections-plugin/68521/26 "2017-08-29T08:19:52Z")

</div>

> [@jomaxro](#):
>
> results only visible to admins, and users only visible to admins (everyone can see results)

Yeah, I seem to recall this being requested before but I can’t find the topic. #pr-welcome for these two features @codinghorror?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 29, 2017, 12:28pm UTC](https://meta.discourse.org/t/elections-plugin/68521/27 "2017-08-29T12:28:20Z")

</div>

Let’s specify the syntax for it and then sure this can be #pr-welcome, probably pull it out to another topic.

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [August 29, 2017, 6:56pm UTC](https://meta.discourse.org/t/elections-plugin/68521/28 "2017-08-29T18:56:06Z")

</div>

I like how this plugin is evolving, and look forward to trying it out soon on my site. Nice job, @angus! And thank you! 🌻

I do think the suggestion to make election badges global to be a bit feature creepy and might have unintended consequences, and lead to you building more stuff than you really need. (e.g. is there an election nominee/candidate badge? Does each user get an elections tab on their profile indicating their nominee/candidate status throughout the election process?) So if I were you, I would try to limit the election functionality to the election topic and elections categories as much as possible, at least until the plugin has been thoroughly tested and taken through its paces.

Likewise changing who can see poll results - I do see that as a poll feature and separate from elections so am glad it’s #pr-welcome.

---

<div class="post-metadata">

### Author: ![Yuun](https://avatars.discourse-cdn.com/v4/letter/y/977dab/32.png) [@Yuun](https://meta.discourse.org/u/Yuun)
#### Post date: [August 31, 2017, 4:42am UTC](https://meta.discourse.org/t/elections-plugin/68521/29 "2017-08-31T04:42:25Z")

</div>

What needs to be done here to make the pr-welcome topic for those features? In case there’s something I could help with.

Interested in seeing that move forward, there’s a good chance I’m also the person that brought it up on the other thread alluded to. 🙂

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [August 31, 2017, 10:27am UTC](https://meta.discourse.org/t/elections-plugin/68521/30 "2017-08-31T10:27:22Z")

</div>

I opened a new topic for it:

> [@In polls: Make results and users only visible to admins](https://meta.discourse.org/t/in-polls-make-results-and-users-only-visible-to-admins/69136):
>
> Continuing the discussion from [Elections Plugin](https://meta.discourse.org/t/elections-plugin/68521/23): #pr-welcome on this feature. @jomaxro @angus what do you suggest the syntax for this should be?

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [September 1, 2017, 3:20pm UTC](https://meta.discourse.org/t/elections-plugin/68521/31 "2017-09-01T15:20:18Z")

</div>

@angus is this plugin safe to install on production yet? I’m eager to test it in the wild so I can give you better feedback. It’s looking pretty solid on your sandbox and you haven’t posted any updates in a few days. 😉

I am hopeful that we can use it in our community for upcoming elections that we have planned. 🗳

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [September 2, 2017, 3:17am UTC](https://meta.discourse.org/t/elections-plugin/68521/32 "2017-09-02T03:17:11Z")

</div>

I’ve spent a fair amount of time on this this week, and yes I do think it’s ready for limited production use. The server structure is now stable. All data is saved in custom fields (i.e. isolated). A fair amount of work has been done on edge cases and error handling.

I’ve updated the[first post](https://meta.discourse.org/t/elections-plugin/68521) in this topic with a more detailed description of the feature set. I would recommend reading that first. Also, I would recommend some initial testing on your own instance.

This is a big plugin and is interdependent on both Polls and some complex aspects of core Discourse. There will still be some issues. However, it is sufficiently stable for limited production use. It won’t break your site.

I’ve written some initial acceptance (qunit) tests and am currently working on the rspec tests.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [September 5, 2017, 6:59am UTC](https://meta.discourse.org/t/elections-plugin/68521/33 "2017-09-05T06:59:25Z")

</div>

Update: I’ve completed v1 of the [qunit](https://github.com/angusmcleod/discourse-elections/blob/master/test/javascripts/acceptance/elections-test.js.es6) and [rspec](https://github.com/angusmcleod/discourse-elections/tree/master/spec/controllers) tests for the current feature set. Further work will be as per the to do list in the OP. Currently:

- Restricted self nomination, i.e. allowing self nomination on the basis of user properties such as trust level.
- Allow any user to be designated as an Election Admin
- Allow selection of the author of the Election Post
- Additional notifications
- Email notifications
- Nominee avatar flair selection
- Nominee badges and titles
- Topic list filters for Election Topic properties, e.g. Status

Happy to work with anyone who wants to test this out.

---

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [September 11, 2017, 9:07am UTC](https://meta.discourse.org/t/elections-plugin/68521/34 "2017-09-11T09:07:05Z")

</div>

Looks good @angus.

A minor UI suggestion. On mobile, the poll gets a bit squished and there are alignment issues.

Could the nominee text be placed underneath the nominee username, taking the full width?

 ![IMG_3805](https://global.discourse-cdn.com/meta/original/3X/b/6/b6b5925ff2706592ac041db18bb32ed458116c67.jpg)

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [September 12, 2017, 9:54pm UTC](https://meta.discourse.org/t/elections-plugin/68521/35 "2017-09-12T21:54:12Z")

</div>

I like @ChrisBeach suggestion about the UI - good idea.

Having installed the plugin now on my site and in the middle of showing it to my colleagues, I suggest that you change START ELECTION to START POLL. People found that phrasing a bit confusing.

I also was thinking it might be helpful to make the nominee flair optional, and/or make the flair admin settable, like the group avatar flair. The way the flair looks now is a bit busy/quirky on my site - see below.

 ![58_PM](https://global.discourse-cdn.com/meta/original/3X/1/4/14d5a07d7484b24fbbfc8fbd206e214af1866fbe.png)

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [September 12, 2017, 11:11pm UTC](https://meta.discourse.org/t/elections-plugin/68521/36 "2017-09-12T23:11:55Z")

</div>

> [@tobiaseigen](#):
>
> I like @ChrisBeach suggestion about the UI - good idea.

Yes, I should have mentioned, I pushed that responsive style update last night. [See e.g.](https://discourse.angusmcleod.com.au/t/secretary-of-gross-national-happiness-election/13).

> [@tobiaseigen](#):
>
> I suggest that you change START ELECTION to START POLL

Oops, yes. Thought I’d made all the Election / Poll distinctions, but I ignored most obvious one… [Fixed](https://github.com/angusmcleod/discourse-elections/commit/c62bf28b42d62c6700a05eeb58305c8cbc7f364f).

> [@tobiaseigen](#):
>
> I also was thinking it might be helpful to make the nominee flair optional, and/or make the flair admin settable, like the group avatar flair. The way the flair looks now is a bit busy/quirky on my site - see below.

Yes, I agree. Will do that now.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [September 12, 2017, 11:43pm UTC](https://meta.discourse.org/t/elections-plugin/68521/37 "2017-09-12T23:43:18Z")

</div>

Ok, I’ve made the nominee avatar flair class a setting. Default is empty (off).

[https://github.com/angusmcleod/discourse-elections/commit/12ccb045d26735b707c2480bfcaa206b186f619d](https://github.com/angusmcleod/discourse-elections/commit/12ccb045d26735b707c2480bfcaa206b186f619d)

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [September 13, 2017, 2:42pm UTC](https://meta.discourse.org/t/elections-plugin/68521/38 "2017-09-13T14:42:52Z")

</div>

Whoops - trying to add a second poll in a topic already containing a poll, even outside an election category, throws a weird error. Disabling for now.

Meanwhile, now noticing that to disable the plugin I have to comment out the line in the app.cnf file and rebuild - when you get a chance can you add the ability to disable/enable the plugin via the ui, and also get to the settings via the plugins list as typical with other plugins?

 ![52 AM](https://global.discourse-cdn.com/meta/original/3X/5/e/5e71cb34d4b8c90ef5e08c2f94f98bde8d8517cd.png)

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [September 13, 2017, 11:30pm UTC](https://meta.discourse.org/t/elections-plugin/68521/39 "2017-09-13T23:30:36Z")

</div>

Thanks again for the useful feedback.

> [@tobiaseigen](#):
>
> Whoops - trying to add a second poll in a topic already containing a poll, even outside an election category, throws a weird error. Disabling for now.

Fixed.

[https://github.com/angusmcleod/discourse-elections/commit/5bb39bc8378e2d559b6eacbb4ac7f8fa5a94ab47](https://github.com/angusmcleod/discourse-elections/commit/5bb39bc8378e2d559b6eacbb4ac7f8fa5a94ab47)

> [@tobiaseigen](#):
>
> can you add the ability to disable/enable the plugin via the ui, and also get to the settings via the plugins list as typical with other plugins?

Yes. This is a little tricker than it may seem 🙂. But, you’re right it’s needed. I’ve added it.

[https://github.com/angusmcleod/discourse-elections/commit/339c542d39d86cf944f099647a05df4e11616ce4](https://github.com/angusmcleod/discourse-elections/commit/339c542d39d86cf944f099647a05df4e11616ce4)

I’ll add tests for both changes later today.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [September 16, 2017, 10:55pm UTC](https://meta.discourse.org/t/elections-plugin/68521/40 "2017-09-16T22:55:08Z")

</div>

If an anonymous user tries to self nominate, they get a 403 on `/election/nomination` and an infinispinner.

[Previous page](https://meta.discourse.org/t/elections-plugin/68521.md?page=1)

[Next page](https://meta.discourse.org/t/elections-plugin/68521.md?page=3)
