Fix Bug 69217 - Files. Info. History. The folder from which the file was copied is incorrectly indicated in the history

This commit is contained in:
Elyor Djalilov 2024-07-23 13:48:55 +05:00
parent e28045cf58
commit 78d64b05cf
6 changed files with 48 additions and 14 deletions

View File

@ -10,13 +10,16 @@
"ExpectUsers": "Expect users",
"FeedLinkWasDeleted": "Link was deleted",
"FeedLocationLabel": "Folder «{{folderTitle}}»",
"FeedLocationLabelFrom": "from «{{folderTitle}}»",
"FeedLocationRoomLabel": "Room «{{folderTitle}}»",
"FileConverted": "File converted.",
"FileCopied": "Files copied.",
"FileCopiedTo": "Files copied to «{{folderTitle}}»",
"FileCreated": "File created.",
"FileDeleted": "Files removed.",
"FileExtension": "File extension",
"FileMoved": "Files moved.",
"FileMovedTo": "File moved to «{{folderTitle}}»",
"FileRenamed": "File renamed.",
"FilesEmptyScreenText": "See file and folder details here",
"FileUploaded": "Files added.",

View File

@ -122,7 +122,8 @@ const StyledHistoryBlockMessage = styled.div`
overflow: hidden;
}
.folder-label {
.folder-label,
.source-folder-label {
max-width: 100%;
color: ${(props) => props.theme.infoPanel.history.locationIconColor};
text-overflow: ellipsis;
@ -130,6 +131,10 @@ const StyledHistoryBlockMessage = styled.div`
overflow: hidden;
}
.source-folder-label {
color: ${(props) => props.theme.infoPanel.history.messageColor};
}
.old-role {
color: ${(props) => props.theme.infoPanel.history.oldRoleColor};
font-weight: 600;

View File

@ -40,24 +40,38 @@ const HistoryMainTextFolderInfo = ({
feed,
selectedFolderId,
}: HistoryMainTextFolderInfoProps) => {
if (
feed.data.parentId === selectedFolderId ||
feed.data.toFolderId === selectedFolderId
)
const {
parentId,
toFolderId,
parentTitle,
parentType,
fromParentType,
fromParentTitle,
} = feed.data;
if (parentId === selectedFolderId || toFolderId === selectedFolderId)
return null;
const destination =
feed.data.parentType === 0 || feed.data.toParentType === 0
? t("FeedLocationLabel", {
folderTitle: feed.data.parentTitle || feed.data.toFolderTitle,
})
: t("FeedLocationRoomLabel", {
folderTitle: feed.data.parentTitle || feed.data.toFolderTitle,
});
if (!parentTitle) return null;
const isParentType = parentType === 0;
const isFromParentType = fromParentType === 0;
const destination = isParentType
? t("FeedLocationRoomLabel", { folderTitle: parentTitle })
: t("FeedLocationLabel", { folderTitle: parentTitle });
const sourceDestination = isFromParentType
? t("FeedLocationLabelFrom", { folderTitle: fromParentTitle })
: t("FeedLocationRoomLabel", { folderTitle: parentTitle });
const className = !isFromParentType ? "folder-label" : "source-folder-label";
return (
<StyledHistoryBlockMessage className="message">
<span className="folder-label">{destination}</span>
<span className={className}>
{!isFromParentType ? destination : sourceDestination}
</span>
</StyledHistoryBlockMessage>
);
};

View File

@ -18,8 +18,18 @@ export const useFeedTranslation = (
case "FileRenamed":
return t("InfoPanel:FileRenamed");
case "FileMoved":
if (feed.data.fromParentTitle) {
return t("InfoPanel:FileMovedTo", {
folderTitle: feed.data.parentTitle,
});
}
return t("InfoPanel:FileMoved");
case "FileCopied":
if (feed.data.fromParentTitle) {
return t("InfoPanel:FileCopiedTo", {
folderTitle: feed.data.parentTitle,
});
}
return t("InfoPanel:FileCopied");
case "FileDeleted":
return t("InfoPanel:FileDeleted");

View File

@ -2110,6 +2110,7 @@ export const getBaseTheme = () => {
folderLabelColor: "#A3A9AE",
renamedItemColor: "#A3A9AE",
oldRoleColor: "#657077",
messageColor: "#333333",
},
details: {

View File

@ -2082,6 +2082,7 @@ const Dark: TTheme = {
folderLabelColor: "#A3A9AE",
renamedItemColor: "#A3A9AE",
oldRoleColor: "#A3A9AE",
messageColor: "#FFFFFF",
},
details: {