mattermost-mobile-upstream/app/actions/local
Guillermo Vayá 6d1d12e42d Self-heal a channel hidden by a post-less PostsInChannel interval
The channel post list renders one interval only: postsInChannel[0], the
PostsInChannel row with the greatest `latest`. If that interval ends up with
no posts in it, the channel renders zero rows -- it looks blank even though
the older posts are still in the database -- and today nothing recovers it.

An interval becomes post-less when every post it was built from is deleted on
the server: a later fetch returns them with delete_at set, and handlePosts
destroys them locally while leaving the interval untouched. From then on:

- fetchPostsForChannel takes the since-branch (myChannel.lastFetchedAt is
  advanced by deletions too, since getLastFetchedAtFromPosts uses
  max(create_at, update_at, delete_at)), and getPostsSince returns nothing
  when there is nothing newer, so no post is ever stored again;
- the channel_post_list fallback page-0 fetch does store posts, but its
  interval sorts below the empty one, so postsInChannel[0] is unchanged and
  the list stays empty;
- handleReceivedPostsInChannel does not merge the empty interval away either:
  it is disjoint and newer than the page just fetched, so the merge loop
  breaks before reaching it.

The MM-66467 fix stopped these intervals from being *created* from deleted
posts, but an existing interval that later loses all its posts (or one left
behind in a database poisoned by an older build) still hides the channel for
good, with "Reset cached messages" as the only way out.

So prune them: an interval with no posts carries no information -- re-fetching
an empty range is harmless -- and dropping it lets the next interval, or a
fresh page fetch, render again. fetchPostsForChannel now prunes when the
channel has no visible posts, and stops trusting lastFetchedAt in that state
so the fallback is a full page fetch instead of a no-op since-fetch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-28 14:54:44 +02:00
..
ephemeral_mode Mm 68767 zero persistence (#9803) 2026-07-16 13:55:45 +02:00
session Mm 68767 zero persistence (#9803) 2026-07-16 13:55:45 +02:00
category.test.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
category.ts [MM-68255] Enable mobile support for Managed Categories (#9683) 2026-04-16 10:01:51 -04:00
channel_bookmark.test.ts Add unit tests for actions/local/channel_bookmark (#8125) 2024-08-06 14:20:45 -04:00
channel_bookmark.ts Channel Bookmarks (#7817) 2024-07-18 09:10:28 +08:00
channel.test.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
channel.ts fix: push notification navigation delay and stale in-app avatar (#9929) 2026-07-22 14:15:21 +02:00
draft.test.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
draft.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00
file.test.ts Add is_blocked to FileModel (#8842) 2025-05-07 15:33:04 +08:00
file.ts Add is_blocked to FileModel (#8842) 2025-05-07 15:33:04 +08:00
group.test.ts Increase branch test coverage to over 80% for actions/local (#8366) 2024-11-21 08:16:19 -05:00
group.ts Graph QL POC (#6024) 2022-07-29 16:28:32 +02:00
post.test.ts Self-heal a channel hidden by a post-less PostsInChannel interval 2026-07-28 14:54:44 +02:00
post.ts Self-heal a channel hidden by a post-less PostsInChannel interval 2026-07-28 14:54:44 +02:00
reactions.test.ts Remove app alias for imports (#8314) 2024-11-07 08:34:49 +08:00
reactions.ts Substitute all console.x by an appropiate log util function (#6427) 2022-06-24 10:26:40 -04:00
scheduled_post.test.ts Fix tests leaks and other minor improvements (#9001) 2025-07-21 07:29:26 -06:00
scheduled_post.ts Feature schedule posts (#8509) 2025-04-14 22:08:59 +05:30
systems.test.ts Mm 68767 zero persistence (#9803) 2026-07-16 13:55:45 +02:00
systems.ts Mm 68767 zero persistence (#9803) 2026-07-16 13:55:45 +02:00
team.test.ts Mm 68767 zero persistence (#9803) 2026-07-16 13:55:45 +02:00
team.ts Mm 68767 zero persistence (#9803) 2026-07-16 13:55:45 +02:00
thread.test.ts Revert "e2e(detox): Rainforest to Detox migration (#9790)" (#9834) 2026-06-15 17:57:01 +02:00
thread.ts fix: push notification navigation delay and stale in-app avatar (#9929) 2026-07-22 14:15:21 +02:00
user.test.ts feat(iOS): Add Microsoft Intune MAM integration with multi-server support (#9312) 2025-12-10 13:07:28 +02:00
user.ts Migrate from RNN to Expo router (#9402) 2026-05-13 17:44:55 +08:00