Commit graph

5 commits

Author SHA1 Message Date
Tim Starling
97b8262d1f Use UserRigorOptions directly
Conventionally, public constants are accessed via their declaring
class, except for self:: which is an acceptable shortcut.

Change-Id: If05eab72140267e6ef54736710d751d7f24a7860
2022-03-25 10:06:34 +11:00
Reedy
8c39aab84b Remove or replace usages of "sanity"
Bug: T254646
Change-Id: Ib192dc5704a14d02c7c374d0ab29bac55c5df24a
2021-11-21 19:35:49 +00:00
DannyS712
b82cf00983 Remove User::$mEditCount and internal caching
UserEditTracker now returns null for anonymous users
instead of throwing an exception.

Added new UserEditTracker::setCachedUserEditCount()
method (internal) to handle the user_editcount field
in User::loadFromRow()'s row. This now means that
the creation of one User object can set the cached
value for any other object for the same underlying user
- the alternative (just ignoring the value) would mean
that an extra database read might be needed. This is
only used for users created with a row that includes
the user id - we silently discard the value if
the row doesn't have a user id (or the user id is 0)
to avoid issues with UserEditTracker trying to fetch
the user id and potentially triggering another load.

A follow-up will simplify the UserEditCountUpdate class
to remove storing full UserIdentity objects now that
only the id is needed.

Follow-up: Ibf1482bcbcbf4d56fc06531bb3e17e2a6e3e2e6f
Change-Id: Ie3fb4887d9f2d96b32598865030351bf3bf20ce5
2021-06-18 00:25:47 +00:00
DannyS712
5a229f691f Accept UserIdentity in code to manage edit counts
- UserEditCountUpdate: accept UserIdentity instead of User
- Move User::incEditCount() to UserEditTracker

Change-Id: Ibf1482bcbcbf4d56fc06531bb3e17e2a6e3e2e6f
2021-06-08 05:41:03 +00:00
Tim Starling
02ae9aa0ba Rewrite UserEditTrackerTest as an integration test
As previously discussed, the database should usually not be mocked. I'm
changing many of these queries for the next stage of the actor
migration, and just copying my own query from the code to the test file
does not give me any confidence that the query I'm writing is correct.
The unit test was simply ensuring that the implementation of the class
doesn't change, it wasn't verifying correct operation.

Change-Id: Id3ee02fd547d0a7b5b7f35866ee317e8b09e6c18
2021-05-11 13:03:45 +10:00