Adds the ability for voting on a topic within a specified category in Discourse.
Go to file
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
app FIX: move data to separate tables (#52) 2020-08-17 15:01:33 +10:00
assets FIX: the ability to remove the vote (#55) 2020-09-15 16:21:18 +10:00
config Update translations 2020-09-16 10:22:04 +00:00
db/migrate FIX: Skip migrating null/blank custom field values in migrations 2020-09-09 17:00:56 +01:00
lib/discourse_voting FIX: dont error when topic without category 2020-08-17 16:18:16 +10:00
spec FIX: Stop trying to merge duplicate votes (#56) 2020-09-17 11:02:19 -05:00
.eslintrc DEV: apply coding standards (#54) 2020-09-04 13:20:28 +02:00
.gitignore DEV: apply coding standards (#54) 2020-09-04 13:20:28 +02:00
.prettierrc DEV: apply coding standards (#54) 2020-09-04 13:20:28 +02:00
.rubocop.yml DEV: Add rubocop-discourse gem 2020-05-06 18:14:42 +02:00
.template-lintrc.js DEV: apply coding standards (#54) 2020-09-04 13:20:28 +02:00
.travis.yml DEV: Enable Travis CI. 2019-10-08 12:48:55 +03:00
Gemfile FIX: Stop trying to merge duplicate votes (#56) 2020-09-17 11:02:19 -05:00
Gemfile.lock FIX: Stop trying to merge duplicate votes (#56) 2020-09-17 11:02:19 -05:00
LICENSE.txt Add who voted to vote count 2016-03-17 15:47:02 -05:00
README.md Rename feature voting to voting 2017-03-06 15:38:26 -05:00
package.json DEV: apply coding standards (#54) 2020-09-04 13:20:28 +02:00
plugin.rb FIX: Stop trying to merge duplicate votes (#56) 2020-09-17 11:02:19 -05:00
translator.yml DEV: Switch from Transifex to Crowdin 2020-07-16 14:01:38 +02:00
yarn.lock DEV: apply coding standards (#54) 2020-09-04 13:20:28 +02:00

README.md

Discourse Voting

Adds the ability for voting on a topic within a specified category.

Topic discussing the plugin itself can be found here: https://meta.discourse.org/t/discourse-voting/40121