Role permissions are not updated on app launch (#9383)

* Force-fetch role permissions on app launch to ensure they are up-to-date

Co-authored-by: kondo97 <85671197+kondo97@users.noreply.github.com>

* Add test to verify roles are force-fetched on app launch

Co-authored-by: kondo97 <85671197+kondo97@users.noreply.github.com>

* Remove redundant test case for role permissions force-fetch

Co-authored-by: kondo97 <85671197+kondo97@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
kondo 2026-02-13 20:43:14 +09:00 committed by GitHub
parent 616483edbf
commit f9001ec7cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -8,6 +8,7 @@ import {act} from '@testing-library/react-native';
import {fetchMyChannelsForTeam, fetchMissingDirectChannelsInfo, type MyChannelsRequest} from '@actions/remote/channel';
import {fetchGroupsForMember} from '@actions/remote/groups';
import {fetchPostsForUnreadChannels} from '@actions/remote/post';
import {fetchRoles} from '@actions/remote/role';
import {fetchScheduledPosts} from '@actions/remote/scheduled_post';
import {fetchTeamsThreads, updateCanJoinTeams, type MyTeamsRequest} from '@actions/remote/team';
import {autoUpdateTimezone, updateAllUsersSince, type MyUserRequest} from '@actions/remote/user';
@ -18,6 +19,7 @@ import {processEntryModels, processEntryModelsForDeletion} from '@queries/server
import {deferredAppEntryActions, restDeferredAppEntryActions, testExports} from './deferred';
jest.mock('@actions/remote/channel');
jest.mock('@actions/remote/role');
jest.mock('@actions/remote/scheduled_post');
jest.mock('@actions/remote/team');
jest.mock('@actions/remote/user');
@ -153,6 +155,7 @@ describe('actions/remote/entry/deferred', () => {
expect(fetchPostsForUnreadChannels).toHaveBeenCalled();
expect(fetchGroupsForMember).toHaveBeenCalledWith(serverUrl, currentUserId, false, undefined);
expect(fetchScheduledPosts).toHaveBeenCalledWith(serverUrl, initialTeamId, true, undefined);
expect(fetchRoles).toHaveBeenCalledWith(serverUrl, defaultTeamData.memberships, defaultChData.memberships, defaultMeData.user, false, true, undefined);
});
it('should handle missing data gracefully', async () => {

View file

@ -116,7 +116,7 @@ export async function restDeferredAppEntryActions(
const processFinalInitializationTasks = async (uniqueChannelsData: MyChannelsRequest) => {
try {
fetchRoles(serverUrl, teamData.memberships, chData?.memberships, meData?.user, false, false, groupLabel);
fetchRoles(serverUrl, teamData.memberships, chData?.memberships, meData?.user, false, true, groupLabel);
if (initialTeamId) {
const initialTeam = teamMap.get(initialTeamId);