Client:InfoPanel:History: Fixed Bug 68964

This commit is contained in:
Akmal Isomadinov 2024-07-03 19:42:57 +05:00
parent b5431a653e
commit 4d0d221397
3 changed files with 41 additions and 11 deletions

View File

@ -74,6 +74,7 @@
"@babel/preset-typescript": "^7.21.0", "@babel/preset-typescript": "^7.21.0",
"@svgr/webpack": "^5.5.0", "@svgr/webpack": "^5.5.0",
"@types/eslint": "^8.44.7", "@types/eslint": "^8.44.7",
"@types/he": "^1.2.3",
"@typescript-eslint/eslint-plugin": "^6.12.0", "@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0", "@typescript-eslint/parser": "^6.12.0",
"babel-loader": "^8.3.0", "babel-loader": "^8.3.0",

View File

@ -25,17 +25,28 @@
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import { StyledHistoryLink } from "../../../styles/history";
import { ActionByTarget } from "../FeedInfo";
import { decode } from "he"; import { decode } from "he";
import { Link } from "@docspace/shared/components/link"; import { Link } from "@docspace/shared/components/link";
import { toastr } from "@docspace/shared/components/toast"; import { toastr } from "@docspace/shared/components/toast";
import { withTranslation } from "react-i18next"; import { withTranslation } from "react-i18next";
import { Text } from "@docspace/shared/components/text"; import { Text } from "@docspace/shared/components/text";
import { RoomsType } from "@docspace/shared/enums";
import { Nullable } from "@docspace/shared/types";
interface HistoryRoomExternalLinkProps { import { ActionByTarget } from "../FeedInfo";
import { StyledHistoryLink } from "../../../styles/history";
interface HistoryRoomExternalLinkProps
extends Partial<
Pick<TStore["dialogsStore"], "setLinkParams" | "setEditLinkPanelIsVisible">
> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
feed: any; feed: any;
actionType: ActionByTarget<"roomTag">; actionType: ActionByTarget<"roomTag">;
isFormRoom?: boolean;
canEditLink?: boolean;
t?: (str: string) => string;
} }
const HistoryRoomExternalLink = ({ const HistoryRoomExternalLink = ({
@ -45,15 +56,16 @@ const HistoryRoomExternalLink = ({
canEditLink, canEditLink,
setEditLinkPanelIsVisible, setEditLinkPanelIsVisible,
setLinkParams, setLinkParams,
isFormRoom,
}: HistoryRoomExternalLinkProps) => { }: HistoryRoomExternalLinkProps) => {
const onEditLink = () => { const onEditLink = () => {
if (!feed.data.sharedTo) { if (!feed.data.sharedTo) {
toastr.error(t("FeedLinkWasDeleted")); toastr.error(t!("FeedLinkWasDeleted"));
return; return;
} }
setLinkParams({ isEdit: true, link: feed.data }); setLinkParams!({ isEdit: true, link: feed.data, isFormRoom });
setEditLinkPanelIsVisible(true); setEditLinkPanelIsVisible!(true);
}; };
if (actionType === "create") if (actionType === "create")
@ -72,8 +84,17 @@ const HistoryRoomExternalLink = ({
); );
}; };
export default inject(({ userStore, dialogsStore }) => ({ export default inject<TStore>(
canEditLink: !(userStore.user.isVisitor || userStore.user.isCollaborator), ({ userStore, dialogsStore, infoPanelStore }) => ({
setEditLinkPanelIsVisible: dialogsStore.setEditLinkPanelIsVisible, canEditLink: !(userStore.user?.isVisitor || userStore.user?.isCollaborator),
setLinkParams: dialogsStore.setLinkParams, setEditLinkPanelIsVisible: dialogsStore.setEditLinkPanelIsVisible,
}))(withTranslation(["InfoPanel"])(observer(HistoryRoomExternalLink))); setLinkParams: dialogsStore.setLinkParams,
isFormRoom:
(
infoPanelStore.infoPanelSelection as unknown as Record<
string,
Nullable<unknown>
>
)?.roomType === RoomsType.FormRoom,
}),
)(withTranslation(["InfoPanel"])(observer(HistoryRoomExternalLink)));

View File

@ -2581,6 +2581,7 @@ __metadata:
"@codemirror/lang-javascript": "npm:^6.2.2" "@codemirror/lang-javascript": "npm:^6.2.2"
"@svgr/webpack": "npm:^5.5.0" "@svgr/webpack": "npm:^5.5.0"
"@types/eslint": "npm:^8.44.7" "@types/eslint": "npm:^8.44.7"
"@types/he": "npm:^1.2.3"
"@typescript-eslint/eslint-plugin": "npm:^6.12.0" "@typescript-eslint/eslint-plugin": "npm:^6.12.0"
"@typescript-eslint/parser": "npm:^6.12.0" "@typescript-eslint/parser": "npm:^6.12.0"
"@uiw/codemirror-theme-github": "npm:^4.21.25" "@uiw/codemirror-theme-github": "npm:^4.21.25"
@ -7756,6 +7757,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/he@npm:^1.2.3":
version: 1.2.3
resolution: "@types/he@npm:1.2.3"
checksum: 10/e77851c73dd7b9902d92fe0118a26246a7f3676a3a1c6eb1408305187ef73b57c22550b1435946b983267f961d935554d5d0e1b458416932552f31e763e1aa41
languageName: node
linkType: hard
"@types/hoist-non-react-statics@npm:*": "@types/hoist-non-react-statics@npm:*":
version: 3.3.5 version: 3.3.5
resolution: "@types/hoist-non-react-statics@npm:3.3.5" resolution: "@types/hoist-non-react-statics@npm:3.3.5"