discourse/spec/components/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
..
topic_guardian_spec.rb FIX: Hide a post's pending flag count from TL4 users. (#13129) 2021-05-26 12:58:00 +10:00
user_guardian_spec.rb FIX: Add DB constraints for post & topic counter cache for UserStat (#15626) 2022-02-07 11:23:34 +08:00