Commit Graph

785 Commits

Author SHA1 Message Date
Joffrey JAFFEUX
ad1a10e6e9
FIX: hides votes from regular users when poll is staff only (#11342) 2020-11-24 22:19:06 +01:00
chenyxuan
defbae4007
FIX: Force string conversions to UTF-8 "bytes" (#11315)
https://meta.discourse.org/t/cant-create-poll-with-some-chinese-options/170836
2020-11-23 17:51:05 +01:00
Robin Ward
3394d994e9 FIX: Tests were using jQuery selectors
For the most part `querySelectorAll` will work with jQuery selectors,
but the big exception is `:eq(0)` and similar. Those needed to be
replaced.
2020-11-23 11:36:07 -05:00
Discourse Translator Bot
7fecad41db
Update translations (#11264) 2020-11-17 14:49:58 +01:00
Discourse Translator Bot
9904a007c5
Update translations (#11182) 2020-11-10 15:23:06 +01:00
Discourse Translator Bot
886d619d3f
Update translations (#11108) 2020-11-03 18:08:07 +01:00
Jarek Radosz
a17d54d0bf
DEV: De-arrowify tests (#11068)
Using arrow functions changes `this` context, which is undesired in tests, e.g. it makes it impossible to setup things like pretender (`this.server`) in `beforeEach` hooks.

Ember guides always use classic functions in examples (e.g. https://guides.emberjs.com/release/testing/test-types/), and that's what it uses in its own test suite, as do various addons and ember apps.

It was also already used in Discourse where `this` was required. Moving forward, it will be needed in more places as we migrate toward ember-cli.

(I might later add a custom rule to eslint-discourse-ember to enforce this)
2020-10-30 17:37:32 +01:00
Discourse Translator Bot
0a74322589
Update translations (#11087) 2020-10-30 16:06:32 +01:00
Robin Ward
435a9913a4 REFACTOR: Replace global find with queryAll
In newer Embers jQuery is removed. There is a `find` but it only returns
one element and not a jQuery selector. This patch migrates our code to a
new helper `queryAll` which allows us to remove the global.
2020-10-29 14:45:51 -04:00
Robin Ward
b302321451 REFACTOR: Test assertions should be imported.
Previously they were global functions.
2020-10-28 11:39:06 -04:00
Krzysztof Kotlarek
dbec3792b7
FIX: pretty text allow list (#10977)
Reword whitelist to allowlist in pretty-text.
This library is used by plugins so we need deprecation notice.
2020-10-28 13:22:06 +11:00
Discourse Translator Bot
9648122b51
Update translations (#11042) 2020-10-27 15:36:21 +01:00
Jarek Radosz
690a38bc9b
FIX: Show title on results of all poll types (#11041)
Previously, the title was shown only with pie chart results. Issue originally reported in https://meta.discourse.org/t/keep-the-heading-visible-when-showing-poll-results/167585

Also includes:
UX: Move the "Show breakdown" button (Display it with other poll buttons at the bottom)
FIX: Show the breakdown button only on any votes
2020-10-27 13:48:54 +01:00
Robin Ward
919f488358 REFACTOR: All remaining acceptance tests converted to new format
Also contains fixes to leaky state in pretender.
2020-10-23 09:28:13 -04:00
Discourse Translator Bot
b5933e2b49
Update translations (#10970) 2020-10-20 15:34:57 +02:00
Discourse Translator Bot
7eef10c6d7
Update translations (#10944) 2020-10-17 00:07:21 +02:00
Discourse Translator Bot
85894537b1 Update translations 2020-10-13 15:40:37 +02:00
Robin Ward
ef7d99b0a8 REFACTOR: Move test setup to a module
This is long overdue. We had a lot of (not linted) code to initialize
our test suite as part of the Ruby `test_helper.js` bundle.

This refactor moves that out to a `setup-tests` module, which imports
all the modules properly, rather than using `require`.

It also removes the global `server` variable which some tests were using
for pretender. Those tests are fixed, and in the case of widget tests,
support for a `pretend()` was added, which mimics our acceptance tests.

One problematic test was removed, which overwrites `/posts` - this could
break tons of other tests depending on order.
2020-10-08 15:11:51 -04:00
Joffrey JAFFEUX
7b34433fc2
REVERT: revert change from action + mut to mut (#10844)
* Revert "FIX: fixes regression where wizard dropdown couldn't update (#10838)"

This reverts commit e3b2fc6074.

* Revert "DEV: replaces unecessary (action (mut .*)) by (mut .*) (#10822)"

This reverts commit c0350dc362.
2020-10-06 23:50:05 +02:00
Jarek Radosz
34c99da205
FIX: Correctly render title-less poll widgets (#10837)
`RawHtml` does not like receiving undefined values as `html`.
2020-10-06 19:27:03 +02:00
Joffrey JAFFEUX
c0350dc362
DEV: replaces unecessary (action (mut .*)) by (mut .*) (#10822) 2020-10-06 17:17:45 +02:00
Discourse Translator Bot
29a9ae1b50 Update translations 2020-10-06 15:43:13 +02:00
Jarek Radosz
5c3f1202cf
FIX: Handle poll titles when headings are present (#10832)
Poll markdown processing failed when there were any heading elements preceding a poll.

(Issue originally reported in babbebfb35 (commitcomment-42983768))
2020-10-06 13:24:38 +02:00
Joffrey JAFFEUX
e6821fbaae
DEV: fixes linting of hbs files in core plugins (#10820) 2020-10-05 14:42:36 +02:00
Robin Ward
23f24bfb51 REFACTOR: Move javascript tests inside discourse app
This is where they should be as far as ember is concerned. Note this is
a huge commit and we should be really careful everything continues to
work properly.
2020-10-02 11:29:36 -04:00
Jarek Radosz
babbebfb35
FEATURE: Add the title attribute to polls (#10759)
Adds an optional title attribute to polls. The rationale for this addition is that polls themselves didn't contain context/question and relied on post body to explain them. That context wasn't always obvious (e.g. when there are multiple polls in a single post) or available (e.g. when you display the poll breakdown - you see the answers, but not the question)

As a side note, here's a word on how the poll plugin works:

> We have a markdown poll renderer, which we use in the builder UI and the composer preview, but… when you submit a post, raw markdown is cooked into html (twice), then we extract data from the generated html and save it to the database. When it's render time, we first display the cooked html poll, and then extract some data from that html, get the data from the post's JSON (and identify that poll using the extracted html stuff) to then render the poll using widgets and the JSON data.
2020-10-02 09:21:24 +02:00
Discourse Translator Bot
ecfca965f2 Update translations 2020-09-29 13:01:52 +00:00
Krzysztof Kotlarek
e7c72cd1e4
FIX: deprecate whitelist constants (#10716)
Deprecation of:
WHITELISTED_REDIRECT_HOSTNAMES
CUSTOM_INTERPOLATION_KEYS_WHITELIST
WHITELISTED_SVG_ELEMENTS
2020-09-28 13:52:05 +10:00
Joffrey JAFFEUX
530d9ab071
DEV: enforces eslint’s curly rule to the codebase (#10720)
eslint --fix is capable of fix it automatically for you, ensure prettier is run after eslint as eslint --fix could leave the code in an invalid prettier state.
2020-09-22 16:28:28 +02:00
Discourse Translator Bot
c86538097d Update translations 2020-09-22 13:04:13 +00:00
Discourse Translator Bot
6734a82260 Update translations 2020-09-16 10:17:56 +00:00
Discourse Translator Bot
5990c71c29 Update translations 2020-09-15 13:04:17 +00:00
Martin Brennan
5268568d23
FEATURE: Remove user topic timers and migrate to bookmarks with reminders (#10474)
This PR removes the user reminder topic timers, because that system has been supplanted and improved by bookmark reminders. The option is removed from the UI and all existing user reminder topic timers are migrated to bookmark reminders.

Migration does this:

* Get all topic_timers with status_type 5 (reminders)
* Gets all bookmarks where the user ID and topic ID match
* Loops through the found topic timers
  * If there is no bookmark for the OP of the topic, then we just create a bookmark with a reminder
  * If there is a bookmark for the OP of the topic and it does **not** have a reminder set, then just 
update it with the topic timer reminder
  * If there is a bookmark for the OP of the topic with a reminder then just discard the topic timer
* Cancels all outstanding user reminder topic timers
* **Trashes (not deletes) all user reminder topic timers**

Notes:

* For now I have left the user reminder topic timer job class in place; this is so the jobs can be cancelled in the migration. It and the specs will be deleted in the next PR.
* At a later date I will write a migration to delete all trashed user topic timers. They are not deleted here in case there are data issues and they need to be recovered.
* A future PR will change the UI of the topic timer modal to make it look more like the bookmark modal.
2020-09-14 11:11:55 +10:00
Discourse Translator Bot
1c71f81144 Update translations 2020-09-09 14:59:40 +00:00
Daniel Waterworth
f2842490d3 PERF: Don't load all poll_votes for a poll 2020-09-05 18:42:11 +01:00
Joffrey JAFFEUX
110f6ec6dd
DEV: fixes eslint/prettier on github actions (#10601) 2020-09-04 20:01:14 +02:00
Joffrey JAFFEUX
bf88410126
DEV: apply coding standards to plugins (#10594) 2020-09-04 13:51:53 +02:00
Robin Ward
2d56663fc4 REFACTOR: Remove _.clone which is not deep 2020-09-03 10:03:33 -04:00
Robin Ward
55c9c54b8b REFACTOR: Remove _.range and use ES6 instead 2020-09-03 10:03:33 -04:00
Discourse Translator Bot
71da5e0e27 Update translations 2020-09-01 13:02:16 +00:00
Discourse Translator Bot
d495464ead Update translations 2020-08-25 13:02:37 +00:00
Bianca Nenciu
a27b6770fd
FIX: Polls can be quoted and loaded (#10456)
Variable 'post' was used to hold the current post and the post where
the poll appeared, which can be different when polls are quoted.
2020-08-19 18:13:56 +03:00
Discourse Translator Bot
d0faee3bd8 Update translations 2020-08-18 13:02:44 +00:00
Discourse Translator Bot
1a78a429b5 Update translations 2020-08-11 13:04:00 +00:00
Jarek Radosz
cd4f251891
FEATURE: Poll breakdown 2.0 (#10345)
The poll breakdown modal replaces the grouped pie charts feature.

Includes:

* MODAL: Untangle `onSelectPanel`
Previously modal-tab component would call on click the onSelectPanel callback with itself (modal-tab) as `this` which severely limited its usefulness. Now showModal binds the callback to its controller.

"The PR includes a fix/change to d-modal (b7f6ec6) that hasn't been extracted to a separate PR because it's not currently possible to test a change like this in abstract, i.e. with dynamically created controllers/components in tests. The percentage/count toggle test for the poll breakdown feature is essentially a test for that d-modal modification."
2020-08-06 17:57:06 +02:00
Gerhard Schlager
81247c1f6a DEV: Remove mention of Transifex from locale files 2020-08-06 13:34:00 +02:00
Discourse Translator Bot
a68533b394 Update translations 2020-08-05 13:55:12 +00:00
Penar Musaraj
14eec43889
DEV: Use CSS custom properties for colors in core plugins 2020-08-04 11:14:33 -04:00
Krzysztof Kotlarek
e0d9232259
FIX: use allowlist and blocklist terminology (#10209)
This is a PR of the renaming whitelist to allowlist and blacklist to the blocklist.
2020-07-27 10:23:54 +10:00
Robin Ward
1c33f07e92 FIX: Poll tests were overwriting a couple of computed properties 2020-07-17 15:05:36 -04:00
Robin Ward
5b276af921
Remove Discourse.SiteSettings from tests (#10193)
* Remove unused Discourse.SiteSettings

* Remove `Discourse.SiteSettings` from many tests

* REFACTOR: `lib:formatter` was using a lot of leaky state

* Remove more `Discourse.SiteSettings` from tests

* More SiteSettings removed from tests
2020-07-09 15:54:53 -04:00
Bianca Nenciu
10e2578751
FIX: Set default value for poll result field (#10178) 2020-07-07 17:23:21 +03:00
Sam Saffron
9075d5a9f5
Revert "FIX: Set default value for poll result field (#10044)"
This reverts commit 40de535224.

Sadly this appears to break the JS test suite
2020-07-07 10:24:37 +10:00
Bianca Nenciu
40de535224
FIX: Set default value for poll result field (#10044) 2020-07-07 10:16:21 +10:00
Jarek Radosz
26260d50b1
DEV: Import I18n in standard plugins (#10098) 2020-06-22 02:36:45 +02:00
Gerhard Schlager
390dc5c7a9 Update translations 2020-06-21 11:58:21 +02:00
Gerhard Schlager
36a3675e0a Update translations 2020-06-14 23:39:33 +02:00
Bianca Nenciu
ff6811ceb8
Allow multiple groups which can vote when creating a poll (#10015)
* FEATURE: Allow multiple groups which can vote when creating a poll

* DEV: Fix select-kit deprecations

* DEV: Fix lint
2020-06-12 14:52:32 +03:00
Neil Lalonde
65dd8e2fa2
Update translations 2020-06-10 12:01:02 -04:00
Neil Lalonde
72c09ab4ae
Update translations 2020-06-01 13:58:51 -04:00
Neil Lalonde
3d20a1143b
Update translations 2020-05-26 10:06:07 -04:00
Joffrey JAFFEUX
faeb5793ba
UI: various tweaks to polls UI on mobile (#9864) 2020-05-23 19:08:49 +02:00
Jarek Radosz
6e3fe1abba DEV: Use async/await instead of andThen() 2020-05-11 18:22:48 +02:00
Guo Xiang Tan
6359a5f8a9
DEV: Fix poll plugin causing error when server reloads in dev env. 2020-05-08 14:59:55 +08:00
Jarek Radosz
781e3f5e10
DEV: Use response.parsed_body in specs (#9615)
Most of it was autofixed with rubocop-discourse 2.1.1.
2020-05-07 17:04:12 +02:00
Joffrey JAFFEUX
029d091ea8
FIX: displays poll's close date in local time (#9656) 2020-05-06 22:18:47 +02:00
Krzysztof Kotlarek
9bff0882c3
FEATURE: Nokogumbo (#9577)
* FEATURE: Nokogumbo

Use Nokogumbo HTML parser.
2020-05-05 13:46:57 +10:00
Neil Lalonde
3cce608379
Update translations 2020-05-04 10:39:01 -04:00
David Taylor
84be92c067
FIX: Avoid exception when rendering a poll in a trashed post
Maintain the poll belongs_to post relation when a post is trashed
2020-04-28 14:43:09 +01:00
Gerhard Schlager
7177b9d771 UX: Translating poll chart types wasn't possible 2020-04-28 14:29:42 +02:00
Gerhard Schlager
82f9dcf301 Update translations 2020-04-20 11:37:59 +02:00
Kane York
330102fd20 FEATURE: Show votes in an "on voted" poll to the creator
This required properly plumbing the guardian into the serializer.

Notably, the default state in the client was not changed - if you haven't voted in
the poll, you need to click the button to view the results instead of the results
being immediately visible on page load.

Implements https://meta.discourse.org/t/-/138108
2020-03-20 13:36:42 -07:00
Bianca Nenciu
5e4cf244a5
FIX: Show time input in poll builder (#9128) 2020-03-16 13:25:45 +01:00
Jarek Radosz
29b35aa64c
DEV: Improve flaky time-sensitive specs (#9141) 2020-03-10 22:13:17 +01:00
Jarek Radosz
48ba65f406
DEV: Clean up Ember imports (#8979)
Includes:
* Import `computed` helpers
* Import `@ember/application`
* Import `isBlank` from `@ember/utils`
* Import `A` from `@ember/array`
* Import `EmberArray` from `@ember/array`
* Import `ArrayProxy` from `@ember/array/proxy`
* Import `warn` from `@ember/debug`
* Import `EmberObject` from `@ember/object`
* Import `Application` from `@ember/application`
* Import `EmberRouter` from `@ember/routing/router`
* Import `isPresent` from `@ember/utils`
* Import `computed` from `@ember/object`
* Import `guidFor` from `@ember/object`
* Import `isArray` from `@ember/array`
* Import `TextField` from `@ember/component`
* Import `TextArea` from `@ember/component`
* Import `Promise` from `rsvp`
* Import `Evented` from `@ember/object/evented`
* Replace deprecated `ember-addons/ember-computed-decorators` imports
2020-03-06 23:49:28 +01:00
Mark VanLandingham
763a065df9
FIX: Correctly format select options for group poll by fields (#9131) 2020-03-06 12:58:59 -06:00
Neil Lalonde
4b70719a48
Update translations 2020-03-05 12:45:42 -05:00
Dan Ungureanu
c62d5b139b
FIX: Allow users to create polls in PMs with non human users (#9055) 2020-03-02 14:29:40 -05:00
Joffrey JAFFEUX
a4fc6ccc12
UX: prevents jumpyness when displaying poll voters (#9054) 2020-02-27 11:09:54 +01:00
Neil Lalonde
b0675075f7 Update translations 2020-02-25 10:29:14 -05:00
Dan Ungureanu
59db2811b0
FIX: Disable poll options if user groups do not allow them (#8987) 2020-02-18 12:13:19 +02:00
Joffrey JAFFEUX
72b6f908f4
UX: minor tweaks to poll builder UI (#8985) 2020-02-17 11:02:44 -05:00
Dan Ungureanu
82b307cd52
FIX: Use correct translation string 2020-02-17 13:49:43 +02:00
Joffrey JAFFEUX
2c7d32e783
FIX: prevents everyone group to show as group option for polls (#8957) 2020-02-14 14:11:34 +01:00
Neil Lalonde
637535fc6b Update translations 2020-02-13 15:00:16 -05:00
Mark VanLandingham
0772a4338b
FIX: Remove pie draw animation (#8940) 2020-02-12 07:09:40 -08:00
Mark VanLandingham
daaa0a657f
FIX: Render HTML for pie chart options (#8912) 2020-02-11 10:02:54 -06:00
Joffrey JAFFEUX
8ca9ad887d
FIX: replaces fake null value by clearable option (#8875) 2020-02-06 08:30:26 +01:00
Mark VanLandingham
5d97286fa7
FEATURE: Allow single option polls (#8853) 2020-02-05 08:03:27 -06:00
Joffrey JAFFEUX
0431942f3d
DEV: select-kit 2 (#7998)
This new iteration of select-kit focuses on following best principales and disallowing mutations inside select-kit components. A best effort has been made to avoid breaking changes, however if you content was a flat array, eg: ["foo", "bar"] You will need to set valueProperty=null and nameProperty=null on the component.

Also almost every component should have an `onChange` handler now to decide what to do with the updated data. **select-kit will not mutate your data by itself anymore**
2020-02-03 14:22:14 +01:00
Bianca Nenciu
07222af7ab
FEATURE: Add 'groups' option to polls (#8469)
This options can be used to restrict polls to certain groups.
2020-01-28 14:30:04 +02:00
Neil Lalonde
2dd1ff79b4 Update translations 2020-01-20 11:00:44 -05:00
Jarek Radosz
fe588cc7f8
DEV: Fix function prototype deprecations (#8681)
* DEV: Fix the function prototype observers deprecation

DEPRECATION: Function prototype extensions have been deprecated, please migrate from function(){}.observes('foo') to observer('foo', function() {}). [deprecation id: function-prototype-extensions.observes] See https://deprecations.emberjs.com/v3.x/#toc_function-prototype-extensions-observes for more details.

* DEV: Fix the function prototype event listeners deprecation

DEPRECATION: Function prototype extensions have been deprecated, please migrate from function(){}.on('foo') to on('foo', function() {}). [deprecation id: function-prototype-extensions.on] See https://deprecations.emberjs.com/v3.x/#toc_function-prototype-extensions-on for more details.

* DEV: Simplify `default as` imports

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2020-01-16 18:56:53 +01:00
Jarek Radosz
9e3fc1111d
FIX: Add a blank poll options validation (#8652)
Before, saving a post with a blank poll option resulted in error 500.
2020-01-03 15:09:36 +01:00
Krzysztof Kotlarek
8c2e27790c
FIX: everyone can see poll results when on_vote and closed (#8613)
The bug was mentioned here: https://meta.discourse.org/t/poll-name/136436

I added specs to cover existing behaviour and refactored can_see_results method.

Guard condition should apply only if the poll result setting is set to `staff_only`.

In other cases, user can see results when the poll result setting is set to `always` or user voted or poll is closed.
2019-12-24 08:04:35 +11:00
Neil Lalonde
91b290c784 Update translations 2019-12-19 12:31:52 -05:00
Mark VanLandingham
44612f900e
FIX: Remove 'staff_only' results option for non-staff (#8565) 2019-12-17 13:43:15 -08:00
Gerhard Schlager
dfb9fa3b98 Update translations 2019-12-10 13:10:55 +01:00
Rafael dos Santos Silva
dbee72e92b FIX: Export poll UI should only show for admins 2019-12-05 17:03:06 -03:00
Neil Lalonde
50b98a47ac Update translations 2019-12-05 11:20:52 -05:00