Commit Graph

21 Commits

Author SHA1 Message Date
Natalie Tay 3d3037729c
DEV: Scope topic voting tables to avoid confusion with post voting (#196)
Renaming discourse_voting to topic_voting since there are two forms of voting in Discourse - posts and topics.

This PR also moves a OnceOff into a post migration. The post migration will be executed, but should ideally be a no-op. This allows us to not have to maintain the OnceOff as it had to be modified before with a previous migration. I considered removing this file altogether, but I don't think there is anything negative from just converting it into a migration, and it might be useful in the unlikely scenario that a forum from the past has never ran the OnceOff before.
2024-07-17 20:26:40 +08:00
Natalie Tay fdb1f98a96
DEV: Autoload plugin files and namespace some jobs (#194) 2024-07-11 10:15:01 +08:00
Loïc Guitaut fa6fe4abbf DEV: Fix new Rubocop offenses 2024-03-05 16:13:45 +01:00
Penar Musaraj 98115faada
FIX: Render votes RSS feed (#180) 2024-01-18 16:02:42 -05:00
Faizaan Gagan 829424cbbb
FIX: use safe navigation operator for params (#177)
* FIX: use safe navigation operator for params

Bug report: https://meta.discourse.org/t/-/289850
Solution ref: https://stackoverflow.com/questions/34794697

* added spec

* formatting fix
2023-12-28 12:39:35 +05:30
Penar Musaraj be71ec457c
FIX: Rely on core for staff action logs (#176)
Previously, we were deleting the `enable_topic_voting` custom field param
and doing the staff logging in this plugin. This has a problem though, it
was being done in the model's create/destroy hooks and was missing the
acting user (so the logs would report the change as `system`).

This PR keeps the custom field param and relies on core to do the staff
action logging. This change also results in the custom field being set
in the DB when it is enabled even though we don't use it in the serializer.
2023-12-18 14:13:39 -05:00
Krzysztof Kotlarek aa12f754d4
FIX: granular webhooks (#159)
After those core changes we need additional translations and separate logic to handle assigned and unassigned webhooks

https://github.com/discourse/discourse/pull/23070
2023-10-09 03:26:19 +00:00
Renato Atilio a5f13fa3ce
FEATURE: trigger a custom webhook on upvotes (#158)
* FEATURE: trigger a custom webhook on upvotes

* DEV: fix linting
2023-08-11 13:50:21 -03:00
Alan Guo Xiang Tan ba27a427d8
DEV: Rename `has_one :category_setting` as it clashes with core (#148) 2023-03-07 09:04:40 +08:00
Bianca Nenciu 5477ab631a
DEV: Update plugin to match latest guidelines (#146)
- Define extension modules
- Use different files instead of plugin.rb
- Make sure plugin is disabled according to the setting
2023-02-17 17:46:07 +02:00
David Taylor 1284196081
DEV: Introduce syntax_tree for ruby formatting (#138) 2022-12-29 13:35:59 +01:00
Natalie Tay 6bbc982477
DEV: Plugin rename (#126)
Update metadata, Rename ruby module, Rename folders and filenames, Rename i18n keys
2022-11-02 13:42:06 +08:00
Arpit Jalan a47c6e3711
FIX: do not recreate database record for category setting (#119)
On the category settings page if the voting plugin is enabled and user
clicks “Save Category” button then the database record for the
`discourse_voting_category_settings` table is deleted and recreated
every time the button is pressed. This commit checks for existing record
and prevents creation of new database record
2022-05-12 15:39:58 +05:30
Faizaan Gagan 1da6677212
FIX: handle boolean correctly on server (#116)
* FIX: handle boolean correctly on server

* added a test

* added a negative test case
2022-04-11 18:18:50 +05:30
Vinoth Kannan fc4d23174e
PERF: exclude vote fields in `topic-list-item` serializer for PMs. (#103)
We shouldn't add vote fields for personal messages since users can't vote there. If we include then it's creating an N+1 issue in the `private-messages-all` endpoint.
2021-09-16 18:56:02 +05:30
Osama Sayegh 8dbc75f965
FIX: Upsert topic votes count atomically (#71)
The `Topic#update_vote_count` method should be concurrency-safe to prevent unique constraint violation errors when multiple processes try to insert a topic_votes_count record for the same topic simultaneously.

Signed-off-by: OsamaSayegh <asooomaasoooma90@gmail.com>
2021-01-07 07:26:52 +03:00
Jarek Radosz b92385aada
FIX: Delete the votes on user removal (#59)
There are some assumptions in the code that `vote.user` exists. It makes sense to boop the votes out of existence when their owner is destroyed.
2020-10-06 18:04:26 +02:00
Krzysztof Kotlarek e2c2f51799 FIX: dont error when topic without category 2020-08-17 16:18:16 +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
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
Joe Buhlig 08c7ed752f Initial commit 2016-02-17 07:20:42 -06:00