From 6c49efe50039a78b95c9e9964d95274aeb8b282c Mon Sep 17 00:00:00 2001 From: lian Date: Thu, 10 Oct 2019 15:11:24 +0800 Subject: [PATCH 1/3] return salt info when get repo list (#4134) --- seahub/api2/endpoints/repos.py | 4 ++++ seahub/api2/views.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/seahub/api2/endpoints/repos.py b/seahub/api2/endpoints/repos.py index a80a49fe35..330c49fde7 100644 --- a/seahub/api2/endpoints/repos.py +++ b/seahub/api2/endpoints/repos.py @@ -120,6 +120,7 @@ class ReposView(APIView): "permission": 'rw', # Always have read-write permission to owned repo "starred": r.repo_id in starred_repo_id_list, "status": normalize_repo_status_code(r.status), + "salt": r.salt if r.enc_version == 3 else '', } if is_pro_version() and ENABLE_STORAGE_CLASSES: @@ -182,6 +183,7 @@ class ReposView(APIView): "permission": r.permission, "starred": r.repo_id in starred_repo_id_list, "status": normalize_repo_status_code(r.status), + "salt": r.salt if r.enc_version == 3 else '', } if r.repo_id in repos_with_admin_share_to: @@ -225,6 +227,7 @@ class ReposView(APIView): "permission": r.permission, "starred": r.repo_id in starred_repo_id_list, "status": normalize_repo_status_code(r.status), + "salt": r.salt if r.enc_version == 3 else '', } repo_info_list.append(repo_info) @@ -269,6 +272,7 @@ class ReposView(APIView): "permission": r.permission, "starred": r.repo_id in starred_repo_id_list, "status": normalize_repo_status_code(r.status), + "salt": r.salt if r.enc_version == 3 else '', } repo_info_list.append(repo_info) diff --git a/seahub/api2/views.py b/seahub/api2/views.py index 2ec69fcbea..df1d0cc80b 100644 --- a/seahub/api2/views.py +++ b/seahub/api2/views.py @@ -734,6 +734,7 @@ class Repos(APIView): "root": '', "head_commit_id": r.head_cmmt_id, "version": r.version, + "salt": r.salt if r.enc_version == 3 else '', } if is_pro_version() and ENABLE_STORAGE_CLASSES: @@ -802,6 +803,7 @@ class Repos(APIView): "head_commit_id": r.head_cmmt_id, "version": r.version, "group_name": library_group_name, + "salt": r.salt if r.enc_version == 3 else '', } if r.repo_id in repos_with_admin_share_to: @@ -859,6 +861,7 @@ class Repos(APIView): "share_from": r.user, "share_from_name": nickname_dict.get(r.user, ''), "share_from_contact_email": contact_email_dict.get(r.user, ''), + "salt": r.salt if r.enc_version == 3 else '', } repos_json.append(repo) @@ -899,6 +902,7 @@ class Repos(APIView): "root": '', "head_commit_id": r.head_cmmt_id, "version": r.version, + "salt": r.salt if r.enc_version == 3 else '', } repos_json.append(repo) From aa679fb3c29a8f734a1523f348ceb8b6f6be54d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=81=A5=E8=BE=89?= Date: Thu, 10 Oct 2019 17:53:28 +0800 Subject: [PATCH 2/3] fix file history (#4135) --- frontend/src/file-history-old.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/file-history-old.js b/frontend/src/file-history-old.js index 4fd0155c08..757f2ef761 100644 --- a/frontend/src/file-history-old.js +++ b/frontend/src/file-history-old.js @@ -68,7 +68,10 @@ class FileHistory extends React.Component { if (result.total_count < 5) { if (result.data.length) { let commitID = result.data[result.data.length-1].commit_id; - seafileAPI.listOldFileHistoryRecords(historyRepoID, filePath, commitID).then((res) => { + let path = result.data[result.data.length-1].path; + let oldPath = result.data[result.data.length-1].old_path; + path = oldPath ? oldPath : path; + seafileAPI.listOldFileHistoryRecords(historyRepoID, path, commitID).then((res) => { if (!res.data) { this.setState({isLoading: false}); throw Error('There is an error in server.'); From 355905ac4ca9b042039cfc2a2dd0707522f9bf25 Mon Sep 17 00:00:00 2001 From: llj Date: Fri, 11 Oct 2019 14:40:23 +0800 Subject: [PATCH 3/3] [shared dir view] fixup for 'current path' (#4141) --- frontend/src/shared-dir-view.js | 20 ++++++-------------- seahub/templates/view_shared_dir_react.html | 10 ++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/frontend/src/shared-dir-view.js b/frontend/src/shared-dir-view.js index 22045a4d42..0026665f0a 100644 --- a/frontend/src/shared-dir-view.js +++ b/frontend/src/shared-dir-view.js @@ -16,7 +16,7 @@ import './css/shared-dir-view.css'; import './css/grid-view.css'; let loginUser = window.app.pageOptions.name; -const { token, trafficOverLimit, dirName, sharedBy, path, canDownload, mode, thumbnailSize } = window.shared.pageOptions; +const { token, trafficOverLimit, dirName, sharedBy, path, canDownload, mode, thumbnailSize, zipped } = window.shared.pageOptions; const showDownloadIcon = !trafficOverLimit && canDownload; @@ -93,28 +93,20 @@ class SharedDirView extends React.Component { } renderPath = () => { - // path: '/', or '/g/' - if (path == '/') { - return dirName; - } - - let pathList = path.substr(0, path.length -1).split('/'); return ( - {dirName} - / - {pathList.map((item, index) => { - if (index > 0 && index != pathList.length - 1) { + {zipped.map((item, index) => { + if (index != zipped.length - 1) { return ( - {pathList[index]} + {item.name} / ); } + }) } - )} - {pathList[pathList.length - 1]} + {zipped[zipped.length - 1].name} ); } diff --git a/seahub/templates/view_shared_dir_react.html b/seahub/templates/view_shared_dir_react.html index 5817fa2c1a..c7c27fb2c1 100644 --- a/seahub/templates/view_shared_dir_react.html +++ b/seahub/templates/view_shared_dir_react.html @@ -22,6 +22,16 @@ dirName: '{{ dir_name|escapejs }}', sharedBy: '{{ username|email2nickname|escapejs }}', path: '{{ path|escapejs }}', + zipped: (function() { + var list = []; + {% for name, path in zipped %} + list.push({ + 'name': '{{ name|escapejs }}', + 'path': '{{ path|escapejs }}' + }); + {% endfor %} + return list; + })(), token: '{{ token }}', mode: '{{ mode }}', thumbnailSize: {{ thumbnail_size }},