1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 09:51:26 +00:00

fix: reback

This commit is contained in:
杨国璇
2025-01-08 16:46:55 +08:00
parent d9c50d2568
commit 6133db43a0

View File

@@ -169,7 +169,10 @@ class LibContentView extends React.Component {
calculatePara = async (props) => { calculatePara = async (props) => {
const { repoID } = props; const { repoID } = props;
const path = this.getPathFromLocation(repoID); const { path, viewId, tagId } = this.getInfoFromLocation(repoID);
let currentMode = cookie.load('seafile_view_mode') || LIST_MODE;
if (viewId) currentMode = METADATA_MODE;
if (tagId) currentMode = TAGS_MODE;
try { try {
const repoInfo = await this.fetchRepoInfo(repoID); const repoInfo = await this.fetchRepoInfo(repoID);
@@ -181,8 +184,11 @@ class LibContentView extends React.Component {
repoName: repoInfo.repo_name, repoName: repoInfo.repo_name,
libNeedDecrypt: repoInfo.lib_need_decrypt, libNeedDecrypt: repoInfo.lib_need_decrypt,
repoEncrypted: repoInfo.encrypted, repoEncrypted: repoInfo.encrypted,
isGroupOwnedRepo: isGroupOwnedRepo, isGroupOwnedRepo,
path: path path,
viewId,
tagId,
currentMode,
}); });
if (this.state.isTreePanelShown) { if (this.state.isTreePanelShown) {
@@ -203,13 +209,13 @@ class LibContentView extends React.Component {
} }
}; };
getPathFromLocation = (repoID) => { getInfoFromLocation = (repoID) => {
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const viewID = urlParams.get('view'); const viewId = urlParams.get('view');
if (viewID) return `/${PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES}`; if (viewId) return { path: `/${PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES}`, viewId };
const tagID = urlParams.get('tag'); const tagId = urlParams.get('tag');
if (tagID) return `/${PRIVATE_FILE_TYPE.TAGS_PROPERTIES}`; if (tagId) return { path: `/${PRIVATE_FILE_TYPE.TAGS_PROPERTIES}`, tagId };
let location = window.location.href.split('?')[0]; let location = window.location.href.split('?')[0];
location = decodeURIComponent(location); location = decodeURIComponent(location);
@@ -218,7 +224,7 @@ class LibContentView extends React.Component {
if (path.length > 1 && path.endsWith('/')) { if (path.length > 1 && path.endsWith('/')) {
path = path.slice(0, -1); path = path.slice(0, -1);
} }
return path; return { path };
}; };
fetchRepoInfo = async (repoID) => { fetchRepoInfo = async (repoID) => {
@@ -520,9 +526,10 @@ class LibContentView extends React.Component {
hideMetadataView = (isSetRoot = false) => { hideMetadataView = (isSetRoot = false) => {
const { repoID } = this.props; const { repoID } = this.props;
const { path } = this.getInfoFromLocation(repoID);
this.setState({ this.setState({
currentMode: cookie.load('seafile_view_mode') || LIST_MODE, currentMode: cookie.load('seafile_view_mode') || LIST_MODE,
path: isSetRoot ? '/' : this.getPathFromLocation(repoID), path: isSetRoot ? '/' : path,
viewId: '', viewId: '',
tagId: '', tagId: '',
currentDirent: isSetRoot ? null : this.state.currentDirent, currentDirent: isSetRoot ? null : this.state.currentDirent,