Merge branch 'hotfix/v2.5.1' into bugfix/campaigns-banner
This commit is contained in:
commit
58f0a4509f
@ -33,11 +33,15 @@ import {
|
||||
ShareAccessRights,
|
||||
} from "@docspace/shared/enums";
|
||||
//import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||
import { getCorrectDate, getCookie } from "@docspace/shared/utils";
|
||||
import {
|
||||
getCorrectDate,
|
||||
getCookie,
|
||||
getTitleWithoutExtension,
|
||||
} from "@docspace/shared/utils";
|
||||
import { LANGUAGE } from "@docspace/shared/constants";
|
||||
import config from "PACKAGE_FILE";
|
||||
//import EditingWrapperComponent from "../components/EditingWrapperComponent";
|
||||
import { getTitleWithoutExtension } from "SRC_DIR/helpers/filesUtils";
|
||||
|
||||
//import { getDefaultFileName } from "@docspace/client/src/helpers/filesUtils";
|
||||
//import ItemIcon from "../components/ItemIcon";
|
||||
|
||||
|
@ -34,10 +34,10 @@ import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||
import { setEncryptionAccess } from "SRC_DIR/helpers/desktop";
|
||||
import config from "PACKAGE_FILE";
|
||||
|
||||
import { getTitleWithoutExtension } from "SRC_DIR/helpers/filesUtils";
|
||||
import { getDefaultFileName } from "@docspace/client/src/helpers/filesUtils";
|
||||
|
||||
import Dialog from "./sub-components/Dialog";
|
||||
import { getTitleWithoutExtension } from "@docspace/shared/utils";
|
||||
|
||||
const CreateEvent = ({
|
||||
id,
|
||||
|
@ -29,7 +29,7 @@ import { inject, observer } from "mobx-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
import Dialog from "./sub-components/Dialog";
|
||||
import { getTitleWithoutExtension } from "SRC_DIR/helpers/filesUtils";
|
||||
import { getTitleWithoutExtension } from "@docspace/shared/utils";
|
||||
|
||||
const RenameEvent = ({
|
||||
type,
|
||||
|
@ -226,10 +226,3 @@ export const connectedCloudsTypeIcon = (key) => {
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
export const getTitleWithoutExtension = (item, fromTemplate) => {
|
||||
const titleWithoutExst = item.title.split(".").slice(0, -1).join(".");
|
||||
return titleWithoutExst && item.fileExst && !fromTemplate
|
||||
? titleWithoutExst
|
||||
: item.title;
|
||||
};
|
||||
|
@ -81,6 +81,7 @@ const RoomsItemHeader = ({
|
||||
};
|
||||
|
||||
const onClickInviteUsers = () => {
|
||||
onSelectItem();
|
||||
setIsMobileHidden(true);
|
||||
const parentRoomId = infoPanelSelection.id;
|
||||
|
||||
|
@ -85,7 +85,7 @@ const Sdk = ({
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (window.parent && !frameConfig && isLoaded) {
|
||||
if (window.parent && !frameConfig?.frameId && isLoaded) {
|
||||
callCommand("setConfig");
|
||||
}
|
||||
}, [callCommand, isLoaded]);
|
||||
@ -101,16 +101,6 @@ const Sdk = ({
|
||||
"selectorType",
|
||||
);
|
||||
|
||||
const toRelativeUrl = (data) => {
|
||||
try {
|
||||
const url = new URL(data);
|
||||
const rel = url.toString().substring(url.origin.length);
|
||||
return rel;
|
||||
} catch {
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
const handleMessage = async (e) => {
|
||||
const eventData = typeof e.data === "string" ? JSON.parse(e.data) : e.data;
|
||||
|
||||
@ -170,10 +160,10 @@ const Sdk = ({
|
||||
|
||||
const onSelectRoom = useCallback(
|
||||
async (data) => {
|
||||
if (data[0].logo?.large !== "") {
|
||||
data[0].icon = toRelativeUrl(data[0].logo?.large);
|
||||
} else {
|
||||
if (data[0].icon === "") {
|
||||
data[0].icon = await getRoomsIcon(data[0].roomType, false, 32);
|
||||
} else {
|
||||
data[0].icon = data[0].iconOriginal;
|
||||
}
|
||||
|
||||
if (
|
||||
@ -222,14 +212,10 @@ const Sdk = ({
|
||||
frameCallEvent({ event: "onCloseCallback" });
|
||||
}, [frameCallEvent]);
|
||||
|
||||
const onCloseCallback = !!frameConfig?.events.onCloseCallback
|
||||
? {
|
||||
onClose,
|
||||
}
|
||||
: {};
|
||||
|
||||
let component;
|
||||
|
||||
if (!frameConfig) return;
|
||||
|
||||
switch (mode) {
|
||||
case "room-selector":
|
||||
const cancelButtonProps = frameConfig?.showSelectorCancel
|
||||
|
@ -1210,7 +1210,7 @@ class FilesActionStore {
|
||||
setSelectedFolder(roomsFolder);
|
||||
}
|
||||
|
||||
this.updateCurrentFolder(null, null, null, operationId);
|
||||
// this.updateCurrentFolder(null, null, null, operationId);
|
||||
})
|
||||
|
||||
.then(() => {
|
||||
@ -1263,7 +1263,7 @@ class FilesActionStore {
|
||||
|
||||
await this.uploadDataStore.loopFilesOperations(data, pbData);
|
||||
|
||||
this.updateCurrentFolder(null, [items], null, operationId);
|
||||
// this.updateCurrentFolder(null, [items], null, operationId);
|
||||
})
|
||||
|
||||
.then(() => {
|
||||
@ -2626,14 +2626,8 @@ class FilesActionStore {
|
||||
};
|
||||
|
||||
onLeaveRoom = (t, isOwner = false) => {
|
||||
const {
|
||||
updateRoomMemberRole,
|
||||
removeFiles,
|
||||
folders,
|
||||
setFolders,
|
||||
selection,
|
||||
bufferSelection,
|
||||
} = this.filesStore;
|
||||
const { updateRoomMemberRole, removeFiles, selection, bufferSelection } =
|
||||
this.filesStore;
|
||||
const { user } = this.userStore;
|
||||
|
||||
const roomId = selection.length
|
||||
@ -2661,12 +2655,7 @@ class FilesActionStore {
|
||||
if (!isRoot) {
|
||||
this.selectedFolderStore.setInRoom(false);
|
||||
} else {
|
||||
const newFolders = folders;
|
||||
const folderIndex = newFolders.findIndex((r) => r.id === roomId);
|
||||
if (folderIndex > -1) {
|
||||
newFolders[folderIndex].inRoom = false;
|
||||
setFolders(newFolders);
|
||||
}
|
||||
this.filesStore.setInRoomFolder(roomId, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4170,6 +4170,31 @@ class FilesStore {
|
||||
this.selectedFolderStore.setNavigationPath(navigationPath);
|
||||
};
|
||||
|
||||
setInRoomFolder = (roomId, inRoom) => {
|
||||
const newFolders = this.folders;
|
||||
const folderIndex = newFolders.findIndex((r) => r.id === roomId);
|
||||
|
||||
const isRoot = this.selectedFolderStore.isRootFolder;
|
||||
|
||||
if (!isRoot) {
|
||||
this.selectedFolderStore.setInRoom(true);
|
||||
} else {
|
||||
if (folderIndex > -1) {
|
||||
newFolders[folderIndex].inRoom = inRoom;
|
||||
this.setFolders(newFolders);
|
||||
|
||||
if (
|
||||
this.bufferSelection &&
|
||||
this.bufferSelection.id === newFolders[folderIndex].id
|
||||
) {
|
||||
const newBufferSelection = { ...this.bufferSelection };
|
||||
newBufferSelection.inRoom = inRoom;
|
||||
this.setBufferSelection(newBufferSelection);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
get isFiltered() {
|
||||
const { isRoomsFolder, isArchiveFolder } = this.treeFoldersStore;
|
||||
|
||||
|
@ -674,6 +674,7 @@ class InfoPanelStore {
|
||||
mergedMembers.groups,
|
||||
);
|
||||
|
||||
this.filesStore.setInRoomFolder(roomId, true);
|
||||
this.setInfoPanelMembers(mergedMembers);
|
||||
}
|
||||
};
|
||||
|
@ -163,7 +163,9 @@ export async function getFolder(
|
||||
signal,
|
||||
};
|
||||
|
||||
const res = (await request(options)) as TGetFolder;
|
||||
const skipRedirect = true;
|
||||
|
||||
const res = (await request(options, skipRedirect)) as TGetFolder;
|
||||
|
||||
res.files = decodeDisplayName(res.files);
|
||||
res.folders = decodeDisplayName(res.folders);
|
||||
|
@ -391,24 +391,27 @@ export type FooterProps = TSelectorFooterSubmitButton &
|
||||
|
||||
type TSelectorItemLogo =
|
||||
| {
|
||||
color?: undefined;
|
||||
icon?: undefined;
|
||||
avatar: string;
|
||||
role?: AvatarRole;
|
||||
color?: undefined;
|
||||
hasAvatar?: boolean;
|
||||
icon?: undefined;
|
||||
iconOriginal?: string;
|
||||
role?: AvatarRole;
|
||||
}
|
||||
| {
|
||||
hasAvatar?: undefined;
|
||||
color: string;
|
||||
icon?: undefined;
|
||||
avatar?: undefined;
|
||||
color: string;
|
||||
hasAvatar?: undefined;
|
||||
icon?: undefined;
|
||||
iconOriginal?: string;
|
||||
role?: undefined;
|
||||
}
|
||||
| {
|
||||
hasAvatar?: undefined;
|
||||
color?: undefined;
|
||||
icon: string;
|
||||
avatar?: undefined;
|
||||
color?: undefined;
|
||||
hasAvatar?: undefined;
|
||||
icon: string;
|
||||
iconOriginal: string;
|
||||
role?: undefined;
|
||||
};
|
||||
|
||||
|
@ -30,6 +30,7 @@ import { TRoom } from "../../api/rooms/types";
|
||||
import { getIconPathByFolderType } from "../../utils/common";
|
||||
import { iconSize32 } from "../../utils/image-helpers";
|
||||
import { DEFAULT_FILE_EXTS } from "./FilesSelector.constants";
|
||||
import { getTitleWithoutExtension } from "../../utils";
|
||||
|
||||
export const convertFoldersToItems: (
|
||||
folders: TFolder[],
|
||||
@ -87,7 +88,7 @@ export const convertFilesToItems: (
|
||||
const { id, title, security, folderId, rootFolderType, fileExst } = file;
|
||||
|
||||
const icon = getIcon(fileExst || DEFAULT_FILE_EXTS);
|
||||
const label = title.replace(fileExst, "") || fileExst;
|
||||
const label = getTitleWithoutExtension(file, false);
|
||||
|
||||
return {
|
||||
id,
|
||||
|
@ -142,7 +142,7 @@ const useFilesHelper = ({
|
||||
}
|
||||
}
|
||||
|
||||
const id = isUserOnly ? "@my" : selectedItemId || "";
|
||||
const id = selectedItemId ?? (isUserOnly ? "@my" : "");
|
||||
|
||||
filter.folder = id.toString();
|
||||
|
||||
|
@ -403,6 +403,7 @@ const FilesSelector = ({
|
||||
|
||||
const onClearSearchAction = React.useCallback(
|
||||
(callback?: Function) => {
|
||||
if (!searchValue) return;
|
||||
setIsFirstLoad(true);
|
||||
setItems([]);
|
||||
|
||||
@ -411,7 +412,7 @@ const FilesSelector = ({
|
||||
callback?.();
|
||||
afterSearch.current = true;
|
||||
},
|
||||
[setIsFirstLoad],
|
||||
[searchValue, setIsFirstLoad],
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
|
@ -31,9 +31,10 @@ export const convertToItems = (folders: TRoom[]) => {
|
||||
const { id, title, roomType, logo, shared } = folder;
|
||||
|
||||
const icon = logo.medium;
|
||||
const iconOriginal = logo.original;
|
||||
const color = logo.color;
|
||||
|
||||
return { id, label: title, icon, color, roomType, shared };
|
||||
return { id, label: title, icon, iconOriginal, color, roomType, shared };
|
||||
});
|
||||
|
||||
return items;
|
||||
|
@ -76,6 +76,7 @@ import {
|
||||
getLogoUrl,
|
||||
} from "./common";
|
||||
import { DeviceType } from "../enums";
|
||||
import { TFile } from "../api/files/types";
|
||||
|
||||
export {
|
||||
isBetaLanguage,
|
||||
@ -153,3 +154,13 @@ export const getDeviceTypeByWidth = (width: number): DeviceType => {
|
||||
|
||||
return DeviceType.desktop;
|
||||
};
|
||||
|
||||
export const getTitleWithoutExtension = (
|
||||
item: TFile,
|
||||
fromTemplate: boolean,
|
||||
) => {
|
||||
const titleWithoutExst = item.title.split(".").slice(0, -1).join(".");
|
||||
return titleWithoutExst && item.fileExst && !fromTemplate
|
||||
? titleWithoutExst
|
||||
: item.title;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user