Commit Graph

918 Commits

Author SHA1 Message Date
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
Mark VanLandingham 118fef2353
FIX: Hide pie legend when results are grouped (#8445) 2019-12-02 13:59:52 -06:00
Mark VanLandingham 87a298a59b
FIX: Poll pie container was too large (#8444) 2019-12-02 11:51:06 -06:00
David Taylor dd8fe1a9e7 DEV: Update annotations 2019-11-29 15:49:08 +00:00
Joffrey JAFFEUX 0807751390
REFACTOR: poll-pie-chart widget (#8415)
This commit mostly get rid of the later() call and encapsulate all pie chart display logic inside discourse-poll-pie-canvas widget instead of sharing it between discourse-poll-pie-chart and discourse-poll-pie-canvas
2019-11-27 00:10:43 +01:00
Mark VanLandingham a3157f0e38
FIX: The build; ran prettier (#8412) 2019-11-25 12:12:44 -06:00
Mark VanLandingham b92a8131c0
FEATURE: Pie chart option for poll results (#8352) 2019-11-25 11:51:01 -06:00
Benjamin Hipple c75ebfee57 UX: Rename 'Hide results' to 'Show vote' in polls (#8403)
For various reasons, users may want to change their response to a poll.
Currently they have permission to do so, however it is hidden behind the 'Hide
results' button. Since what this button does is take the user back to the vote
panel, it seems more appropriate to name it 'Show vote', where it becomes
obvious that it can be modified and re-submitted.

As discussed here [1], there are mulitple users, myself included, who assumed
that editing a misclick response was impossible. This improves the label to make
it more descriptive of the action actually being taken.

[1] https://meta.discourse.org/t/ability-to-remove-my-choice-in-a-poll/53642/6
2019-11-25 12:26:19 +01:00
Rafael dos Santos Silva fd0025a735
FEATURE: Add export poll button (#8370)
This PR aims to make poll results easily exportable to staff in a CSV format, so they can be analyzed in external software.

It also makes the export data easily customizable by allowing users to leverage any data explorer query to generate the report. By default, we use a query that ships with data explorer, but user can change the ID in settings or use 0 to disable this feature.

One potential upgrade is using the recent work that allows arbitrary group to run data explorer and allow all the groups with access to the configured query to also export polls, but that can be added later.

Co-Authored-By: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2019-11-22 16:06:39 -03:00
Penar Musaraj 20f5a062f4 Fix Prettier in poll plugin 2019-11-15 11:01:22 -05:00
Gerhard Schlager f72730703a Update translations 2019-11-14 15:41:42 +01:00
Robin Ward f518065654 FIX: computed is part of `@ember/object` not `@ember/object/computed` 2019-11-13 11:58:09 -05:00
Arpit Jalan 5ff84be8cc FIX: do not strip nil string 2019-11-13 16:58:14 +05:30
Jarek Radosz 5d4b240453
DEV: Provide radix argument to parseInt (#8281)
* DEV: Provide radix 10 argument to parseInt

* DEV: Provide radix 16 argument to parseInt

* DEV: Remove unnecessary parseInt calls

* Fix year formatting

parseInt was used here to convert decimals to ints
2019-11-12 10:47:42 +01:00
Robin Ward e39d89ecd9 REFACTOR: Remove `InputValidation` which was simply an `Ember.Object` 2019-11-11 15:48:56 -05:00
Gerhard Schlager 94a34af702 Update translations 2019-11-05 16:52:48 +01:00
Bianca Nenciu 690db4fd36
FIX: Show poll voters in Oneboxed posts. (#7768) 2019-10-24 14:00:25 +03:00
Robin Ward 6287eccb35 REFACTOR: Remove `Ember.Controller` in favor of import 2019-10-23 13:06:54 -04:00
Kris 4338515a85 fix poll test 2019-10-16 21:53:37 -04:00
Kris b005377d0a UX: add newline after closing poll tag for poll builder 2019-10-16 21:40:42 -04:00
Gerhard Schlager 3dfe9f3b8d Update translations 2019-10-08 12:25:24 +02:00
Krzysztof Kotlarek 427d54b2b0 DEV: Upgrading Discourse to Zeitwerk (#8098)
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. 

We no longer need to use Rails "require_dependency" anywhere and instead can just use standard 
Ruby patterns to require files.

This is a far reaching change and we expect some followups here.
2019-10-02 14:01:53 +10:00
Gerhard Schlager 8adec48b33 Update translations 2019-09-26 04:29:44 +02:00
Neil Lalonde 930e70aba9 Update translations 2019-09-04 10:24:43 -04:00
romanrizzi 1e89939383 DEV: Added wrapper to signal that NewPostManager#add_plugin_payload_attribute is part of the public API 2019-08-29 11:58:19 -03:00
Gerhard Schlager 8841563f8a Update translations 2019-08-26 14:36:46 +02:00
Sam Saffron 096f932ef2 Lint files
Both needed some prettier tlc
2019-08-16 13:06:51 +10:00
Blake Erickson 69498a58e9
FEATURE: Staff only poll results (#7984)
* FEATURE: Staff only poll results

These changes allow only staff to see the results of a poll.

Non-staff users will be shown a screen like this:

1b8bd76013.png

The "Votes are public" message has been removed from the info section,
and the button to show the votes has been replaced with a message
stating the results will only be shown to staff.

* Update PR based on feedback

* Update plugins/poll/app/models/poll.rb

make sure we return a boolean

Co-Authored-By: Régis Hanol <regis@hanol.fr>
2019-08-15 12:27:18 -06:00
Roman Rizzi 79957706b1
FIX: Store custom attributes that are needed by plugins in queuedpost payload (#8009) 2019-08-14 15:02:59 -03:00
Régis Hanol c628166bb4 FIX: replace model usage with SQL query
Follow-up to b500ef77
2019-08-13 18:32:24 +02:00
Jarek Radosz 6a65e5312b FEATURE: Add a preview to the poll builder (#7988)
* FEATURE: Add a preview to the poll builder

* Use selectKit helper in the poll preview test

* Extract the mobile-specific poll builder form CSS
2019-08-13 09:49:40 -04:00
Eduardo Poleo b500ef77d7 Poll migration is not idempotent (#7964)
The migration script is not idempotent due to database constrains on the
poll related objects, namely:

polls: index_polls_on_post_id_and_name (post_id,name) UNIQUE
poll_options: index_poll_options_on_poll_id_and_digest  (poll_id,digest) UNIQUE
poll_votes:  index_poll_votes_on_poll_id_and_poll_option_id_and_user_id  (poll_id,poll_option_id,user_id) UNIQUE

This change skips a particular poll migration if it's already found on
the db.
2019-08-08 18:48:53 +02:00
Penar Musaraj 78500fb770 UX: Improve layout of poll builder modal 2019-08-07 15:00:03 -04:00
Joffrey JAFFEUX c1d2fb115c
DEV: prevents staff computed property to be overridden (#7931) 2019-07-24 22:01:08 +02:00
Neil Lalonde 97e9599ecc Update translations 2019-07-15 09:43:22 -04:00
Gerhard Schlager a5e80079d6 FEATURE: Add Belarusian language 2019-07-04 11:37:37 +02:00
Neil Lalonde 7e884cce6b Update translations 2019-06-25 10:57:18 -04:00
Neil Lalonde dbc59cfe61 Update translations 2019-06-17 13:25:37 -04:00
Robin Ward a8793d0d9a REFACTOR: Test Memory Usage Fixes (#7769)
* Calling `Discourse.reset()` creates a new container
We should run our de-initializers only after acceptance tests,
since initializers are not run outside of acceptance tests anyway,
and the container at this point can be passed properly to the
`teardown()` method.

* Remove `Discourse.reset` from tests
This would cause a new container to be created which leaks many objects.

* `updateCurrentUser` is more accurate than `replaceCurrentUser`
2019-06-14 14:54:20 +02:00
Robin Ward c322cccd53 FIX: Memory Leaks when decorating posts (#7749)
* Remove long-deprecated method

* FIX: Memory Leaks when decorating posts

Previously we'd keep creating mixins dynamically when decorating the
same class.

This code changes the API to recommend an `id` parameter for each
decorator which will avoid leaks. All plugins should be updated to
include this parameter, although if they don't in the meantime it'll
just mean a warning in the console (and a continued leak.)
2019-06-11 17:21:23 +02:00
Neil Lalonde 5d7e34e0ad Update translations 2019-06-10 10:36:08 -04:00
Joffrey JAFFEUX b339d67401
DEV: refactors select-kit helper to prevent it to leak into global state (#7708) 2019-06-06 10:47:10 +02:00
Guo Xiang Tan 70b73c2159 DEV: Use proper heredoc name. 2019-06-04 16:31:18 +08:00
Bianca Nenciu 63e3d49508 DEV: Add test for poll plugin reduce_excerpt. 2019-06-04 16:30:15 +08:00
Neil Lalonde dbfdce95c9 Update translations 2019-05-30 10:40:16 -04:00
Régis Hanol 0df5349dbf
FIX: ensure the post url is present
Also don't interpolate a string
2019-05-30 00:05:53 +02:00
Régis Hanol a188d15b08
FIX: reduce poll when post is nil 2019-05-30 00:02:33 +02:00
Bianca Nenciu 227c45107d FEATURE: Implement Onebox for posts including polls. (#7539) 2019-05-29 17:05:52 +02:00
Joffrey JAFFEUX b98b994fe7
apply prettier on plugins (#7605) 2019-05-27 11:06:11 +02:00
Joffrey JAFFEUX bfea922167
DEV: global s/this.get\("(\w+)"\)/this.$1 (#7592) 2019-05-27 10:15:39 +02:00
Gerhard Schlager edc6ac0c66 Update translations 2019-05-21 00:04:37 +02:00
Gerhard Schlager 0afcad148a DEV: Always use %{count} in pluralized strings 2019-05-20 23:26:22 +02:00
Gerhard Schlager a58aa9b4bf Update translations 2019-05-20 13:42:05 +02:00
Sam Saffron 3c1fa3910f DEV: track the correct channel in specs
These tests are erratically failing due to distributed cache messages that
can land between tests

Ensure we are only looking for the correct messages
2019-05-20 18:27:09 +10:00
Sam Saffron aeb7143aff DEV: correct flaky poll specs
They were relying on a pristine message bus, however current implementation
still uses redis, stuff can get held up and we can end up publishing
distributed cache messages in the middle invalidating the tests
2019-05-17 16:16:02 +10:00
David Taylor 5605dba85c DEV: Automatically annotate plugin models alongside core models 2019-05-13 16:37:47 +01:00
Guo Xiang Tan 9059a8ca90 Fix the build. 2019-05-13 10:16:26 +08:00
Sam Saffron 30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Guo Xiang Tan 152238b4cf DEV: Prefer `public_send` over `send`. 2019-05-07 09:33:21 +08:00
Joffrey JAFFEUX 1d784c7a18
FEATURE: adds support for dates in polls (#7450) 2019-04-29 10:01:19 +02:00
Joffrey JAFFEUX 0284910125
Update translations 2019-04-24 15:02:04 +02:00
Robin Ward 21b975e71a FIX: Broken plugin spec 2019-04-23 15:29:26 -04:00
Neil Lalonde e7a6f0698d Update translations 2019-04-05 10:02:54 -04:00
Bianca Nenciu 3cf922a58a FIX: URL to user profile in poll results. (#7315) 2019-04-03 22:17:05 +02:00
Robin Ward c44371b4ac FIX: Broken spec 2019-03-28 13:55:04 -04:00
Robin Ward b58867b6e9 FEATURE: New 'Reviewable' model to make reviewable items generic
Includes support for flags, reviewable users and queued posts, with REST API
backwards compatibility.

Co-Authored-By: romanrizzi <romanalejandro@gmail.com>
Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
2019-03-28 12:45:10 -04:00
Neil Lalonde 4a7e83d880 Update translations 2019-03-28 10:07:51 -04:00
Gerhard Schlager d43f4206c7 FEATURE: Add Armenian language 2019-03-28 14:24:14 +01:00
Sam Saffron b5e32cfe2a DEV: correct spec to test for correct fidelity
This is due to 9ebabc1d
2019-03-28 17:45:36 +11:00
Neil Lalonde 9c54447ca7 Update translations 2019-03-11 13:55:45 -04:00
Tim Lange 6420b73c33 FIX: Changed poll age message to upcase (#7124) 2019-03-07 11:04:17 +01:00
Kris be5e889b1b UX: Poll style fix, button classes 2019-03-06 20:27:40 -05:00
Neil Lalonde aabc3375c6 Update translations 2019-03-01 11:28:07 -05:00
Régis Hanol 6b006c383b FIX: polls acceptance tests 2019-02-27 19:16:24 +01:00
Régis Hanol 0a708ba064 FIX: preload poll voters 2019-02-27 17:00:21 +01:00
Joffrey JAFFEUX 5952a6c0ad
DEV: uses find() helper instead of this.$() in js tests (#7062) 2019-02-25 16:04:55 +01:00
Sam 79841cf7dd FEATURE: add missing autocomplete suppressions
Following 1f4ace4f add a couple more autocomplete suppressions (in polls
and invite ui)
2019-02-21 16:37:26 +11:00
Neil Lalonde 55cc5ab4b8 Update translations 2019-02-07 09:49:57 -05:00
Joe a342d2f150 UX: reduces white-space in polls (#6956)
* reduces white-space in polls and uses font-size variables
2019-02-05 10:47:22 +01:00
Régis Hanol f7b7bc8abe DEV: move 'default_scope' to default sort on 'has_many' relation 2019-01-30 17:45:50 +01:00
Régis Hanol 671ff4243f
FIX: discourse-poll-option test wasn't working 2019-01-24 14:55:36 +01:00
Régis Hanol cba6bdaf52 UX: use solid circle to indicate selected option in polls 2019-01-24 12:25:37 +01:00
Bianca Nenciu d589c66f3e FIX: Fix URL to user profile. (#6881) 2019-01-23 18:27:21 +01:00
Joffrey JAFFEUX 80d42b4ea2
icons deprecations fixes (#6920) 2019-01-22 12:02:02 +01:00
Gerhard Schlager 90823eaca6 Update translations 2019-01-19 23:41:52 +01:00
Joffrey JAFFEUX 502b1316d0
DEV: s/this._super()/this._super(...arguments) (#6908) 2019-01-19 10:05:51 +01:00
Neil Lalonde 81953339f2 Update translations 2019-01-14 12:23:49 -05:00
Joffrey JAFFEUX 1a3655b787
DEV: s/Em/Ember (#6874) 2019-01-11 17:54:23 +01:00
Joffrey JAFFEUX f9648de897
DEV: upgrades from Ember 2.13 to Ember 3.5.1 (#6808)
Co-Authored-By: Bianca Nenciu <nbianca@users.noreply.github.com>
Co-Authored-By: David Taylor <david@taylorhq.com>
2019-01-10 11:06:01 +01:00
Neil Lalonde d7656f30c3 Update translations 2019-01-02 12:32:38 -05:00
Régis Hanol b478984f60 make eslint happy 2018-12-31 12:38:45 +01:00
Bianca Nenciu e49bcebb35 FIX: Validate poll arguments. (#6740)
* FIX: Validate number poll.
* FEATURE: Poll's min can be 0.
* FIX: Fix URL to user profile.
2018-12-31 10:48:30 +01:00
Bianca Nenciu c928386c3e FIX: Copy old status to new poll. (#6788) 2018-12-19 11:29:13 +01:00
Bianca Nenciu 5bda4d26b4 FIX: Rescue errors in job. (#6745) 2018-12-17 15:28:57 +01:00
Neil Lalonde 124ae46763 Update translations 2018-12-14 10:34:12 -05:00
Guo Xiang Tan 71ce9ced47 FIX: Incorrect arguments were being passed to `Jobs::ClosePoll`.
Also fix spec that wasn't testing anything.
2018-12-13 16:46:00 +08:00
Bianca Nenciu 285ff3bfbd FIX: Show every voter only once. (#6746)
Each voter is represented by an object and Set does not properly check for equality.
2018-12-11 14:00:28 +01:00
Guo Xiang Tan dcf9c6da59 DEV: Don't publish post messages to non-human users. 2018-12-06 08:24:13 +08:00
Régis Hanol aea2d8bbeb FIX: properly secure poll message bus
Co-authored-by: Sam <sam.saffron@gmail.com>
2018-12-05 21:27:49 +01:00
Régis Hanol f1050350ed FIX: clamp integers to prevent 'PG::NumericValueOutOfRange' errors 2018-12-04 22:51:56 +01:00
Régis Hanol 3c9c95ac83 Update Rubocop to 0.60 2018-12-04 10:48:16 +01:00
Neil Lalonde d43d007929 Update translations 2018-11-29 10:51:16 -05:00
Penar Musaraj 03deda2147
Upgrade to FontAwesome 5 (take two) (#6673)
* Add missing icons to set

* Revert FA5 revert

 This reverts commit 42572ff

* use new SVG syntax in locales

* Noscript page changes (remove login button, center "powered by" footer text)

* Cast wider net for SVG icons in settings

- include any _icon setting for SVG registry (offers better support for plugin settings)

- let themes store multiple pipe-delimited icons in a setting

- also replaces broken onebox image icon with SVG reference in cooked post processor

* interpolate icons in locales

* Fix composer whisper icon alignment

* Add support for stacked icons

* SECURITY: enforce hostname to match discourse hostname

This ensures that the hostname rails uses for various helpers always matches
the Discourse hostname

* load SVG sprite with pre-initializers

* FIX: enable caching on SVG sprites

* PERF: use JSONP for SVG sprites so they are served from CDN

This avoids needing to deal with CORS for loading of the SVG

Note, added the svg- prefix to the filename so we can quickly tell in
dev tools what the file is

* Add missing SVG sprite JSONP script to CSP

* Upgrade to FA 5.5.0

* Add support for all FA4.7 icons

- adds complete frontend and backend for renamed FA4.7 icons

- improves performance of SvgSprite.bundle and SvgSprite.all_icons

* Fix group avatar flair preview

- adds an endpoint at /svg-sprites/search/:keyword

- adds frontend ajax call that pulls icon in avatar flair preview even when it is not in subset

* Remove FA 4.7 font files
2018-11-26 16:49:57 -05:00
Régis Hanol ed400a90fe
FIX: properly migrate polls/votes stored as array 2018-11-24 17:14:03 +01:00
Régis Hanol 5142911012 FIX: auto-closing poll wasn't working 2018-11-23 17:42:57 +01:00
Régis Hanol f402d0d74f FIX: couldn't delete users who voted on a poll 2018-11-23 11:45:53 +01:00
Régis Hanol 606faa2ee5 FIX: ensure poll options keep their order 2018-11-23 10:37:05 +01:00
Guo Xiang Tan 439b3fe10a Fix `MigratePollsData` failing when poll-votes have duplicated options. 2018-11-21 10:52:21 +08:00
Régis Hanol 92100f82eb FIX: properly disable serializable attributes when poll plugin is disabled 2018-11-20 17:28:41 +01:00
Joffrey JAFFEUX 95d8a421be
fixes linting 2018-11-19 16:29:15 +01:00
Régis Hanol 4459665dee
REFACTOR: use tables instead of custom fields for polls (#6359)
Co-authored-by: Guo Xiang Tan <tgx_world@hotmail.com>
2018-11-19 14:50:00 +01:00
Joe 9c5b5243fc
UX: don't show 0 vote count in crawler or print view 2018-11-15 17:40:01 +08:00
Sam 42572ff138 Revert font awesome 5 changes
We are still pushing ahead on this 100% just need a bit longer to prepare
all plugins
2018-11-08 16:12:18 +11:00
Penar Musaraj 005e1ecb9b
FEATURE: Update Font Awesome to v5.4.1 and SVGs (#6557)
* First take on subsetting svg icons

* FontAwesome 5 svg subset WIP

* Include icons from plugins/badges into svg sprite subset

* add svg icon support to themes

* Add spec for SvgSprite

* Misc. SVG icon fixes

* Use FA5 svgs in local-dates plugin

* CSS adjustments, fix SVG icons in group flair

* Use SVG icons in poll plugin

* Add SVG icons to /wizard
2018-11-07 13:05:43 -05:00
David Taylor d963f96fa4 Update translations 2018-11-05 11:16:58 +00:00
Sam 29fdb50338 FIX: if poll has not options do not break serializer
Note: we have a proper rewrite of this plugin in progress
it will address this issue in a proper way
2018-10-24 10:04:17 +11:00
Guo Xiang Tan a4aa4a9be4 DEV: Remove the use of mocks in our tests. 2018-10-15 10:38:02 +08:00
Neil Lalonde af39624d19 Update translations 2018-10-12 10:40:25 -04:00
Penar Musaraj 753d39f30d Fix NoMethodError in polls#voters 2018-10-09 12:51:49 -04:00
Gerhard Schlager b0a383561e FEATURE: Add Lithuanian locale 2018-09-27 05:26:38 +02:00
Neil Lalonde a147a856f8 Update translations 2018-09-14 11:43:14 -04:00
Neil Lalonde 5a4d6f9656 Update translations 2018-08-30 09:40:31 -04:00
Kris 6ec43f3472 FIX: poll avatar spacing too large 2018-08-29 09:11:03 -04:00
Kris d6144c6d60 UX: More compact polls on mobile 2018-08-27 16:53:35 -04:00
Neil Lalonde 6d79be29f2 Update translations 2018-08-21 11:28:13 -04:00
Neil Lalonde 0cf98f1ad9 Revert "Update translations" 2018-08-21 11:17:53 -04:00
Neil Lalonde 3c6d5c8241 Update translations 2018-08-21 10:36:59 -04:00
Sam a71fe16647 workaround, we need another lazy operator here
Data can be pretty inconsistent here till our big refactor is done
2018-08-20 10:37:06 +10:00
Sam eacb2593ee workaround badly denormalized data in polls 2018-08-17 11:15:29 +10:00
Joffrey JAFFEUX 10a3499d68
uses emoji versions for specs (#6276) 2018-08-16 13:45:30 +02:00
Peter Borsa a6820d8767 Add Hungarian locale (#6260) 2018-08-13 01:02:35 +02:00
Neil Lalonde 5c248e3a7a Update translations 2018-08-07 12:05:45 -04:00
Kris 84d822959a Reducing some specificity, color fix 2018-08-03 17:44:22 -04:00
Maja Komel 04baddf731 DEV: migrate tests to async/await 2018-07-30 12:21:05 +02:00
Neil Lalonde 58ecc84d61 Update translations, excluding Japanese and config/locales/client.zh_TW.yml due to errors 2018-07-26 13:01:39 -04:00
Gerhard Schlager d3e04daa95 Add Swahili language 2018-07-16 18:11:38 +02:00
Joe 27c018e75c
FIX: makes large images in polls responsive 2018-07-01 13:20:00 +08:00
Neil Lalonde 6e54af1091 FIX: error if decorateCooked is called without a helper for a post with a poll 2018-06-18 12:35:19 -04:00
Joffrey JAFFEUX 60ff0e9b8c
missing prettified files 2018-06-15 18:42:20 +02:00
Régis Hanol 5d445fb810 FIX: properly handle invalid auto close date for polls 2018-06-12 15:31:09 +02:00
Neil Lalonde 79854198c1 Update translations 2018-06-08 10:27:53 -04:00
Joffrey JAFFEUX 174d392e5a
DEV: adds prettier (#5956)
Run `prettier --write "app/assets/stylesheets/**/*.scss" "plugins/**/*.scss"` after making sure you installed it with `yarn`

It's recommended to configure your editor to run prettier on file save.
2018-06-08 11:49:31 +02:00
Guo Xiang Tan 3a8f69c3d2 DEV: Assert for 200 response code to avoid changing magic helper in the future. 2018-06-07 16:11:09 +08:00
Sam e806e6e96f correct specs 2018-06-07 16:13:15 +10:00
Régis Hanol f05ca02f13 FIX: unable to add new poll to post with a public poll 2018-06-05 15:49:21 +02:00
Neil Lalonde dee9af2877 Update translations 2018-05-31 17:03:38 -04:00
Joe 733ffc4bbf
FIX: add classes to input groups and move tips 2018-05-30 21:02:06 +08:00
Joe ec7f597274
FIX: update poll-builder to new modal design 2018-05-30 21:00:54 +08:00
Joe 47a9b3427b
FIX: input tip causes modal to change width when present 2018-05-30 14:26:06 +08:00
Guo Xiang Tan c1fb111951 FIX: Show poll options when user is in a PM with a bot.
https://meta.discourse.org/t/discobot-dont-take-users-through-the-poll-tutorial-if-its-not-enabled/76604/9
2018-05-30 11:16:20 +08:00
Gerhard Schlager b7bf0e96aa Update translations 2018-05-29 22:01:57 +02:00
Gerhard Schlager 864ada835b FEATURE: Add Bulgarian language 2018-05-29 21:07:17 +02:00
Gerhard Schlager 01b0d9d235 Update translations 2018-05-17 00:08:33 +02:00
Jeff Wong 19605e8b0b Feature: Hide plugins that ship with core from plugins panel 2018-05-15 15:50:17 -07:00
Régis Hanol ef87944a34 UX: show close date on automatically closed polls 2018-05-12 02:14:58 +02:00
Guo Xiang Tan 8cf0f51eb2 UX: Display site settings shortcut for `poll` and `discourse-nginx-performance-report`.
https://meta.discourse.org/t/improving-admin-plugins/84585/29?u=tgxworld
2018-05-08 10:34:32 +08:00
Régis Hanol 94163d7f1a add spec for auto-close polls 2018-05-07 11:31:20 +02:00
Guo Xiang Tan 0d74c30fa7 Remove more uses of `rescue nil`. 2018-05-07 11:38:23 +08:00
Gerhard Schlager 7bf01fd769 Update translations 2018-05-04 10:58:21 +02:00
Neil Lalonde 69a3ba0014 Update translations 2018-05-03 15:23:31 -04:00
Jeff Atwood 50a2508604
minor copyedit 2018-05-03 02:31:18 -07:00
Régis Hanol 9ff2d540ba fix the build 2018-05-03 10:32:01 +02:00
Régis Hanol ba14c80b9c FEATURE: automatically close a poll on a given date and time 2018-05-03 02:12:19 +02:00
Neil Lalonde 8babf1c1e1 Update translations 2018-04-24 11:08:45 -04:00
Neil Lalonde a631c8f09d Update translations 2018-04-13 10:32:39 -04:00
Guo Xiang Tan 4319273cf5 UX: Split up group form into smaller sections. 2018-04-09 15:14:50 +08:00
Gerhard Schlager 4c53e81c69 Update translations 2018-04-06 14:51:09 +02:00
Gerhard Schlager 37fa843efc Allow pulling of Urdu translations from Transifex again
The translations have been fixed.
2018-03-27 11:56:40 +02:00