discourse/lib/guardian
Alan Guo Xiang Tan 5bd55acf83
FIX: Add DB constraints for post & topic counter cache for `UserStat` (#15626)
Ensures that `UserStat#post_count` and `UserStat#topic_count` does not
go below 0. When it does like it did now, we tend to have bugs in our
code since we're usually coding with the assumption that the count isn't
negative.

In order to support the constraints, our post and topic fabricators in
tests will now automatically increment the count for the respective
user's `UserStat` as well. We have to do this because our fabricators
bypasss `PostCreator` which holds the responsibility of updating `UserStat#post_count` and
`UserStat#topic_count`.
2022-02-07 11:23:34 +08:00
..
bookmark_guardian.rb FEATURE: Allow editing bookmark reminders (#9437) 2020-04-17 11:08:07 +10:00
category_guardian.rb FEATURE: Allow admins to permanently delete posts and topics (#14406) 2021-10-13 12:53:23 +03:00
ensure_magic.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
group_guardian.rb FEATURE: Experimental support for group membership via google auth (#14835) 2021-12-09 12:30:27 +00:00
post_guardian.rb FEATURE: Allow admins to permanently delete posts and topics (#14406) 2021-10-13 12:53:23 +03:00
post_revision_guardian.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
tag_guardian.rb DEV: Reuse code for TrustLevelAndStaffSetting (#15044) 2021-11-22 20:18:53 +02:00
topic_guardian.rb DEV: Reuse code for TrustLevelAndStaffSetting (#15044) 2021-11-22 20:18:53 +02:00
user_guardian.rb FIX: Add DB constraints for post & topic counter cache for `UserStat` (#15626) 2022-02-07 11:23:34 +08:00