Files
mostlymatter/store/sqlstore
Jesse Hallam 6757edc4e2 MM-41349: CRT, fix LastUpdated semantics (#19523)
* deadcode: remove UpdateChannelLastViewedAt

* deadcode: remove ThreadStore.(Save(Multiple)|Update|Delete)

* deadcode: followThead in App.MarkChannelAsUnreadFromPost

* document ThreadMembership, Thread structs

* maintain LastUpdated consistently

Whenever we touch a `ThreadMembership` record, we should be setting `LastUpdated` to the current timestamp. The mobile client relies on this to detect changes to these records.

* simplify: never updateThreads from `App.MarkChannelAsUnreadFromPost`

Change all invocations of `ChannelStore.UpdateLastViewedAtPost` from `App.MarkChannelAsUnreadFromPost` to pass `updateThreads` as `false`. When `ChannelStore.UpdateLastViewedAtPost` was invoked with `updateThreads` as `true`, it would in turn call `ThreadStore.UpdateUnreadsByChannel` but pass `updateViewedTimestamp` as `false`. This effectively updated the `LastUpdated` field of the corresponding thread memberships but never touched any of the actual data (such as `LastViewed`).

The overall CRT feature continued to work, because `App.MarkChannelAsUnreadFromPost` directly updates the relevant thread memberships via `ThreadStore.MaintainMembership`.

* deadcode: updateThreads in ChannelStore.UpdateLastViewedAtPost

* simplify: never updateThreads from App.SendNotifications

Change all invocations of `ChannelStore.IncrementMentionCount` from
`App.SendNotifications` to pass `updateThreads` as `false`. When `ChannelStore.IncrementMentionCount` was invoked with `updateThreads` as `true`, it would in turn call `ThreadStore.UpdateUnreadsByChannel` but pass `updateViewedTimestamp` as `false`. This effectively updated the `LastUpdated` field of the corresponding thread memberships but never touched any of the actual data (such as `UnreadMentions`).

The overall CRT feature continued to work, because `App.SendNotifications` directly updates the relevant thread memberships mention counts via `ThreadStore.MaintainMembership`.

* deadcode: updateThreads in ChannelStore.IncrementMentionCount

* fix & rename ThreadStore.UpdateUnreadsByChannel

Rename `ThreadStore.UpdateUnreadsByChannel` to `ThreadStore.UpdateLastViewedByThreadIds`, making it unconditionally set the `LastViewed` for the given threads (as well as `LastUpdated`).

All previous invocations of this method that passed `updateViewedTimestamp` have been previously removed.

* unrelated gofmt -w -s changes to satisfy linter

* always set LastUpdated to model.GetMillis()

* deadcode: ThreadStore.SaveMembership

* fix TestMarkUnreadWithThreads

* GetMasterX
2022-02-28 16:24:34 -04:00
..
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-17 12:34:39 -05:00
2022-02-15 11:44:04 +05:30
2022-02-25 20:02:08 +03:00
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2021-08-17 16:08:04 -04:00
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-15 11:44:04 +05:30
2022-02-17 12:34:39 -05:00
2022-02-15 11:44:04 +05:30