diff --git a/tdrive/frontend/src/app/components/parameters/attribute.tsx b/tdrive/frontend/src/app/components/parameters/attribute.tsx index ea8db87c..8bb29dff 100755 --- a/tdrive/frontend/src/app/components/parameters/attribute.tsx +++ b/tdrive/frontend/src/app/components/parameters/attribute.tsx @@ -3,7 +3,7 @@ import './parameters.scss'; export default (props: { label: string; description: string; children: ReactNode }) => { return ( -
+
{props.label}
{props.description}
diff --git a/tdrive/frontend/src/app/components/parameters/parameters.scss b/tdrive/frontend/src/app/components/parameters/parameters.scss index 12faa22a..dca49947 100755 --- a/tdrive/frontend/src/app/components/parameters/parameters.scss +++ b/tdrive/frontend/src/app/components/parameters/parameters.scss @@ -47,7 +47,6 @@ & > .value { font-size: 14px; - max-height: 0; transition: max-height 0.2s, opacity 0.2s; overflow: hidden; opacity: 0; diff --git a/tdrive/frontend/src/app/deprecated/workspaces/workspaces.jsx b/tdrive/frontend/src/app/deprecated/workspaces/workspaces.jsx index 09927904..069eec7c 100755 --- a/tdrive/frontend/src/app/deprecated/workspaces/workspaces.jsx +++ b/tdrive/frontend/src/app/deprecated/workspaces/workspaces.jsx @@ -39,36 +39,7 @@ class Workspaces extends Observable { } updateCurrentWorkspaceId(workspaceId, notify = false) { - if (this.currentWorkspaceId !== workspaceId && workspaceId) { - const workspace = DepreciatedCollections.get('workspaces').find(workspaceId); - if (!workspace) { - return; - } - - this.currentWorkspaceId = workspaceId; - this.currentWorkspaceIdByGroup[workspace.company_id] = workspaceId; - - if (!this.getting_details[workspaceId]) { - this.getting_details[workspaceId] = true; - - WorkspaceAPIClient.get(workspace.company_id, workspaceId) - .then(workspace => { - if (!workspace) { - this.removeFromUser(workspaceId); - } - DepreciatedCollections.get('workspaces').updateObject(workspace); - notify && this.notify(); - - // FIXME: What is this??? - setTimeout(() => { - this.getting_details[workspaceId] = false; - }, 10000); - }) - .catch(() => { - this.removeFromUser(workspaceId); - }); - } - } + } updateCurrentCompanyId(companyId, notify = false) { @@ -224,10 +195,7 @@ class Workspaces extends Observable { name, }); this.logger.debug('Workspace updated', result); - DepreciatedCollections.get('workspaces').updateObject({ - id: this.currentWorkspaceId, - name, - }); + } catch (err) { this.logger.error('Can not update the workspace', err); } @@ -272,7 +240,6 @@ class Workspaces extends Observable { that.notify(); } else { var update = resp.data; - DepreciatedCollections.get('workspaces').updateObject(update); ws.publish('workspace/' + update.id, { workspace: update }); that.notify(); } @@ -296,10 +263,6 @@ class Workspaces extends Observable { } window.location.reload(); } - - getCurrentWorkspace() { - return DepreciatedCollections.get('workspaces').find(this.currentWorkspaceId) || {}; - } } export default new Workspaces(); diff --git a/tdrive/frontend/src/app/features/applications/state/company-applications.ts b/tdrive/frontend/src/app/features/applications/state/company-applications.ts index b345c385..40784289 100644 --- a/tdrive/frontend/src/app/features/applications/state/company-applications.ts +++ b/tdrive/frontend/src/app/features/applications/state/company-applications.ts @@ -19,7 +19,6 @@ export const onChangeCompanyApplications = (companyId: string, _applications: Ap (applications || []).forEach(a => { if (!_.isEqual(a, companyApplicationMap.get(a.id))) { companyApplicationMap.set(a.id, a); - Collections.get('applications').updateObject(a); } }); }; diff --git a/tdrive/frontend/src/app/features/companies/state/companies.ts b/tdrive/frontend/src/app/features/companies/state/companies.ts index 8fe73a1f..0595066d 100644 --- a/tdrive/frontend/src/app/features/companies/state/companies.ts +++ b/tdrive/frontend/src/app/features/companies/state/companies.ts @@ -21,7 +21,6 @@ export const CompaniesState = atomFamily({ onSet(company => { if (company?.id) { companies[company.id] = company; - Collections.get('groups').updateObject(_.cloneDeep(company)); } }); }, diff --git a/tdrive/frontend/src/app/features/workspace-members/services/workspace-members-service.ts b/tdrive/frontend/src/app/features/workspace-members/services/workspace-members-service.ts index fae4e4bd..b66b9dd9 100755 --- a/tdrive/frontend/src/app/features/workspace-members/services/workspace-members-service.ts +++ b/tdrive/frontend/src/app/features/workspace-members/services/workspace-members-service.ts @@ -54,35 +54,13 @@ class WorkspacesUsers extends Observable { (Globals.window as any).workspaceUserService = this; } getAdminLevel(idWorkspace = workspaceService.currentWorkspaceId) { - const levels = Collections.get('workspaces').find(idWorkspace).levels; - if (levels) { - for (let i = 0; i < levels.length; i++) { - if (levels[i].admin) { - return levels[i]; - } - } - } return false; } getDefaultLevel(idWorkspace = workspaceService.currentWorkspaceId) { - const levels = Collections.get('workspaces').find(idWorkspace).levels; - if (levels) { - for (let i = 0; i < levels.length; i++) { - if (levels[i].default) { - return levels[i]; - } - } - } return false; } isGroupManager() {} getLevel(idLevel: string) { - const levels = Collections.get('workspaces').find(workspaceService.currentWorkspaceId).levels; - for (let i = 0; i < levels.length; i++) { - if (idLevel === levels[i].id) { - return levels[i]; - } - } return false; } @@ -94,109 +72,7 @@ class WorkspacesUsers extends Observable { ws.unsubscribe('workspace_users/' + workspace_id, null, null); } - load(workspace_id: string, reset_offset: string, options: any) { - if (!options) { - options = {}; - } - - const that = this; - const workspace = Collections.get('workspaces').find(workspace_id); - if (!workspace) { - return; - } - const group_id = workspace?.group?.id || workspace.company_id; - - if (!this.users_by_group[group_id]) { - this.users_by_group[group_id] = {}; - } - if (!this.users_by_workspace[workspace_id]) { - this.users_by_workspace[workspace_id] = {}; - } - - if (!this.offset_by_workspace_id[workspace_id] || reset_offset) { - this.offset_by_workspace_id[workspace_id] = [0, false]; - } - if (!this.offset_by_group_id[group_id] || reset_offset) { - this.offset_by_group_id[group_id] = [0, false]; - } - - const loadMembers = (data: any) => { - if (!data) { - return; - } - if (typeof data.members === 'object' && data.members.members) { - data = data.members; - } - if (data.members) { - (data.members || []).forEach((item: any) => { - if ( - !that.offset_by_workspace_id[workspace_id][1] || - Numbers.compareTimeuuid(item.user.id, that.offset_by_workspace_id[workspace_id][1]) > 0 - ) { - that.offset_by_workspace_id[workspace_id][1] = item.user.id; - } - that.offset_by_workspace_id[workspace_id][0]++; - - Collections.get('users').completeObject(item.user, item.user.front_id); - - that.users_by_group[group_id][item.user.id] = item; - that.users_by_workspace[workspace_id][item.user.id] = item; - }); - that.notify(); - } - - if (data.mails) { - that.membersPending = data.mails || []; - that.notify(); - } - - if (data.stats.total_members > 1 && WorkspaceUserRights.hasWorkspacePrivilege()) { - CurrentUser.updateTutorialStatus('did_invite_collaborators'); - } - }; - - const data = { - workspaceId: workspace_id, - max: this.offset_by_workspace_id[workspace_id][0] === 0 ? 100 : 40, - }; - - if (options.members) { - loadMembers(options.members || []); - } else { - Api.post('/ajax/workspace/members/list', data, (res: any) => { - if (res.data) { - loadMembers({ members: res.data }); - } - }); - Api.post('/ajax/workspace/members/pending', data, (res: any) => { - if (res.data) { - loadMembers({ mails: res.data }); - } - }); - loadMembers(options.members || []); - } - - const loadGroupUsers = (data: any) => { - data.users.forEach((item: any) => { - if ( - !that.offset_by_group_id[group_id][1] || - Numbers.compareTimeuuid(item.user.id, that.offset_by_group_id[group_id][1]) > 0 - ) { - that.offset_by_group_id[group_id][1] = item.user.id; - } - that.offset_by_group_id[group_id][0]++; - - Collections.get('users').completeObject(item.user, item.user.front_id); - - that.users_by_group[group_id][item.user.id] = item; - }); - that.notify(); - }; - - if (options.group_users) { - loadMembers(options.group_users); - } - } + load(workspace_id: string, reset_offset: string, options: any) {} canShowUserInWorkspaceList(member: any) { // if user is interne or wexterne => no restriction if (!WorkspaceUserRights.isInvite()) { @@ -206,28 +82,6 @@ class WorkspacesUsers extends Observable { // if other user is interne or wexterne return true; } - - // check in all channel if 2 chavite are in the same channel - const channelsInWorkspace = Collections.get('channels').findBy({ - direct: false, - application: false, - original_workspace: workspaceService.currentWorkspaceId, - }); - for (let i = 0; i < channelsInWorkspace.length; i++) { - // check in all channel if 2 chavite are in the same channel - if (channelsInWorkspace[i].ext_members) { - let bothAreInChannel = 0; // if 1 : one of 2 users searched is in channel as chavite, 2 : both are in channel as chavite - const extMembers = channelsInWorkspace[i].ext_members; - for (let j = 0; j < extMembers.length; j++) { - if (extMembers[j] === member || extMembers[j] === CurrentUser.get().id) { - bothAreInChannel++; - if (bothAreInChannel >= 2) { - return true; - } - } - } - } - } } return false; } diff --git a/tdrive/frontend/src/app/features/workspaces/hooks/use-workspaces.ts b/tdrive/frontend/src/app/features/workspaces/hooks/use-workspaces.ts index c39cec53..bfadf90d 100644 --- a/tdrive/frontend/src/app/features/workspaces/hooks/use-workspaces.ts +++ b/tdrive/frontend/src/app/features/workspaces/hooks/use-workspaces.ts @@ -44,13 +44,6 @@ export const useWorkspacesCommons = (companyId = '') => { ); } - //Retro compatibility - workspaces?.forEach(w => { - Collections.get('workspaces').updateObject(_.cloneDeep(w)); - AccessRightsService.updateLevel(w.id, w.role as RightsOrNone); - }); - //End - return { workspaces, loading, refresh }; }; diff --git a/tdrive/frontend/src/app/features/workspaces/state/workspace-list.ts b/tdrive/frontend/src/app/features/workspaces/state/workspace-list.ts index 9a5b102e..fd29d9e8 100644 --- a/tdrive/frontend/src/app/features/workspaces/state/workspace-list.ts +++ b/tdrive/frontend/src/app/features/workspaces/state/workspace-list.ts @@ -22,9 +22,6 @@ export const WorkspaceListStateFamily = atomFamily({ ({ onSet }) => { onSet(workspaces => { workspacesCompanyMap[companyId] = workspaces; - workspaces.map(w => { - Collections.get('workspaces').updateObject(_.cloneDeep(w)); - }); }); }, ],