Commit Graph

9 Commits

Author SHA1 Message Date
Joffrey JAFFEUX
a692e87b72
DEV: lint poll test ()
Co-authored-by: David Taylor <david@taylorhq.com>
2024-11-26 16:22:33 +01:00
Joffrey JAFFEUX
7333a00ddb
DEV: ensures poll-test is correctly linted ()
Broken in a535798659
2024-11-26 14:18:30 +01:00
Robert
a535798659
FIX: Poll: ensure it is not possible to vote with all abstentions in Ranked Choice ()
Make sure Cast Vote button is disabled when all abstain and remove any historic data that fails new zero rank vote validation
2024-11-26 20:16:22 +08:00
David Taylor
32665cf9dd
DEV: Consolidate i18n import paths ()
Enables our new eslint rules which enforce consistent i18n imports. For more info, see 0d58b40cd7
2024-11-19 20:45:18 +00:00
Jarek Radosz
16a9663557
DEV: Use qunit-dom's isDisabled/isEnabled () 2024-11-10 02:24:58 +01:00
David Taylor
e6edd52047
DEV: Remove widget wrapper from poll plugin ()
- Uses `helper.renderGlimmer` with GJS to render the `<Poll` component without any widgets

- Moves some logic into component, so that only `@post`, `@poll` and `@titleHTML` need to be passed into the component (no more 'attrs')

- Updates `modifyClass` calls to modern syntax

- Replaces observer in `Post` model with a native setter & tracked property

- Replaced Poll EmberObject instances with TrackedObject

- Updated component tests with new arguments

- Updated some tests to qunit-dom

- Fixed up core `repliesBelow` and `repliesAbove` logic to create post models properly. Previously it was passing 'transformed' versions of posts into the model, which doesn't make sense.
2024-09-04 09:38:22 +01:00
Robert
47f749744f
FIX: poll when config is on_close only show results when poll is closed ()
See: https://meta.discourse.org/t/cant-edit-topic-with-poll-bug-occurs/320845?u=merefield

When the Poll is set to "results ON_CLOSE", vote numbers for each option are only streamed to the browser when the vote is Closed. It is therefore not possible to render the Results.

The current issue is that when you refresh the page, for those that have voted the default view is results. For this type of poll this should NOT happen. The Results view in this mode should not be possible to see until closure, even for the Author.

Because the votes are not yet serialised when this kind of poll remains open, an attempt to display results causes a JavaScript exception and in any case does not make logical sense.

So the fix here is making sure the default view, for Polls that have results on close, is the voting view until the Poll is Closed.

I've added a test to cover this scenario.

Additionally, this requires a refresh of the page when the poll admin actions a Close to ensure the results are serialized in.
2024-08-13 09:29:16 +02:00
Robert
26c4d1398a
FIX: update voter information upon remote change ()
Fixes issue with polls not being fully updated by remote vote contributions in (semi-) real-time.

This was down to too great a focus on tracking local state and not accommodating a more data down approach with responsive getters.

This is now implemented.

I've tried hard to minimise the changes whilst making sure the paradigm is properly followed through.
2024-08-02 08:50:33 +02:00
Robert
e3b6be15b8
FEATURE: Add Instant Run-off Voting to Poll Plugin (Part 1: migrate existing plugin to Glimmer only) ()
The "migration to Glimmer" has been broken out here from  to make the review process less onerous and reduce change risk: 

* DEV: migrates most of the widget code to Glimmer in prep for IRV additions
* NB This already incorporates significant amounts of review and feedback from the prior PR.
* NB because there was significant additional feedback relating to older Poll code that I've improved with feedback, there are some additional changes here that are general improvements to the plugin and not specific to IRV nor Glimmer!
* There should be no trace of IRV code here.

Once this is finalised and merged we can continue to progress with .
2024-07-04 13:34:48 +02:00