mirror of
https://github.com/haiwen/seahub.git
synced 2025-04-27 19:05:16 +00:00
check tags status before initialize repo tags (#7711)
Co-authored-by: zhouwenxuan <aries@Mac.local>
This commit is contained in:
parent
dfa86ebc45
commit
641eb1fca5
@ -7,7 +7,7 @@ import { MetadataAIOperationsProvider } from './metadata-ai-operation';
|
||||
// This hook provides content related to seahub interaction, such as whether to enable extended attributes
|
||||
const MetadataStatusContext = React.createContext(null);
|
||||
|
||||
export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, children }) => {
|
||||
export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, updateUsedRepoTags, clearRepoTags, children }) => {
|
||||
const enableMetadataManagement = useMemo(() => {
|
||||
if (repoInfo?.encrypted) return false;
|
||||
return window.app.pageOptions.enableMetadataManagement;
|
||||
@ -60,6 +60,9 @@ export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, chi
|
||||
if (!enableMetadata) {
|
||||
cancelMetadataURL();
|
||||
}
|
||||
if (enableTags) {
|
||||
updateUsedRepoTags();
|
||||
}
|
||||
setEnableTags(enableTags);
|
||||
setTagsLang(tagsLang || 'en');
|
||||
setDetailsSettings(JSON.parse(detailsSettings));
|
||||
@ -93,10 +96,12 @@ export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, chi
|
||||
if (newValue === enableTags && lang === tagsLang) return;
|
||||
if (!newValue) {
|
||||
cancelMetadataURL(true);
|
||||
clearRepoTags();
|
||||
}
|
||||
setEnableTags(newValue);
|
||||
if (newValue) updateUsedRepoTags();
|
||||
setTagsLang(lang);
|
||||
}, [enableTags, tagsLang, cancelMetadataURL]);
|
||||
}, [enableTags, tagsLang, cancelMetadataURL, clearRepoTags, updateUsedRepoTags]);
|
||||
|
||||
const updateEnableOCR = useCallback((newValue) => {
|
||||
if (newValue === enableOCR) return;
|
||||
|
@ -420,6 +420,14 @@ class LibContentView extends React.Component {
|
||||
});
|
||||
};
|
||||
|
||||
clearRepoTags = () => {
|
||||
this.setState({
|
||||
fileTags: [],
|
||||
repoTags: [],
|
||||
usedRepoTags: [],
|
||||
});
|
||||
};
|
||||
|
||||
updateColumnMarkdownData = (filePath) => {
|
||||
let repoID = this.props.repoID;
|
||||
// update state
|
||||
@ -454,9 +462,6 @@ class LibContentView extends React.Component {
|
||||
|
||||
// load data
|
||||
loadDirData = (path) => {
|
||||
// list used FileTags
|
||||
this.updateUsedRepoTags();
|
||||
|
||||
if (this.state.isTreePanelShown) {
|
||||
this.loadSidePanel(path);
|
||||
}
|
||||
@ -2315,7 +2320,7 @@ class LibContentView extends React.Component {
|
||||
}
|
||||
const detailDirent = currentDirent || currentNode?.object || null;
|
||||
return (
|
||||
<MetadataStatusProvider repoID={repoID} repoInfo={currentRepoInfo} hideMetadataView={this.hideMetadataView}>
|
||||
<MetadataStatusProvider repoID={repoID} repoInfo={currentRepoInfo} hideMetadataView={this.hideMetadataView} updateUsedRepoTags={this.updateUsedRepoTags} clearRepoTags={this.clearRepoTags} >
|
||||
<TagsProvider repoID={repoID} currentPath={path} repoInfo={currentRepoInfo} selectTagsView={this.onTreeNodeClick} >
|
||||
<MetadataProvider repoID={repoID} currentPath={path} repoInfo={currentRepoInfo} selectMetadataView={this.onTreeNodeClick} >
|
||||
<CollaboratorsProvider repoID={repoID}>
|
||||
|
Loading…
Reference in New Issue
Block a user