Add column last_fetched_at to MyChannel & Thread tables and the migration (#6433)

* Add column last_fetched_at to MyChannel & Thread tables and the migration

* Fix schema tests

* Handle lastFetchAt, retrieve threads on init and properly observe thread unreads (#6436)

* [Gekidou] Set lastFetchAt when fetching posts for a channel (#6437)

* Set lastFetchAt when fetching posts for a channel

* When resetting _preparedState set always to null

* Revert changes in WS

* Handle and set lastFetchedAt for MyChannel in iOS push notification

* feedback review

* iOS fallback to last post createAt if no lastFetchAt set

* Handle lastFetchAt on Android push notifications

* create storePostsForChannel local action

* Fix iOS fallback to last post create_at

Co-authored-by: Daniel Espino García <larkox@gmail.com>
This commit is contained in:
Elias Nahum
2022-06-29 13:28:50 -04:00
committed by GitHub
parent eaa150cb4b
commit 75ed884e65
35 changed files with 445 additions and 177 deletions

View File

@@ -89,7 +89,7 @@ export type HandlePostsArgs = {
};
export type HandleThreadsArgs = {
threads?: Thread[];
threads?: ThreadWithLastFetchedAt[];
prepareRecordsOnly?: boolean;
teamId?: string;
loadedInGlobalThreads?: boolean;

View File

@@ -17,6 +17,9 @@ export default class MyChannelModel extends Model {
/** last_post_at : The timestamp for any last post on this channel */
lastPostAt: number;
/** last_fetched_at : The timestamp when we successfully last fetched post on this channel */
lastFetchedAt: number;
/** last_viewed_at : The timestamp showing the user's last viewed post on this channel */
lastViewedAt: number;
@@ -43,4 +46,6 @@ export default class MyChannelModel extends Model {
/** settings: User specific settings/preferences for this channel */
settings: Relation<MyChannelSettingsModel>;
resetPreparedState: () => void;
}

View File

@@ -20,6 +20,9 @@ export default class ThreadModel extends Model {
/** lastReplyAt : The timestamp of when user last replied to the thread. */
lastReplyAt: number;
/** last_last_fetched_at_at : The timestamp when we successfully last fetched post on this channel */
lastFetchedAt: number;
/** lastViewedAt : The timestamp of when user last viewed the thread. */
lastViewedAt: number;

View File

@@ -116,7 +116,7 @@ type RawValue =
| TeamChannelHistory
| TeamMembership
| TeamSearchHistory
| Thread
| ThreadWithLastFetchedAt
| ThreadInTeam
| ThreadParticipant
| UserProfile