Commit Graph

68 Commits

Author SHA1 Message Date
Dan Ungureanu 639dce7a8b
FIX: Move archived votes when merging topics (#50) 2020-05-26 13:10:13 +03:00
Krzysztof Kotlarek c90fbe6fab FIX: include all reloadable parts of the plugin (#48)
Currently, if you got that plugin installed and change code in development in Discourse, you will see an error like:
`undefined method `can_vote?'`

A reason for that was incorrectly defined `reloadable_patch` block. That block defines everything which should be reloaded by ActiveSupport::Reloader if code is changed.

because that was not included in that block
```
class ::Category
  def self.can_vote?(category_id)
  end
end
```
method `can_vote?` was not anymore available.
2019-12-12 13:42:23 +11:00
Dan Ungureanu 2a3ca6f870
FEATURE: Let user know how many votes were moved. (#42)
Merging two votes with topics will edit the moderator post describing
the move operation, to include information about how many votes were
moved and why some votes were not (because user already voted for the
destination topic).
2019-10-08 12:35:20 +03:00
Mark VanLandingham 429dc1e532 FIX: user vote count is updated when topics are trashed/restored (#46)
* FIX: user vote count updates properly for trashed/recovered topics

* fixed weird tab sizing

* removed unused spec variable

* VoteRelease job queries deleted topics as well

* use Jobs.run_immediately!
2019-10-03 17:53:29 +10:00
Krzysztof Kotlarek 6bb3d188e5 FIX: Use top-level namespace for base classes (#45) 2019-10-02 14:30:27 +10:00
Sam Saffron d09feb47a0 FIX: keep plugin compatible with older discourse versions
Per: bd5fa173 in Discourse there is no longer need re-register serializers
in all descendants. This change was backported so this change to discourse
voting is safe.
2019-08-27 18:26:14 +10:00
Dan Ungureanu 7e6f27b198 FIX: Add can_vote attribute to all category serializers. (#43) 2019-08-22 14:50:20 +02:00
Joffrey JAFFEUX 020ed3cd6d FIX: wraps overrides in reloadable_patch 2019-08-22 14:31:03 +02:00
Sam Saffron 9b4f233b9d PERF: avoid N+1 on category load
`after_find` is a very risky callback cause it can impact how read perf
works. In this case it was loading a custom field on category which
triggered an N+1 on a fresh load of a site.

This amends it so we do the repair before save
2019-08-19 16:24:16 +10:00
David Taylor fd5c6d91f9 FIX: Reclaim votes when voting is disabled on a category 2019-07-18 16:53:03 +01:00
David Taylor 9e61d300b9 DEV: Define category_custom_field as boolean
This removes the need for casting to true/false strings on the client
2019-07-18 15:56:35 +01:00
Tomas Varaneckas 0cf0ed0edd FIX: ensure compatibility with older Discourse (#39)
Thank you!
2019-05-14 17:30:04 +08:00
Guo Xiang Tan 14b6603150 Add frozen string literal comment to files. 2019-05-13 11:11:19 +08:00
David Taylor fe264dc16c FIX: Do not transfer votes unless the entire topic is merged
We have logic to transfer votes if an entire topic is merged into another. However, we do not want this to trigger if only a few posts are moved.
2019-03-04 14:31:04 +00:00
Vinoth Kannan 3d53b86986 DEV: Use save_custom_fields method instead of save in topic object 2018-11-20 01:31:55 +05:30
Joshua Rosenfeld 7235aa12a4
forgot a letter in the url 2018-10-12 17:14:56 -04:00
Joshua Rosenfeld 7beb0d9e2c
Update url 2018-10-12 15:47:32 -04:00
Sam 25c5f2d5ea FIX: improve reconciliation of votes job
Also cleans up all custom field usage and tests

Adds a few missing tests
2018-09-21 11:49:41 +10:00
OsamaSayegh 5bcdfaa47b FIX: release/relcaim votes when topic is closed, clear duplicate and null votes 2018-09-06 16:27:08 +03:00
Arpit Jalan 45c4c3b583 FIX: update vote counts only if voters are visible 2018-08-29 22:19:20 +05:30
Osama Sayegh 070781149a FIX: release/reclaim votes on moving topics to different category (#34)
* FIX: release/reclaim votes on moving topics to different category

* test jobs

* don't enqueue job if there are no votes
2018-08-15 17:53:54 +10:00
Jeff Wong 85f39aff81 FIX: only count votes when we have an array of votes 2018-08-09 12:02:04 -07:00
Yaw Anokwa a6b0e9753a FIX: Do not count nil or blank values as votes (#33) 2018-08-08 13:16:47 +10:00
Jeff Wong 67c847fc5a FIX: do not count nil values as votes 2018-08-06 11:27:10 -07:00
Dan Ungureanu d176ba458e FIX: Move votes to destination topic when two topics are merged. (#30) 2018-07-31 12:29:57 +10:00
Sam 34485a8dc8 FIX: workaround vote count being an array 2018-05-18 12:07:44 +10:00
Michael Brown 8e7f775f1b FIX: USERNAME_ROUTE_FORMAT is now RouteFormat.username 2017-12-21 17:32:31 -05:00
Guo Xiang Tan 604a03639b UX: Target area for vote button too small on mobile. 2017-06-14 10:53:44 +09:00
Sam b96dd07033 FEATURE: add alert when less than 10 votes left 2017-03-08 12:44:30 -05:00
Sam 5112e2bc18 Remove voting for category description 2017-03-06 17:07:03 -05:00
Sam 006dcb85b0 Rename feature voting to voting 2017-03-06 15:38:26 -05:00
Sam bddea3ce7c FEATURE: add votes tab for on "votable" categories 2017-03-06 15:00:56 -05:00
Sam 619737d209 FEATURE: remove "liking" on OP for topics with voting 2017-03-03 16:58:07 -05:00
Sam f223380910 Refactor plugin, introduce limits, remove supervotes
- Secure the vote / unvote paths
- Improve perf, only ask for voters on click
- Remove all concept of supervotes
- Limit voting to a much saner and smaller number
- Improve rendering
2017-03-02 17:11:02 -05:00
Sam 20be727c7f FEATURE: New API for tag extension
PERF: stop querying category custom fields when rendering home page
FIX: listing votes instead of supervotes
2017-03-01 13:15:22 -05:00
Joe Buhlig 135eaf8a5e Clean up N+1 queries 2016-10-20 09:44:37 -05:00
DiscourseHosting 6aa17eff0c Fix supervotes-left calculation 2016-08-15 20:59:58 +00:00
Joe Buhlig 5d9e7c0112 Added Votes filter for sorting 2016-08-12 11:25:58 -05:00
Guo Xiang Tan 4a169ddfdf Pass user object instead of id.
fixes https://github.com/joebuhlig/discourse-feature-voting/issues/10
2016-06-02 16:44:40 +08:00
Guo Xiang Tan 2ea70e3e26 Remove unnecessary code. 2016-06-02 16:09:46 +08:00
Joe Buhlig 8971211f59 Validate user id exists and log in prompt 2016-05-09 07:04:29 -05:00
Joe Buhlig 533f6c06d3 Catch if no user id 2016-05-07 05:43:13 -05:00
Joe Buhlig 8a0322c6c0 Remove voting indicator on topic list 2016-05-06 10:49:16 -05:00
Joe Buhlig 92b4634c10 Changed method of getting user id 2016-04-29 16:18:04 -05:00
Joe Buhlig 4b5bfb2d58 Scale vote limits with trust levels 2016-04-27 15:41:07 -05:00
Joe Buhlig 630dd75d19 Added setting to hide vote activity 2016-04-26 15:52:35 -05:00
Joe Buhlig d5bb113a1d Added descriptions to voting options 2016-04-26 15:38:16 -05:00
Joe Buhlig f12cef632f Added super vote counts and who super voted 2016-04-25 17:07:51 -05:00
Joe Buhlig ea04eb678a User states carried 2016-04-25 15:06:01 -05:00
Joe Buhlig 3030c47fbb Functional super voting 2016-04-15 16:01:05 -05:00