Open AnyRoad opened 5 years ago
This is a known limitation due to the data model. Comment removal in many cases doesn't delete the record itself but cleaning it and sets 'deleted' flag. This is done to preserve possible references (parent-child tree). The way boltdb storage implements UserCount
doesn't check every comment for the deleted flag, but gets Stats().KeyN
directly.
This was done for performance reasons (mostly) because checking each comment could be a heavy task for some users. However, there is a better way to do it by maintaining per-user meta-information. I'm planning to add such meta bucket but after #155 solved.
It might be done intentionally but right now the "get comment by user id" API returns total comments count in the "count" field. But it does not return deleted comments in the "comments" field which seems to be little bit inconsistent because we can get 1 comment and "3" as the count value if 2 others were deleted: