diff --git a/app/actions/local/team.ts b/app/actions/local/team.ts index 832735944..d8213183c 100644 --- a/app/actions/local/team.ts +++ b/app/actions/local/team.ts @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import DatabaseManager from '@database/manager'; -import {prepareDeleteTeam, getMyTeamById, queryTeamSearchHistoryByTeamId, removeTeamFromTeamHistory, getTeamSearchHistoryById} from '@queries/servers/team'; +import {prepareDeleteTeam, getMyTeamById, queryTeamSearchHistoryByTeamId, removeTeamFromTeamHistory, getTeamSearchHistoryById, getTeamById} from '@queries/servers/team'; import {logError} from '@utils/log'; import type Model from '@nozbe/watermelondb/Model'; @@ -12,7 +12,7 @@ export async function removeUserFromTeam(serverUrl: string, teamId: string) { const {database, operator} = DatabaseManager.getServerDatabaseAndOperator(serverUrl); const myTeam = await getMyTeamById(database, teamId); if (myTeam) { - const team = await myTeam.team.fetch(); + const team = await getTeamById(database, myTeam.id); if (!team) { throw new Error('Team not found'); } diff --git a/app/components/post_with_channel_info/channel_info/index.ts b/app/components/post_with_channel_info/channel_info/index.ts index d97efc5e8..af0c1675d 100644 --- a/app/components/post_with_channel_info/channel_info/index.ts +++ b/app/components/post_with_channel_info/channel_info/index.ts @@ -4,6 +4,8 @@ import withObservables from '@nozbe/with-observables'; import {switchMap, of as of$} from 'rxjs'; +import {observeTeam} from '@queries/servers/team'; + import ChannelInfo from './channel_info'; import type PostModel from '@typings/database/models/servers/post'; @@ -16,7 +18,7 @@ const enhance = withObservables(['post'], ({post}: {post: PostModel}) => { switchMap((chan) => (chan ? of$(chan.displayName) : '')), ), teamName: channel.pipe( - switchMap((chan) => (chan && chan.teamId ? chan.team.observe() : of$(null))), + switchMap((chan) => (chan && chan.teamId ? observeTeam(post.database, chan.teamId) : of$(null))), switchMap((team) => of$(team?.displayName || null)), ), }; diff --git a/app/components/team_sidebar/team_list/team_item/index.ts b/app/components/team_sidebar/team_list/team_item/index.ts index dade42701..f639f7bd4 100644 --- a/app/components/team_sidebar/team_list/team_item/index.ts +++ b/app/components/team_sidebar/team_list/team_item/index.ts @@ -8,7 +8,7 @@ import {combineLatestWith, map, switchMap, distinctUntilChanged} from 'rxjs/oper import {observeAllMyChannelNotifyProps, queryMyChannelsByTeam} from '@queries/servers/channel'; import {observeCurrentTeamId} from '@queries/servers/system'; -import {observeMentionCount} from '@queries/servers/team'; +import {observeMentionCount, observeTeam} from '@queries/servers/team'; import TeamItem from './team_item'; @@ -38,7 +38,7 @@ const enhance = withObservables(['myTeam'], ({myTeam, database}: WithTeamsArgs) return { selected, - team: myTeam.team.observe(), + team: observeTeam(database, myTeam.id), mentionCount: observeMentionCount(database, myTeam.id, false), hasUnreads, };