Commit Graph

133 Commits

Author SHA1 Message Date
Bianca Nenciu c928386c3e FIX: Copy old status to new poll. (#6788) 2018-12-19 11:29:13 +01: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
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 3c9c95ac83 Update Rubocop to 0.60 2018-12-04 10:48:16 +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
Guo Xiang Tan 439b3fe10a Fix `MigratePollsData` failing when poll-votes have duplicated options. 2018-11-21 10:52:21 +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 a4aa4a9be4 DEV: Remove the use of mocks in our tests. 2018-10-15 10:38:02 +08: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
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 94163d7f1a add spec for auto-close polls 2018-05-07 11:31:20 +02:00
Régis Hanol 9ff2d540ba fix the build 2018-05-03 10:32:01 +02:00
Guo Xiang Tan 51657d3426 Allow polls to be added/renamed/removed as long as user can edit posts. 2018-03-14 11:00:57 +08:00
Guo Xiang Tan b77553a635 FIX: Staff should be able to updates polls when edit window expires.
https://meta.discourse.org/t/moderators-cannot-remove-polls-from-posts/81804/7?u=tgxworld
2018-03-08 16:45:06 +08:00
Gerhard Schlager 7a2183e8ab FEATURE: rake task for merging users 2018-03-01 12:28:12 +01:00
Régis Hanol dee35b72f2 FIX: must be able to post in a topic in order to vote on a poll 2018-02-27 00:19:44 +01:00
Sam 94b2c70c0d PERF: remove oga gem
oga gem is automatically required by the aws gem
the oga gem retains about 1mb of memory, aws now uses nokogiri

This also removes the html normalize from the pretty text specs that was
a fair bit buggy as the polls test shows.
2018-02-15 14:36:40 +11:00
Sam 7e3543d96f correct plugin specs 2018-01-12 14:42:05 +11: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 1e0bfa1d97
FIX: poll new_post_manager spec 2017-12-04 16:12:40 +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
Sam 43c0111ca1 FIX: multichoice poll with more than 25 votes
In the past we would double up on avatars due to incorrect logic for
handling offset
2017-08-14 15:33:59 -04:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Sam 8317fb12e0 FIX: don't escape html of poll options 2017-07-25 13:38:19 -04: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 b7f58fe880 regression polls could not be closed properly 2017-07-18 14:52:58 -04:00
Sam 93e5112dfa correct poll specs 2017-07-18 14:31:22 -04:00
Sam 1661a8745b correct issues with poll specs
fixes regression where an error message is missing from a poll
with one option
2017-07-17 17:44:48 -04:00
Guo Xiang Tan e80a1dfa43 FIX: Post with multiple polls containing votes can not be edited.
https://meta.discourse.org/t/500-internal-server-error-when-editing-specific-poll-in-a-post-with-votes-editing-other-polls-works-fine/59684
2017-07-14 12:33:22 +09:00
Sam 5d139e461c FIX: multi option poll not working (new engine) 2017-07-11 14:43:34 -04:00
Sam 6200d7d6ab correct bug where only a single poll per topic worked 2017-06-28 15:36:19 -04:00
Guo Xiang Tan a10689de94 Fix broken specs due to new default emoji set. 2017-06-27 10:13:21 +09:00
Sam 234694b50f Feature: CommonMark support
This adds the markdown.it engine to Discourse.
https://github.com/markdown-it/markdown-it

As the migration is going to take a while the new engine is default
disabled. To enable it you must change the hidden site setting:
enable_experimental_markdown_it.

This commit is a squash of many other commits, it also includes some
improvements to autospec (ability to run plugins), and a dev dependency
on the og gem for html normalization.
2017-06-23 12:01:33 -04:00
Guo Xiang Tan 112ca20c96 Merge pull request #4675 from tgxworld/fix_polls_forever_broken_if_approval_required
FIX: Polls permanently broken if post requires approval.
2017-03-01 12:56:03 +08:00
Guo Xiang Tan 8bd8f07ce0 FIX: Public polls should not make a request per option. 2017-01-31 17:27:43 +08:00
Guo Xiang Tan bed11dfa0e FIX: Polls permanently broken if post requires approval. 2017-01-26 13:29:43 +08:00
Guo Xiang Tan 8c4dfdfa40 FIX: Votes lost when editing a poll option with votes. 2017-01-16 22:51:57 +08: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
Guo Xiang Tan a36203ff78
PERF: Paginate public polls. 2016-06-12 16:14:53 +08:00
Guo Xiang Tan f53494f102 FIX: Polls with votes cannot be made public. 2016-06-09 12:10:27 +08:00
Guo Xiang Tan 8ecde35df3
FEATURE: Add public type to polls. 2016-06-08 16:19:13 +08:00
Guo Xiang Tan 2f14a81fa4
FIX: `min` setting should be greater than 0 for multiple type polls. 2016-06-07 10:48:06 +08:00
Guo Xiang Tan a849fae5ee Add specs for polls (#4246)
* Extract validation logic into a service object.

* Extract logic for updating polls custom fields into a service object.

* Use `strip_heredoc` instead.

* FIX: Polls do not update when configuration has been changed.
2016-06-06 17:04:56 +02:00
Gerhard Schlager f1bc7de541
Adds support for anonymous votes to the poll plugin 2016-04-23 22:44:09 +02:00
Régis Hanol b575f97ece FIX: allows polls on closed topics 2016-03-21 12:12:25 +01: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 c240a8bd80 FIX: make sure we can't vote on deleted polls 2015-06-01 22:31:47 +02: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 86d7412f30 REFACTOR: rename "total_votes" poll field to the more accurate "voters"
FEATURE: automagically load plugin's migrations
2015-05-04 16:01:57 +02:00
Sam 803feefd54 MessageBus handles readonly redis now, no need to wrap it 2015-05-04 12:21:00 +10: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 f83638c154 FIX: check the selected options when casting a vote 2015-05-01 16:33:24 +02:00
Robin Ward 5b3f99aa50 Don't blow up if Redis switches to READONLY 2015-04-24 14:37:16 -04: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
Godfrey Chan 5352a7f53c Don't `use_route`
See https://github.com/rails/rails/pull/17453 and https://github.com/rails/rails/pull/17725
2014-11-30 21:25:54 -08:00
Régis Hanol 57f7b92bb4 fix poll plugin specs deprecations 2014-09-25 18:12:28 +02:00
Régis Hanol de76b512c1 fix most deprecations in the specs (still some left) 2014-09-25 17:44:48 +02:00
Vikhyat Korrapati 5de7d889fd Add close/open poll buttons to poll UI. 2014-04-12 22:53:21 +05:30
Vikhyat Korrapati 2928ce6ca1 Remove the colon from the poll prefix, drop regex support.
This is needed to make it possible to programmatically toggle between
open and closed polls.
2014-04-11 08:41:37 +05:30
Sam 93d79080bb BUGFIX: broken specs after pulling in closed poll stuff 2014-04-09 12:38:21 +10:00
Vikhyat Korrapati ff43aac603 Live update poll votes. 2014-03-24 09:40:09 +05:30
Vikhyat Korrapati 9ef104bbce Poll Plugin: Don't allow voting on closed topics. 2014-03-16 19:21:17 +05:30
Vikhyat Korrapati ae3f135c33 Poll Plugin: Allow staff to edit options. 2014-03-16 19:21:17 +05:30
Vikhyat Korrapati 0950dde8d0 Add a test to make sure the poll prefix translation can be a regex. 2014-03-11 16:54:12 +05:30
Vikhyat Korrapati 33cb4bc5ac Fallback to using the first list if [poll] isn't present. 2014-02-20 13:46:27 +05:30
Vikhyat Korrapati 74ab14de19 Add poll plugin. 2014-02-13 07:39:01 +05:30