Commit Graph

29 Commits

Author SHA1 Message Date
Sam Saffron b5e32cfe2a DEV: correct spec to test for correct fidelity
This is due to 9ebabc1d
2019-03-28 17:45:36 +11: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
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
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
Régis Hanol 94163d7f1a add spec for auto-close polls 2018-05-07 11:31:20 +02:00
Joffrey JAFFEUX 316d814130
FIX: staff should always be allowed to create polls if they are enabled 2017-12-05 00:03:56 +01:00
Joffrey JAFFEUX 76bc173d47
FEATURE: adds poll_allow_staff_to_create
This setting will bypass poll_minimum_trust_level_to_create if set to true
2017-12-04 18:12:17 +01:00
Joffrey JAFFEUX 63bab32816 FEATURE: introduces minimum trust level for polls (#5391)
* FEATURE: introduces minimum trust level for polls

This commit makes `poll_enabled` less misleading and introduces `poll_minimum_trust_level_to_create`. If poll are enabled they will always be cooked, and if you have the required trust level you can create polls. As a side effect, it also fixes a bug where rebaking a post created by staff member when `poll_enabled=false` would end up not cooking it.

It also adds more tests to ensure settings are respected.

* admins should be whitelisted

* checks for admin in post validation

* test for >= instead of == trust level
2017-12-04 14:47:11 +01:00
Guo Xiang Tan 77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Sam Saffron 045a2abcec FEATURE: remove the timecop gem
We should only have one way of mocking time, misuse of timecop
was causing build stability issues
2017-07-24 12:11:10 -04:00
Sam 93e5112dfa correct poll specs 2017-07-18 14:31:22 -04:00
Guo Xiang Tan 8213da20f2 Extract polls edit window to a site settings. 2016-08-10 15:17:16 +08:00
Guo Xiang Tan ffbfcd7ee2 Fix build. 2016-07-29 14:47:23 +08:00
Gerhard Schlager f1bc7de541
Adds support for anonymous votes to the poll plugin 2016-04-23 22:44:09 +02:00
Andy Waite 3e50313fdc Prepare for separation of RSpec helper files
Since rspec-rails 3, the default installation creates two helper files:
* `spec_helper.rb`
* `rails_helper.rb`

`spec_helper.rb` is intended as a way of running specs that do not
require Rails, whereas `rails_helper.rb` loads Rails (as Discourse's
current `spec_helper.rb` does).

For more information:

https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#default-helper-files

In this commit, I've simply replaced all instances of `spec_helper` with
`rails_helper`, and renamed the original `spec_helper.rb`.

This brings the Discourse project closer to the standard usage of RSpec
in a Rails app.

At present, every spec relies on loading Rails, but there are likely
many that don't need to. In a future pull request, I hope to introduce a
separate, minimal `spec_helper.rb` which can be used in tests which
don't rely on Rails.
2015-12-01 20:39:42 +00:00
Gerhard Schlager bb52042b46 FIX: Add missing pluralization keys to poll plugin locale 2015-09-27 21:36:57 +02:00
Régis Hanol 2e76c9165a FIX: polls are always editable until the first vote 2015-09-25 18:54:15 +02:00
Régis Hanol 60bbd81607 FIX: polls with votes were preventing users from updating the post 2015-09-14 19:27:54 +02:00
Sam d16de4a0a1 correct polls spec 2015-08-05 12:39:38 +10:00
Régis Hanol f736b6face FIX: validate poll parameters when type=multiple 2015-06-01 19:28:05 +02:00
Régis Hanol 7c545537a6 FIX: prevent pollception 2015-05-13 23:12:53 +02:00
Régis Hanol b8005f0b1b FIX: link starting with '[poll' should not break polls 2015-05-13 17:50:25 +02:00
Régis Hanol 3a9907f392 FIX: prevent self-xss in poll attributes 2015-05-11 20:09:17 +02:00
Régis Hanol c1bb7bc7cc clarify copy when editing a poll after the first 5 minutes 2015-05-07 17:24:35 +02:00
Régis Hanol 9b0ca60f52 FIX: support quotes for poll parameters 2015-05-07 16:40:14 +02:00
Régis Hanol 033761d2f6 FIX: reset all votes when the # of options changes 2015-05-06 18:52:09 +02:00
Régis Hanol 2954c99a1e FEATURE: new 'poll_maximum_options' site setting to limit the number of options in a poll 2015-05-01 16:44:51 +02:00
Régis Hanol a737090442 - FEATURE: revamped poll plugin
- add User.staff scope
- inject MessageBus into Ember views (so it can be used by the poll plugin)
- REFACTOR: use more accurate is_first_post? method instead of post_number == 1
- FEATURE: add support for JSON-typed custom fields
- FEATURE: allow plugins to add validation
- FEATURE: add post_custom_fields to PostSerializer
- FEATURE: allow plugins to whitelist post_custom_fields
- FIX: don't bump when post did not save successfully
- FEATURE: polls are supported in any post
- FEATURE: allow for multiple polls in the same post
- FEATURE: multiple choice polls
- FEATURE: rating polls
- FEATURE: new dialect allowing users to preview polls in the composer
2015-04-23 19:33:29 +02:00