Commit Graph

246 Commits

Author SHA1 Message Date
Justin DiRose c82d5a6645
FIX: Stop trying to merge duplicate votes (#56)
Was able to reproduce a bug where votes were not properly moved when merging two topics together. We were only checking duplicate votes if either both votes were either active or archived, and not a mix of the two. As a result, there were cases where the plugin was trying to move votes that already existed on an open topic, causing the merge to partially fail with a duplicate index error.

What this commit does is as follows:

- Cleaned up the logic so it's more readable. Previously it was duplicative and difficult to read.
- We're now checking if a user has a vote on Topic A (active or archived) and Topic B (active or archived) that we're properly deleting the origin vote and keeping the destination vote instead of trying to merge in a duplicate. (This caused the original bug described above).
- Per the specs on meta, topic merges move all votes to the destination topic, and if this causes a user to go over the limit, they'll have to wait until enough votes are released.
- If the destination topic is closed, the votes will be archived; if the destination topic is open, those votes will be active. This is regardless of origin vote state.

Also, the Gemfile was missing a source declaration to allow installation of gems/dependencies, so I've added that.
2020-09-17 11:02:19 -05:00
Discourse Translator Bot 5e69dbfd5b Update translations 2020-09-16 10:22:04 +00:00
Discourse Translator Bot 32989b7d3a Update translations 2020-09-15 13:08:02 +00:00
Krzysztof Kotlarek b564224c0a
FIX: the ability to remove the vote (#55)
Problem was that we are adding `hidden` class to popup and jQuery `toggle()` function is not handling that properly. Therefore I decided to use `toggleClass` in that case and it works pretty well.

The bug was mentioned here - https://meta.discourse.org/t/voting-plugin/157676/8
2020-09-15 16:21:18 +10:00
David Taylor 835b3580b7
FIX: Skip migrating null/blank custom field values in migrations 2020-09-09 17:00:56 +01:00
Discourse Translator Bot 2bd2600476 Update translations 2020-09-09 15:00:39 +00:00
Joffrey JAFFEUX 0a1464a84a
DEV: apply coding standards (#54) 2020-09-04 13:20:28 +02:00
Discourse Translator Bot 2db19138b4 Update translations 2020-08-25 13:04:04 +00:00
Kris b33f004d9b UX: Structure the list-vote-count like tags and assigns 2020-08-19 00:05:03 -04:00
Discourse Translator Bot fd94a53ae3 Update translations 2020-08-18 13:04:42 +00:00
Krzysztof Kotlarek 18794557db
FIX: backwards compatibility with stable discourse 2.5.0 (#53)
Few if statements to ensure plugin works with a stable discourse. Completely obsolete once 2.6.0 will become stable
2020-08-18 10:26:10 +10:00
Régis Hanol 8de0fa9ecf DEV: ensure compatibilty with stable 2020-08-17 16:21:16 +02:00
David Taylor 142b3db6b8
FIX: Skip duplicate data when migrating from custom fields 2020-08-17 12:57:55 +01:00
Régis Hanol 15949af1b9 FIX: suggested topics had their topic_ids set to a post_id
The fix is pretty simple

    result = result.select("*, ... AS current_user_voted")

become

    result = result.select("topics.*, ... AS current_user_voted")

I also merged all 3 'TopicQuery.results_filter_callbacks' into one and did
some slight refactoring on the 'add_to_serializer'.
2020-08-17 11:15:24 +02:00
Krzysztof Kotlarek e2c2f51799 FIX: dont error when topic without category 2020-08-17 16:18:16 +10:00
Krzysztof Kotlarek 74c09d58b0 FIX: bump version to 0.5 2020-08-17 15:46:02 +10:00
Krzysztof Kotlarek 0f0e76f170
FIX: move data to separate tables (#52)
We are trying to avoid custom tables. Changes:
CategoryCustomField -> DiscourseVoting::CategorySetting # contains infromation if voting is enabled for category
UserCustomField -> DiscourseVoting::Vote # user's votes
TopicCustomField -> DiscourseVoting::VoteCounter # cache count for topics
2020-08-17 15:01:33 +10:00
Discourse Translator Bot 06adb63503 Update translations 2020-08-11 13:07:15 +00:00
Penar Musaraj 49c9e5514f
Use eslint-config-discourse for dev dependencies 2020-08-05 15:57:39 -04:00
Penar Musaraj 00be85df7f
Use CSS custom properties for stylesheet colors 2020-08-05 15:46:38 -04:00
Discourse Translator Bot 0dbed63b21 Update translations 2020-08-05 13:31:06 +00:00
Discourse Translator Bot 6605e5d3da DEV: Switch from Transifex to Crowdin 2020-07-16 14:01:38 +02:00
Bianca Nenciu 0d4f38404b DEV: Remove computed field
There was a lot of code for very little functionality and it caused
issues with other plugin tests.
2020-07-10 15:54:05 +03:00
Robin Ward 47ae7d38d5 FIX: Broken tests 2020-07-07 16:15:16 -04:00
Robin Ward 28e0a098b8 FIX: Deprecation 2020-07-07 14:47:38 -04:00
Jarek Radosz 17f48ec3ee
DEV: Actually fix deprecation
Continuation of 8b0b6ec0c2 :P
2020-07-06 22:23:08 +02:00
Robin Ward 8b0b6ec0c2 FIX: Deprecation 2020-07-06 15:02:31 -04:00
Neil Lalonde 1d25aafb6a
Update translations 2020-06-24 11:42:49 -04:00
Gerhard Schlager d50d749b5f DEV: Use consistent interpolation key format in translations 2020-06-02 19:27:42 +02:00
Dan Ungureanu 639dce7a8b
FIX: Move archived votes when merging topics (#50) 2020-05-26 13:10:13 +03:00
Jarek Radosz e642fdf6fd DEV: Add rubocop-discourse gem 2020-05-06 18:14:42 +02:00
Neil Lalonde 3644fe8585
Update translations 2020-05-04 10:51:31 -04:00
Neil Lalonde 846f0e934a Update translations 2020-02-13 15:07:45 -05:00
Bianca Nenciu ec3274911e
FIX: Use correct variable name (#49)
This is a follow up to commit discourse/discourse@5762498391 and
e437b603bd.
2020-01-21 18:43:31 +02:00
Neil Lalonde 8406be8dc0 Update translations 2020-01-20 11:23:50 -05:00
Kris 924ab38fdf UX: Resize popup on mobile to avoid overflow. 2020-01-16 20:31:38 -05:00
Neil Lalonde c663065aec Update translations 2019-12-19 12:52:43 -05: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
Bianca Nenciu e437b603bd
FIX: Build correct NavItem URL (#47) 2019-12-03 00:03:23 +02:00
Daniel Waterworth 3b097f23a5 DEV: Remove reliance on filterMode URLs 2019-11-14 12:37:00 +00:00
Neil Lalonde 65a4cbfdba Update translations 2019-11-06 10:47:51 -05:00
Sam Saffron a97026b2e0 FIX: currentURL may be incorrect sometimes
When transitioning only using queryParams under some conditions currentURL
will not update. Using queryParams is both cleaner and less fragile.
2019-11-06 16:39:03 +11:00
Sam Saffron 16718b118b FIX: when selecting "votes" it would not be selected
This corrects an issue where selecting votes would not be highlighted in
the nav bar

Requires latest Discourse
2019-11-05 16:14:13 +11:00
Neil Lalonde 16272d3ba9 Update translations 2019-10-10 11:27:15 -04:00
Dan Ungureanu a91af78bd7
DEV: Enable Travis CI. 2019-10-08 12:48:55 +03: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
Joe 9cc4aa22a5
UX: wrap avatars in voter pop-up 2019-09-03 07:19:22 +08:00
Joe 44a60a7409
REFACTOR: plugin CSS cleanup (#44) 2019-08-27 18:54:55 +08:00