Commit Graph
32 Commits
Author SHA1 Message Date
Jarek RadoszandGitHub 5308a42ab2 DEV: Replace remaining uses of query helper (#30019) 2025-01-22 00:25:03 +01:00
David TaylorandGitHub fc0e1f109d DEV: Run prettier correctly for bundled-plugin test directories (#30338) 2024-12-18 12:02:28 +00:00
Jarek RadoszandGitHub 09bfc5ec71 DEV: Finish qunit-dom hasText migration (#30017) 2024-12-01 14:00:48 +01:00
Jarek RadoszandGitHub 2ae246e9ad DEV: Extensively use qunit-dom's hasText (#30012) 2024-11-30 16:44:51 +01:00
ead4819fe4 DEV: lint poll test (#29937)
Co-authored-by: David Taylor <[email protected]>
2024-11-26 16:22:33 +01:00
Joffrey JAFFEUXandGitHub 912ea9ed84 DEV: ensures poll-test is correctly linted (#29936)
Broken in https://github.com/discourse/discourse/commit/83cdff37b3ca9f3254bca8d8d1deae949ccaa3df
2024-11-26 14:18:30 +01:00
RobertandGitHub 83cdff37b3 FIX: Poll: ensure it is not possible to vote with all abstentions in Ranked Choice (#29601)
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 TaylorandGitHub 49cc33b355 DEV: Consolidate i18n import paths (#29804)
Enables our new eslint rules which enforce consistent i18n imports. For more info, see https://github.com/discourse/lint-configs/commit/0d58b40cd7d170a9f70bcef5c173f95eeb498298
2024-11-19 20:45:18 +00:00
Jarek RadoszandGitHub 6c5ab2c6ec DEV: Use qunit-dom's isDisabled/isEnabled (#29675) 2024-11-10 02:24:58 +01:00
Jarek RadoszandGitHub b3d4b1050a DEV: Replace count with qunit-dom (#29674) 2024-11-10 02:06:03 +01:00
RobertandGitHub 5ba6d8cd77 FIX: poll ranked choice results not showing on first vote (#28542)
Currently (for Ranked Choice only) a javascript exception is raised on very first vote, preventing the results from being rendered requiring a browser refresh (which doesn't error).

Resolves: TypeError: this.args.rankedChoiceOutcome.round_activity is undefined with simple addition of optional chaining operator.
2024-11-05 09:29:07 +08:00
Jarek RadoszandGitHub a5a92152cc DEV: Convert more test assertions to qunit-dom (#29214)
the PR is sponsored by vscode's regex support in find-and-replace 😉
2024-10-15 17:11:20 +02:00
0d3b9f247e DEV: remap all core icons for fontawesome 6 upgrade (#28715)
Followup to 30ac4e8bb2

Co-authored-by: David Taylor <[email protected]>
2024-09-13 16:50:52 +01:00
David TaylorandGitHub be28589cc0 DEV: Remove widget wrapper from poll plugin (#28666)
- 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
Joffrey JAFFEUXandGitHub 9d894fcf57 UX: explain choices priorities (#28574)
This commit will add `highest priority` to first choice and `lowest priority` to the last choice to make it more explicit to the user.
2024-08-27 13:03:48 +02:00
RobertandGitHub 9501c90dce FIX: poll when config is on_close only show results when poll is closed (#28299)
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
锦心andGitHub a3946acc0e FEATURE: Absolute Numbers in Poll (#28240)
What does this add?
===================

This PR adds an extra button to the poll to show the absolute number of
people who voted for each option. This button will only be added for
the single/multi-select bar chart.

Related meta topic: https://meta.discourse.org/t/absolute-numbers-in-polls/32771
2024-08-07 11:46:29 +02:00
RobertandGitHub 73c676b41d FIX: update voter information upon remote change (#28168)
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
Jarek RadoszandGitHub 5d8ddf8f4b DEV: Clean up imports (#28060)
* `@ember/owner` instead of `@ember/application`
* `discourse-i18n` instead of `I18n`
* `{ service } from "@ember/service"` instead of `inject as service`
2024-07-25 15:09:06 +02:00
b1b3744fbe FEATURE: Add Ranked Choice Voting
using Instant Run-off Voting algorithm to Poll Plugin (Part 2 add Ranked Choice)

---------

Co-authored-by: Joffrey JAFFEUX <[email protected]>
Co-authored-by: Jarek Radosz <[email protected]>
2024-07-17 11:49:14 +02:00
RobertandGitHub 959c98c565 FIX: Poll: Show gear button only when there is more than one dropdown item (#27775)
During migration of Poll plugin from widget basis to glimmer, some functionality was inadvertently dropped:

- A single button should appear instead of the dropdown menu when there is only one valid "poll admin" action
- No button should appear when there are no valid "poll admin" actions for current user

This PR restores the original behaviour and adds test coverage (that didn't exist prior to migration, partly why it wasn't caught earlier)

relates to #27204

related meta topic:  https://meta.discourse.org/t/what-is-the-gear-button-under-the-poll-for/315477/2
2024-07-11 11:19:04 +08:00
241399bba9 DEV: Check for poll element presence (#27765)
Fixes a flaky test. `afterUpdate` from chart.js is not integrated with the runloop and component lifecycle, as a result we have no guarantee on when it will happen. The easiest change we can do for now is ensuring we actually have the DOM we expect to have, and if not, we exit early.


Co-authored-by: Joffrey JAFFEUX <[email protected]>
Co-authored-by: merefield <[email protected]>
2024-07-08 13:58:35 +02:00
Alan Guo Xiang TanandGitHub 309ad24963 DEV: Skip flaky polls acceptance test (#27757)
Example of flakiness: https://github.com/discourse/discourse/actions/runs/9831645793/job/27139325323
2024-07-08 09:11:38 +08:00
RobertandGitHub 2c264970ed FIX: Allow safe html in poll options (#27741) 2024-07-07 15:08:00 +02:00
RobertandGitHub 5d564b8335 FIX: Poll: critical display issue when results are only shown upon vote (#27732) 2024-07-05 10:55:14 +02:00
Alan Guo Xiang TanandGitHub 45429d0e4e DEV: Skip flaky poll QUnit acceptance tests (#27728)
The skipped tests have become flaky after
674db4d059, skip those tests for now while
we sort things out.
2024-07-05 10:59:51 +08:00
RobertandGitHub 2440d5e119 FIX: Poll: do not attempt to show voter list on private polls (#27714)
* FIX: avoid attempting to enrich results with undefined voters
2024-07-04 18:20:37 +02:00
RobertandGitHub 674db4d059 FEATURE: Add Instant Run-off Voting to Poll Plugin (Part 1: migrate existing plugin to Glimmer only) (#27204)
The "migration to Glimmer" has been broken out here from #27155 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 #27155.
2024-07-04 13:34:48 +02:00
David TaylorandGitHub a32f754b08 FEATURE: Configure poll 'public' default via site setting (#24348)
Followup to 7afebcd78e
2023-11-13 18:54:21 +00:00
David TaylorandGitHub 7afebcd78e UX: Create polls with public=true by default (#24332)
In the vast majority of cases, people want poll voters to be public. Previously, the checkbox for this was hidden behind the 'show advanced' settings in the poll builder UI.

This commit makes three changes to improve the experience:

1. Add `public=true|false` to poll markup (previously it would only be added when true

2. Bring the 'public' switch outside the 'show advanced' section for improved visibility

3. Change the default to 'true'
2023-11-13 09:07:51 +11:00
David Taylor b3015f51ca DEV: Sort imports
Automatically generated by `eslint --fix` to satisfy the updated configuration
2023-10-10 21:46:54 +01:00
David TaylorandGitHub c7172ab9eb DEV: Convert poll modals to new component-based API (#22164) 2023-07-04 15:25:34 +01:00