FIX: disable storing invalid post and topic timing when sent from client (#26683)

This ensures we only ever store correct post and topic timing when the client
notifies.

Previous to this change we would blindly trust the client.

Additionally this has error correction code that will correct the last seen
post number when you visit a topic with incorrect timings.
This commit is contained in:
Sam
2024-04-19 18:10:50 +10:00
committed by GitHub
parent 06500fa626
commit 1c67917367
5 changed files with 84 additions and 2 deletions

View File

@ -228,6 +228,12 @@ RSpec.describe TopicUser do
today = Time.zone.now
freeze_time Time.zone.now
# ensure data model is correct for the test
# logging an update to a row that does not exist
# is not supported
_post1 = Fabricate(:post, topic: topic)
_post2 = Fabricate(:post, topic: topic)
TopicUser.update_last_read(user, topic.id, 1, 1, 0)
tomorrow = 1.day.from_now