1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 17:33:18 +00:00

Encrypted repo do not support metadata (#6959)

* encrypted-repo-do-not-support-metadata

* remove useless

* encrypted repo detail image
This commit is contained in:
Michael An
2024-10-29 14:01:07 +08:00
committed by GitHub
parent 125b628584
commit c714726411
5 changed files with 50 additions and 22 deletions

View File

@@ -1,16 +1,14 @@
import React, { useCallback, useMemo, useState } from 'react';
import React, { useCallback, useMemo, useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import { gettext } from '../../utils/constants';
import TreeSection from '../tree-section';
import { MetadataStatusManagementDialog, MetadataFaceRecognitionDialog, MetadataTreeView, useMetadata } from '../../metadata';
import ExtensionPrompts from './extension-prompts';
import { seafileAPI } from '../../utils/seafile-api';
const DirViews = ({ userPerm, repoID, currentPath, currentRepoInfo }) => {
const enableMetadataManagement = useMemo(() => {
return window.app.pageOptions.enableMetadataManagement;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [window.app.pageOptions.enableMetadataManagement]);
const [enableMetadataManagement, setEnableMetadataManagement] = useState(false);
const [showMetadataStatusManagementDialog, setShowMetadataStatusManagementDialog] = useState(false);
const [showMetadataFaceRecognitionDialog, setShowMetadataFaceRecognitionDialog] = useState(false);
const { enableMetadata, updateEnableMetadata, enableFaceRecognition, updateEnableFaceRecognition, navigation } = useMetadata();
@@ -25,6 +23,16 @@ const DirViews = ({ userPerm, repoID, currentPath, currentRepoInfo }) => {
return operations;
}, [enableMetadataManagement, enableMetadata, currentRepoInfo]);
useEffect(() => {
seafileAPI.getRepoInfo(repoID).then(res => {
if (res.data.encrypted) {
setEnableMetadataManagement(false);
} else {
setEnableMetadataManagement(window.app.pageOptions.enableMetadataManagement);
}
});
}, [repoID]);
const moreOperationClick = useCallback((operationKey) => {
switch (operationKey) {
case 'extended-properties': {

View File

@@ -1,4 +1,4 @@
.detail-body .detail-image-thumbnail {
.detail-body .detail-image {
height: 144px;
width: 100%;
flex-shrink: 0;
@@ -9,7 +9,7 @@
overflow: hidden;
}
.detail-body .detail-image-thumbnail .thumbnail {
.detail-body .detail-image>img {
border: 0;
border-radius: 0;
float: none;

View File

@@ -79,11 +79,16 @@ class DirentDetails extends React.Component {
if (!dirent) return null;
const isImg = Utils.imageCheck(dirent.name);
if (!isImg) return null;
const { repoID, path } = this.props;
const bigIconUrl = `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForGrid}` + Utils.encodePath(`${path === '/' ? '' : path}/${dirent.name}`);
const { repoID, path, currentRepoInfo } = this.props;
let src = '';
if (currentRepoInfo.encrypted) {
src = `${siteRoot}repo/${repoID}/raw` + Utils.encodePath(`${path === '/' ? '' : path}/${dirent.name}`);
} else {
src = `${siteRoot}thumbnail/${repoID}/${thumbnailSizeForGrid}` + Utils.encodePath(`${path === '/' ? '' : path}/${dirent.name}`);
}
return (
<div className="detail-image-thumbnail">
<img src={bigIconUrl} alt="" className="thumbnail" />
<div className="detail-image">
<img src={src} alt="" />
</div>
);
};