1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-22 11:57:34 +00:00

Merge branch '7.0'

This commit is contained in:
plt
2019-10-11 20:11:18 +08:00
5 changed files with 28 additions and 15 deletions

View File

@@ -68,7 +68,10 @@ class FileHistory extends React.Component {
if (result.total_count < 5) { if (result.total_count < 5) {
if (result.data.length) { if (result.data.length) {
let commitID = result.data[result.data.length-1].commit_id; 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) { if (!res.data) {
this.setState({isLoading: false}); this.setState({isLoading: false});
throw Error('There is an error in server.'); throw Error('There is an error in server.');

View File

@@ -16,7 +16,7 @@ import './css/shared-dir-view.css';
import './css/grid-view.css'; import './css/grid-view.css';
let loginUser = window.app.pageOptions.name; 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; const showDownloadIcon = !trafficOverLimit && canDownload;
@@ -93,28 +93,20 @@ class SharedDirView extends React.Component {
} }
renderPath = () => { renderPath = () => {
// path: '/', or '/g/'
if (path == '/') {
return dirName;
}
let pathList = path.substr(0, path.length -1).split('/');
return ( return (
<React.Fragment> <React.Fragment>
<a href={`?p=${encodeURIComponent('/')}&mode=${mode}`}>{dirName}</a> {zipped.map((item, index) => {
<span> / </span> if (index != zipped.length - 1) {
{pathList.map((item, index) => {
if (index > 0 && index != pathList.length - 1) {
return ( return (
<React.Fragment key={index}> <React.Fragment key={index}>
<a href={`?p=${encodeURIComponent(pathList.slice(0, index+1).join('/'))}&mode=${mode}`}>{pathList[index]}</a> <a href={`?p=${encodeURIComponent(item.path)}&mode=${mode}`}>{item.name}</a>
<span> / </span> <span> / </span>
</React.Fragment> </React.Fragment>
); );
} }
})
} }
)} {zipped[zipped.length - 1].name}
{pathList[pathList.length - 1]}
</React.Fragment> </React.Fragment>
); );
} }

View File

@@ -120,6 +120,7 @@ class ReposView(APIView):
"permission": 'rw', # Always have read-write permission to owned repo "permission": 'rw', # Always have read-write permission to owned repo
"starred": r.repo_id in starred_repo_id_list, "starred": r.repo_id in starred_repo_id_list,
"status": normalize_repo_status_code(r.status), "status": normalize_repo_status_code(r.status),
"salt": r.salt if r.enc_version == 3 else '',
} }
if is_pro_version() and ENABLE_STORAGE_CLASSES: if is_pro_version() and ENABLE_STORAGE_CLASSES:
@@ -182,6 +183,7 @@ class ReposView(APIView):
"permission": r.permission, "permission": r.permission,
"starred": r.repo_id in starred_repo_id_list, "starred": r.repo_id in starred_repo_id_list,
"status": normalize_repo_status_code(r.status), "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: if r.repo_id in repos_with_admin_share_to:
@@ -225,6 +227,7 @@ class ReposView(APIView):
"permission": r.permission, "permission": r.permission,
"starred": r.repo_id in starred_repo_id_list, "starred": r.repo_id in starred_repo_id_list,
"status": normalize_repo_status_code(r.status), "status": normalize_repo_status_code(r.status),
"salt": r.salt if r.enc_version == 3 else '',
} }
repo_info_list.append(repo_info) repo_info_list.append(repo_info)
@@ -269,6 +272,7 @@ class ReposView(APIView):
"permission": r.permission, "permission": r.permission,
"starred": r.repo_id in starred_repo_id_list, "starred": r.repo_id in starred_repo_id_list,
"status": normalize_repo_status_code(r.status), "status": normalize_repo_status_code(r.status),
"salt": r.salt if r.enc_version == 3 else '',
} }
repo_info_list.append(repo_info) repo_info_list.append(repo_info)

View File

@@ -734,6 +734,7 @@ class Repos(APIView):
"root": '', "root": '',
"head_commit_id": r.head_cmmt_id, "head_commit_id": r.head_cmmt_id,
"version": r.version, "version": r.version,
"salt": r.salt if r.enc_version == 3 else '',
} }
if is_pro_version() and ENABLE_STORAGE_CLASSES: if is_pro_version() and ENABLE_STORAGE_CLASSES:
@@ -801,6 +802,7 @@ class Repos(APIView):
"head_commit_id": r.head_cmmt_id, "head_commit_id": r.head_cmmt_id,
"version": r.version, "version": r.version,
"group_name": library_group_name, "group_name": library_group_name,
"salt": r.salt if r.enc_version == 3 else '',
} }
if r.repo_id in repos_with_admin_share_to: if r.repo_id in repos_with_admin_share_to:
@@ -858,6 +860,7 @@ class Repos(APIView):
"share_from": r.user, "share_from": r.user,
"share_from_name": nickname_dict.get(r.user, ''), "share_from_name": nickname_dict.get(r.user, ''),
"share_from_contact_email": contact_email_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) repos_json.append(repo)
@@ -898,6 +901,7 @@ class Repos(APIView):
"root": '', "root": '',
"head_commit_id": r.head_cmmt_id, "head_commit_id": r.head_cmmt_id,
"version": r.version, "version": r.version,
"salt": r.salt if r.enc_version == 3 else '',
} }
repos_json.append(repo) repos_json.append(repo)

View File

@@ -22,6 +22,16 @@
dirName: '{{ dir_name|escapejs }}', dirName: '{{ dir_name|escapejs }}',
sharedBy: '{{ username|email2nickname|escapejs }}', sharedBy: '{{ username|email2nickname|escapejs }}',
path: '{{ path|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 }}', token: '{{ token }}',
mode: '{{ mode }}', mode: '{{ mode }}',
thumbnailSize: {{ thumbnail_size }}, thumbnailSize: {{ thumbnail_size }},