Commit Graph

1070 Commits

Author SHA1 Message Date
0336235c74 DEV: Use object spread instead of Object.assign (#30407) 2024-12-23 08:44:29 +01:00
1631c39391 Update translations (#30319) 2024-12-18 15:19:37 +01:00
8f6c99df8c DEV: Run prettier correctly for bundled-plugin test directories (#30338) 2024-12-18 12:02:28 +00:00
c65192a7a2 Update translations (#30202) 2024-12-10 20:16:34 +01:00
0f2033dd69 DEV: Update more deprecated Font Awesome icon names (#30163)
* DEV: Update more deprecated Font Awesome icon names

* revert update to icon-library test - test is covering deprecation case
2024-12-08 22:14:28 +01:00
838d7478c1 Update translations (#30062) 2024-12-04 11:59:28 +01:00
efa2589204 DEV: Finish qunit-dom hasText migration (#30017) 2024-12-01 14:00:48 +01:00
dfb74d90c3 DEV: Extensively use qunit-dom's hasText (#30012) 2024-11-30 16:44:51 +01:00
ef7518d4ad DEV: Fix no-loose-assertions lint (#29965)
and enable some of qunit lints
2024-11-28 11:22:27 +01:00
d6bec460a8 DEV: Upgrade Rails to version 7.2 2024-11-27 10:48:47 +01:00
b9f183e2c3 Update translations (#29934) 2024-11-26 23:14:56 +01:00
a692e87b72 DEV: lint poll test (#29937)
Co-authored-by: David Taylor <david@taylorhq.com>
2024-11-26 16:22:33 +01:00
7333a00ddb DEV: ensures poll-test is correctly linted (#29936)
Broken in a535798659
2024-11-26 14:18:30 +01:00
a535798659 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
6f7c581a80 DEV: Bump @discourse/lint-configs and autofix (#29847)
In particular, this applies:

- new `discourse/no-implicit-this` template-lint rule
- `init`/`willDestroy` ordering enforcement
- `lines-between-class-members`
2024-11-20 14:15:04 +00:00
abfd065ff0 Update translations (#29835) 2024-11-20 00:21:25 +01:00
32665cf9dd DEV: Consolidate i18n import paths (#29804)
Enables our new eslint rules which enforce consistent i18n imports. For more info, see 0d58b40cd7
2024-11-19 20:45:18 +00:00
16a9663557 DEV: Use qunit-dom's isDisabled/isEnabled (#29675) 2024-11-10 02:24:58 +01:00
d67a6002eb DEV: Replace count with qunit-dom (#29674) 2024-11-10 02:06:03 +01:00
de6d575d40 DEV: Convert all uses of exists to qunit-dom (#29667) 2024-11-10 01:30:33 +01:00
c1916f7984 DEV: Convert assert.true(exists()) to qunit-dom (#29638) 2024-11-08 20:27:32 +01:00
1aa836163e 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
40a4d55c77 FIX: poll ranked choice voter expansion should append additional voters (#28432)
Currently, for Ranked Choice results and voter list expansion, the code is replacing the voter list with the newly fetched page of voters instead of appending to the existing voter list. This is resolved in this PR and brings it in line with regular polls.

See: https://meta.discourse.org/t/ranked-choice-poll-does-not-reflect-change-of-votes-in-outcome/321227/18
2024-11-05 09:28:32 +08:00
f371258b42 UX: Give ranked choice polls distinctive bullets in preview (#29439) 2024-10-28 11:10:37 -04:00
b9ec9c7e4f DEV: Update more asserts to qunit-dom (#29326)
regex find&replace + removing now-unused imports + manually fixing incorrect css selectors (that now got flagged 😌) + manually updating selectors that relied on jq
2024-10-22 11:34:23 +02:00
322a3be2db DEV: Remove logical OR assignment of constants (#29201)
Constants should always be only assigned once. The logical OR assignment
of a constant is a relic of the past before we used zeitwerk for
autoloading and had bugs where a file could be loaded twice resulting in
constant redefinition warnings.
2024-10-16 10:09:07 +08:00
688f65a39d 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
a4531be580 Update translations (#29123) 2024-10-08 20:21:43 +02:00
50cb7b897e FIX: Use full column name to prevent ambiguous query (#29111)
This can happen when other plugins, for example discourse-rainbow, are
installed and add columns with same names.
2024-10-07 19:33:07 +03:00
76ad581f67 Update translations 2024-10-02 08:55:44 +02:00
dd5502f166 PERF: Cache serialized voters at topic view level (#28894)
This commit introduces a way to fetch the "serialized voters" for
multiple polls.

* Use a single query to fetch voters for all types of polls

* Refactor to introduce all_serialized_voters

* Cache serialized voters
2024-09-18 12:01:40 +03:00
a914d3230b DEV: remap all core icons for fontawesome 6 upgrade (#28715)
Followup to 7d8974d02f7360b324b446868463e950fe92883f

Co-authored-by: David Taylor <david@taylorhq.com>
2024-09-13 16:50:52 +01:00
18fca966c5 FIX: Incorrect titles in two components (#28865) 2024-09-11 22:45:41 +02:00
d63ffe22f4 DEV: Track SQL queries from MiniSql (#28824)
`track_sql_queries` only returned queries that were executed by
ActiveRecord. All queries executed through DB.exec, DB.query and others
were not returned.
2024-09-11 10:14:53 +03:00
1a88728d39 FIX: Poll voters list wasn't expanding properly (#28823) 2024-09-10 11:46:12 -04:00
9b0300a647 PERF: Preload voters_count and has_voted (#28808)
These fields are often used when serializing topics which may contain
multiple polls. On average, serializing a poll took 2+N queries where N
is the number of options. This change reduces the number of queries to
3, one for each field (Poll#voters_count, PollOption#voters_count and
Poll#has_voted?).
2024-09-10 18:41:08 +03:00
88e1690d86 FIX: poll preview list styling remove redundant bullets (#28592) 2024-09-10 10:54:59 +02:00
e6edd52047 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
0171eb0c94 Update translations (#28705) 2024-09-03 11:46:50 -04:00
b1e539c1b9 Update translations (#28682) 2024-09-02 18:00:43 +02:00
68c9553251 Update translations (#28577) 2024-08-29 15:37:52 -04:00
c95f9dbf34 FIX: poll ensure ranked choice results can handle options with rich text and links (#28195)
cf. https://meta.discourse.org/t/links-in-ranked-choice-polls-do-not-render-correctly-in-results-view/319098
2024-08-28 15:48:50 +02:00
7335b44d4f 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
9f32bef544 Update translations (#28438) 2024-08-20 17:54:10 +02:00
0679e6eb7a FIX: make poll voter list expansion persistent (#28352)
* FIX: voter list expansion

* naming improvement

* extend and refine test
2024-08-19 15:55:22 +10:00
05e120a9f2 Update translations (#28246) 2024-08-13 16:31:24 +02:00
355dbb928a Revert "DEV: Use on modifier (or @action param) (#28323)" (#28338)
This reverts commit e3e5710b3d0c81217628bf913d888eab800e6435.
2024-08-13 12:39:24 +02:00
e3e5710b3d DEV: Use on modifier (or @action param) (#28323)
instead of `onclick` prop
2024-08-13 10:50:09 +02:00
47f749744f 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
60d62f1b7e FIX: poll ranked choice voter list corrupting on expand (#28315)
Initially, the poll results display a maximum of 25 voters per option. If the number of voters exceeds this limit, a button allows users to load additional pages of voters.

When this button is clicked, a method is called to retrieve the additional voter information. However, there was a bug where the local tracked object was not properly updated for ranked choice voters. This is due to the existence of two attributes per option: one indicating whether new data is currently loading, and the other containing the list of voters.

Instead of updating the entire option key with the voters list, the fix requires updating the voters attribute only.

This is a small but critical change. The pull request also includes a new test that significantly increases coverage, addressing this issue and beyond.
2024-08-13 09:28:28 +02:00