Skip to content

Commit

Permalink
linagora#1960 Resolve threads
Browse files Browse the repository at this point in the history
  • Loading branch information
Stéphane VIEIRA committed Mar 11, 2022
1 parent 02d35fe commit 1ce38dc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const useChannelGuests = (

if (channelGuestsUpdated) _setChannelGuests(channelGuestsUpdated);

// FIX ME Not sure about doing another call to backend here for userList
const usersIdx = channelGuestsUpdated.map(guest => guest.user_id || '');
const users = await UserAPIClient.list(usersIdx, [companyId]);

Expand Down
5 changes: 4 additions & 1 deletion twake/frontend/src/app/features/users/types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export type UserPreferencesType = null | {
allow_tracking?: boolean;
tutorial_done?: boolean;
channel_ordering?: 'chronological' | 'alphabetical';
//(CompanyType | WorkspaceType | any)[];
recent_workspaces?: { company_id: string; workspace_id: string }[];
};

Expand Down Expand Up @@ -51,6 +50,10 @@ export type UserType = {
username: string;
companies?: UserCompanyType[];
preferences: UserPreferencesType;

/**
* this field is filled when available and so we cannot rely on it except on search service for filtering
**/
workspaces?: UserWorkspaceType[];
workspaces_id?: string[];
is_verified?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from 'recoil';
import { CompanyApplicationsStateFamily } from 'app/features/applications/state/company-applications';
import { UserSelector } from 'app/features/users/state/selectors/user-selector';
import { useUser } from 'app/features/users/hooks/use-user';

type Props = {
small?: boolean;
Expand All @@ -23,9 +24,8 @@ export default (props: Props) => {
const context = useContext(MessageContext);
let { message } = useMessage(context);

let user =
useRecoilValueLoadable(UserSelector(message.user_id)).valueMaybe() ||
(message.users || []).find(u => u.id === message.user_id);
const user =
useUser(message.user_id) || (message.users || []).find(u => u.id === message.user_id);
const companyApplications =
useRecoilState(CompanyApplicationsStateFamily(context.companyId))[0] || [];
let application = companyApplications.find(a => a.id === message.application_id);
Expand Down
1 change: 1 addition & 0 deletions twake/frontend/src/app/views/client/main-view/MainView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const MainView: FC<PropsType> = ({ className }) => {
const workspaceId = useRouterWorkspace();
const channelId = useRouterChannel();

// We call this hook here to be able to preload some users in user list state
useUserList();

const loaded = useWatcher(ChannelsBarService, async () => {
Expand Down

0 comments on commit 1ce38dc

Please sign in to comment.