Merge branch 'hotfix/v2.6.1' into bugfix/Bug69117
This commit is contained in:
commit
8b166810ed
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docspace",
|
||||
"version": "2.6.0",
|
||||
"version": "2.6.1",
|
||||
"private": true,
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/client",
|
||||
"version": "2.6.0",
|
||||
"version": "2.6.1",
|
||||
"private": true,
|
||||
"homepage": "",
|
||||
"scripts": {
|
||||
|
@ -34,7 +34,7 @@ import React, {
|
||||
import { observer, inject } from "mobx-react";
|
||||
import { withTranslation } from "react-i18next";
|
||||
|
||||
import { DeviceType } from "@docspace/shared/enums";
|
||||
import { DeviceType, EmployeeType } from "@docspace/shared/enums";
|
||||
import { LOADER_TIMEOUT } from "@docspace/shared/constants";
|
||||
|
||||
import { Backdrop } from "@docspace/shared/components/backdrop";
|
||||
@ -72,11 +72,6 @@ const InvitePanel = ({
|
||||
visible,
|
||||
setRoomSecurity,
|
||||
getRoomSecurityInfo,
|
||||
getPortalInviteLinks,
|
||||
userLink,
|
||||
guestLink,
|
||||
adminLink,
|
||||
collaboratorLink,
|
||||
defaultAccess,
|
||||
inviteUsers,
|
||||
setInfoPanelIsMobileHidden,
|
||||
@ -88,9 +83,7 @@ const InvitePanel = ({
|
||||
currentDeviceType,
|
||||
}) => {
|
||||
const [invitePanelIsLoding, setInvitePanelIsLoading] = useState(
|
||||
() =>
|
||||
((!userLink || !guestLink || !collaboratorLink) && !adminLink) ||
|
||||
roomId !== -1,
|
||||
roomId !== -1,
|
||||
);
|
||||
const [selectedRoom, setSelectedRoom] = useState(null);
|
||||
const [hasErrors, setHasErrors] = useState(false);
|
||||
@ -117,6 +110,33 @@ const InvitePanel = ({
|
||||
setExternalLinksVisible(visible);
|
||||
};
|
||||
|
||||
const accessModel = [
|
||||
{
|
||||
id: "user",
|
||||
title: "User",
|
||||
shareLink: "",
|
||||
access: EmployeeType.User,
|
||||
},
|
||||
{
|
||||
id: "guest",
|
||||
title: "Guest",
|
||||
shareLink: "",
|
||||
access: EmployeeType.Guest,
|
||||
},
|
||||
{
|
||||
id: "admin",
|
||||
title: "Admin",
|
||||
shareLink: "",
|
||||
access: EmployeeType.Admin,
|
||||
},
|
||||
{
|
||||
id: "collaborator",
|
||||
title: "Collaborator",
|
||||
shareLink: "",
|
||||
access: EmployeeType.Collaborator,
|
||||
},
|
||||
];
|
||||
|
||||
const selectRoom = () => {
|
||||
const room = folders.find((folder) => folder.id === roomId);
|
||||
|
||||
@ -167,40 +187,7 @@ const InvitePanel = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (roomId === -1) {
|
||||
if ((!userLink || !guestLink || !collaboratorLink) && !adminLink) {
|
||||
setInvitePanelIsLoading(true);
|
||||
getPortalInviteLinks().finally(() => {
|
||||
disableInvitePanelLoader();
|
||||
});
|
||||
}
|
||||
|
||||
setShareLinks([
|
||||
{
|
||||
id: "user",
|
||||
title: "User",
|
||||
shareLink: userLink,
|
||||
access: 1,
|
||||
},
|
||||
{
|
||||
id: "guest",
|
||||
title: "Guest",
|
||||
shareLink: guestLink,
|
||||
access: 2,
|
||||
},
|
||||
{
|
||||
id: "admin",
|
||||
title: "Admin",
|
||||
shareLink: adminLink,
|
||||
access: 3,
|
||||
},
|
||||
{
|
||||
id: "collaborator",
|
||||
title: "Collaborator",
|
||||
shareLink: collaboratorLink,
|
||||
access: 4,
|
||||
},
|
||||
]);
|
||||
|
||||
setShareLinks(accessModel);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -208,7 +195,7 @@ const InvitePanel = ({
|
||||
Promise.all([selectRoom(), getInfo()]).finally(() => {
|
||||
disableInvitePanelLoader(false);
|
||||
});
|
||||
}, [roomId, userLink, guestLink, adminLink, collaboratorLink]);
|
||||
}, [roomId]);
|
||||
|
||||
useEffect(() => {
|
||||
const hasErrors = inviteItems.some((item) => !!item.errors?.length);
|
||||
@ -487,14 +474,6 @@ export default inject(
|
||||
isRoomMembersPanelOpen,
|
||||
} = infoPanelStore;
|
||||
|
||||
const {
|
||||
getPortalInviteLinks,
|
||||
userLink,
|
||||
guestLink,
|
||||
adminLink,
|
||||
collaboratorLink,
|
||||
} = peopleStore.inviteLinksStore;
|
||||
|
||||
const {
|
||||
inviteItems,
|
||||
invitePanelOptions,
|
||||
@ -520,11 +499,6 @@ export default inject(
|
||||
visible: invitePanelOptions.visible,
|
||||
defaultAccess: invitePanelOptions.defaultAccess,
|
||||
getFolderInfo,
|
||||
getPortalInviteLinks,
|
||||
userLink,
|
||||
guestLink,
|
||||
adminLink,
|
||||
collaboratorLink,
|
||||
inviteUsers,
|
||||
setInfoPanelIsMobileHidden,
|
||||
updateInfoPanelMembers,
|
||||
|
@ -64,20 +64,26 @@ const ExternalLinks = ({
|
||||
setActiveLink,
|
||||
activeLink,
|
||||
isMobileView,
|
||||
getPortalInviteLink,
|
||||
}) => {
|
||||
const [actionLinksVisible, setActionLinksVisible] = useState(false);
|
||||
|
||||
const inputsRef = useRef();
|
||||
|
||||
const toggleLinks = () => {
|
||||
const toggleLinks = async (e) => {
|
||||
if (roomId === -1) {
|
||||
const link = shareLinks.find((l) => l.access === +defaultAccess);
|
||||
if (e?.target?.checked) {
|
||||
const link = shareLinks.find((l) => l.access === defaultAccess);
|
||||
|
||||
setActiveLink(link);
|
||||
copyLink(link.shareLink);
|
||||
link.shareLink = await getPortalInviteLink(defaultAccess);
|
||||
|
||||
setActiveLink(link);
|
||||
copyLink(link.shareLink);
|
||||
}
|
||||
} else {
|
||||
!externalLinksVisible ? editLink() : disableLink();
|
||||
}
|
||||
|
||||
onChangeExternalLinksVisible(!externalLinksVisible);
|
||||
};
|
||||
|
||||
@ -106,11 +112,13 @@ const ExternalLinks = ({
|
||||
setActiveLink(activeLink);
|
||||
};
|
||||
|
||||
const onSelectAccess = (access) => {
|
||||
const onSelectAccess = async (access) => {
|
||||
let link = null;
|
||||
if (roomId === -1) {
|
||||
link = shareLinks.find((l) => l.access === access.access);
|
||||
|
||||
link.shareLink = await getPortalInviteLink(access.access);
|
||||
|
||||
setActiveLink(link);
|
||||
} else {
|
||||
setInvitationLinks(roomId, "Invite", +access.access, shareLinks[0].id);
|
||||
@ -254,17 +262,21 @@ const ExternalLinks = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ userStore, dialogsStore, filesStore }) => {
|
||||
const { isOwner } = userStore.user;
|
||||
const { invitePanelOptions } = dialogsStore;
|
||||
const { setInvitationLinks } = filesStore;
|
||||
const { roomId, hideSelector, defaultAccess } = invitePanelOptions;
|
||||
export default inject(
|
||||
({ userStore, dialogsStore, filesStore, peopleStore }) => {
|
||||
const { isOwner } = userStore.user;
|
||||
const { invitePanelOptions } = dialogsStore;
|
||||
const { setInvitationLinks } = filesStore;
|
||||
const { roomId, hideSelector, defaultAccess } = invitePanelOptions;
|
||||
const { getPortalInviteLink } = peopleStore.inviteLinksStore;
|
||||
|
||||
return {
|
||||
setInvitationLinks,
|
||||
roomId,
|
||||
hideSelector,
|
||||
defaultAccess,
|
||||
isOwner,
|
||||
};
|
||||
})(observer(ExternalLinks));
|
||||
return {
|
||||
setInvitationLinks,
|
||||
roomId,
|
||||
hideSelector,
|
||||
defaultAccess,
|
||||
isOwner,
|
||||
getPortalInviteLink,
|
||||
};
|
||||
},
|
||||
)(observer(ExternalLinks));
|
||||
|
@ -24,7 +24,7 @@
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
import ClearActiveReactSvgUrl from "PUBLIC_DIR/images/clear.active.react.svg?url";
|
||||
import ClearReactSvgUrl from "PUBLIC_DIR/images/clear.react.svg?url";
|
||||
import ButtonCancelReactSvgUrl from "PUBLIC_DIR/images/button.cancel.react.svg?url";
|
||||
|
||||
import React from "react";
|
||||
@ -136,8 +136,8 @@ class UploadPanelComponent extends React.Component {
|
||||
<div>
|
||||
{uploaded && converted ? (
|
||||
<IconButton
|
||||
size="20"
|
||||
iconName={ClearActiveReactSvgUrl}
|
||||
size={17}
|
||||
iconName={ClearReactSvgUrl}
|
||||
isClickable
|
||||
onClick={this.clearUploadPanel}
|
||||
/>
|
||||
|
@ -259,6 +259,8 @@ const SectionHeaderContent = (props) => {
|
||||
};
|
||||
|
||||
const onContextOptionsClick = () => {
|
||||
if (isInsideGroup) return;
|
||||
|
||||
setBufferSelection(selectedFolder);
|
||||
};
|
||||
|
||||
|
@ -27,9 +27,12 @@
|
||||
import { makeAutoObservable, runInAction } from "mobx";
|
||||
import {
|
||||
getInvitationLinks,
|
||||
getInvitationLink,
|
||||
getShortenedLink,
|
||||
} from "@docspace/shared/api/portal";
|
||||
|
||||
import { EmployeeType } from "@docspace/shared/enums";
|
||||
|
||||
class InviteLinksStore {
|
||||
peopleStore = null;
|
||||
userLink = null;
|
||||
@ -59,9 +62,7 @@ class InviteLinksStore {
|
||||
};
|
||||
|
||||
getPortalInviteLinks = async () => {
|
||||
const isViewerAdmin = !this.peopleStore.authStore.isVisitor;
|
||||
|
||||
if (!isViewerAdmin) return Promise.resolve();
|
||||
if (this.peopleStore.authStore.isVisitor) return Promise.resolve();
|
||||
|
||||
const links = await getInvitationLinks();
|
||||
|
||||
@ -73,6 +74,31 @@ class InviteLinksStore {
|
||||
});
|
||||
};
|
||||
|
||||
getPortalInviteLink = async (type) => {
|
||||
if (this.peopleStore.authStore.isVisitor) return Promise.resolve();
|
||||
|
||||
const link = await getInvitationLink(type);
|
||||
|
||||
runInAction(() => {
|
||||
switch (type) {
|
||||
case EmployeeType.User:
|
||||
this.setUserLink(link);
|
||||
break;
|
||||
case EmployeeType.Guest:
|
||||
this.setGuestLink(link);
|
||||
break;
|
||||
case EmployeeType.Admin:
|
||||
this.setAdminLink(link);
|
||||
break;
|
||||
case EmployeeType.Collaborator:
|
||||
this.setCollaboratorLink(link);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
return link;
|
||||
};
|
||||
|
||||
getShortenedLink = async (link, forUser = false) => {
|
||||
if (forUser) {
|
||||
const userLink = await getShortenedLink(link);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/doceditor",
|
||||
"version": "2.6.0",
|
||||
"version": "2.6.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "node ./scripts/buildTranslations.js && next build",
|
||||
|
@ -393,28 +393,28 @@ export const checkIsAuthenticated = async () => {
|
||||
return isAuth.response as boolean;
|
||||
};
|
||||
|
||||
export async function checkFillFromDraft(
|
||||
templateFileId: number,
|
||||
share?: string,
|
||||
) {
|
||||
const [checkFillFormDraft] = createRequest(
|
||||
[`/files/masterform/${templateFileId}/checkfillformdraft`],
|
||||
[
|
||||
share ? ["Request-Token", share] : ["", ""],
|
||||
["Content-Type", "application/json;charset=utf-8"],
|
||||
],
|
||||
"POST",
|
||||
JSON.stringify({ fileId: templateFileId }),
|
||||
);
|
||||
// export async function checkFillFromDraft(
|
||||
// templateFileId: number,
|
||||
// share?: string,
|
||||
// ) {
|
||||
// const [checkFillFormDraft] = createRequest(
|
||||
// [`/files/masterform/${templateFileId}/checkfillformdraft`],
|
||||
// [
|
||||
// share ? ["Request-Token", share] : ["", ""],
|
||||
// ["Content-Type", "application/json;charset=utf-8"],
|
||||
// ],
|
||||
// "POST",
|
||||
// JSON.stringify({ fileId: templateFileId }),
|
||||
// );
|
||||
|
||||
const response = await fetch(checkFillFormDraft);
|
||||
// const response = await fetch(checkFillFormDraft);
|
||||
|
||||
if (!response.ok) return null;
|
||||
// if (!response.ok) return null;
|
||||
|
||||
const { response: formUrl } = await response.json();
|
||||
// const { response: formUrl } = await response.json();
|
||||
|
||||
return formUrl as string;
|
||||
}
|
||||
// return formUrl as string;
|
||||
// }
|
||||
|
||||
export async function openEdit(
|
||||
fileId: number | string,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/login",
|
||||
"version": "2.6.0",
|
||||
"version": "2.6.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "node ./scripts/buildTranslations.js && next build",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/management",
|
||||
"version": "2.6.0",
|
||||
"version": "2.6.1",
|
||||
"private": true,
|
||||
"homepage": "/management",
|
||||
"scripts": {
|
||||
|
@ -1180,15 +1180,15 @@ export async function getPresignedUri(fileId: number | string) {
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function checkFillFormDraft(fileId: number | string) {
|
||||
const res = (await request({
|
||||
method: "post",
|
||||
url: `files/masterform/${fileId}/checkfillformdraft`,
|
||||
data: { fileId },
|
||||
})) as string;
|
||||
// export async function checkFillFormDraft(fileId: number | string) {
|
||||
// const res = (await request({
|
||||
// method: "post",
|
||||
// url: `files/masterform/${fileId}/checkfillformdraft`,
|
||||
// data: { fileId },
|
||||
// })) as string;
|
||||
|
||||
return res;
|
||||
}
|
||||
// return res;
|
||||
// }
|
||||
|
||||
export async function fileCopyAs(
|
||||
fileId: number,
|
||||
|
@ -35,7 +35,7 @@ import {
|
||||
TTenantExtra,
|
||||
} from "./types";
|
||||
|
||||
export function getShortenedLink(link) {
|
||||
export function getShortenedLink(link: string) {
|
||||
return request({
|
||||
method: "put",
|
||||
url: "/portal/getshortenlink",
|
||||
@ -43,13 +43,13 @@ export function getShortenedLink(link) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getInvitationLink(type) {
|
||||
return request({
|
||||
export async function getInvitationLink(type: EmployeeType) {
|
||||
const res = await request({
|
||||
method: "get",
|
||||
url: `/portal/users/invite/${type}`,
|
||||
}).then((link) => {
|
||||
return Promise.resolve(link);
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export function getInvitationLinks() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/shared",
|
||||
"version": "2.6.0",
|
||||
"version": "2.6.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "echo 'skip it'",
|
||||
|
@ -34,7 +34,7 @@
|
||||
IE: 11,
|
||||
Edge: 109,
|
||||
Opera: 90,
|
||||
Safari: 16,
|
||||
Safari: 15,
|
||||
SafariMobile: 16,
|
||||
AscDesktopEditor: 6,
|
||||
SamsungBrowser: 4,
|
||||
@ -50,7 +50,7 @@
|
||||
let temp = [];
|
||||
let match =
|
||||
agent.match(
|
||||
/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i,
|
||||
/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i
|
||||
) || [];
|
||||
|
||||
if (/trident/i.test(match[1])) {
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
if (match[1] === "Chrome") {
|
||||
temp = agent.match(
|
||||
/\b(OPR|Edge|AscDesktopEditor|SamsungBrowser|UCBrowser)\/(\d+.\d)/,
|
||||
/\b(OPR|Edge|AscDesktopEditor|SamsungBrowser|UCBrowser)\/(\d+.\d)/
|
||||
);
|
||||
|
||||
const userOS =
|
||||
|
Loading…
Reference in New Issue
Block a user