1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 14:42:10 +00:00

Merge branch '7.1' into master

This commit is contained in:
lian
2020-09-10 16:37:31 +08:00
8 changed files with 62 additions and 20 deletions

View File

@@ -95,9 +95,11 @@ class GroupView extends React.Component {
isStaff: isStaff, isStaff: isStaff,
isDepartmentGroup: isDepartmentGroup, isDepartmentGroup: isDepartmentGroup,
isOwner: isOwner, isOwner: isOwner,
currentPage: 1,
repoList: [] // empty it for the current group repoList: [] // empty it for the current group
}); }, () => {
this.loadRepos(this.state.currentPage); this.loadRepos(this.state.currentPage);
});
}).catch((error) => { }).catch((error) => {
this.setState({ this.setState({
isLoading: false, isLoading: false,

View File

@@ -94,7 +94,13 @@ class AdminLibraries(APIView):
repos = [] repos = []
if repo_name and owner: if repo_name and owner:
# search by name and owner # search by name and owner
orgs = ccnet_api.get_orgs_by_user(owner)
if orgs:
org_id = orgs[0].org_id
owned_repos = seafile_api.get_org_owned_repo_list(org_id, owner)
else:
owned_repos = seafile_api.get_owned_repo_list(owner) owned_repos = seafile_api.get_owned_repo_list(owner)
for repo in owned_repos: for repo in owned_repos:
if not repo.name or repo.is_virtual: if not repo.name or repo.is_virtual:
continue continue
@@ -120,7 +126,13 @@ class AdminLibraries(APIView):
elif owner: elif owner:
# search by owner # search by owner
orgs = ccnet_api.get_orgs_by_user(owner)
if orgs:
org_id = orgs[0].org_id
owned_repos = seafile_api.get_org_owned_repo_list(org_id, owner)
else:
owned_repos = seafile_api.get_owned_repo_list(owner) owned_repos = seafile_api.get_owned_repo_list(owner)
for repo in owned_repos: for repo in owned_repos:
if repo.is_virtual: if repo.is_virtual:
continue continue

View File

@@ -37,23 +37,36 @@ class MarkdownLintView(APIView):
logger.error(e) logger.error(e)
error_msg = 'slate invalid.' error_msg = 'slate invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg) return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
try:
document_nodes = slate["document"]["nodes"]
except Exception as e:
logger.error(e)
error_msg = 'slate invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
issue_list = [] issue_list = []
document_nodes = slate["document"]["nodes"]
# check h1 # check h1
try:
heading_one_issue_list = check_heading_one(document_nodes) heading_one_issue_list = check_heading_one(document_nodes)
if len(heading_one_issue_list) > 0: if len(heading_one_issue_list) > 0:
issue_list.extend(heading_one_issue_list) issue_list.extend(heading_one_issue_list)
except Exception as e:
logger.error('check h1 error: %s' % e)
# check heading_end_with # check heading_end_with
try:
heading_end_issue_list = check_heading_end_with(document_nodes) heading_end_issue_list = check_heading_end_with(document_nodes)
if len(heading_end_issue_list) > 0: if len(heading_end_issue_list) > 0:
issue_list.extend(heading_end_issue_list) issue_list.extend(heading_end_issue_list)
except Exception as e:
logger.error('check heading_end_with error: %s' % e)
# check heading_increase # check heading_increase
try:
heading_increase_issue_list = check_heading_increase(document_nodes) heading_increase_issue_list = check_heading_increase(document_nodes)
if len(heading_increase_issue_list) > 0: if len(heading_increase_issue_list) > 0:
issue_list.extend(heading_increase_issue_list) issue_list.extend(heading_increase_issue_list)
except Exception as e:
logger.error('check heading_increase error: %s' % e)
return Response({"issue_list": issue_list}, status=status.HTTP_200_OK) return Response({"issue_list": issue_list}, status=status.HTTP_200_OK)

View File

@@ -95,7 +95,12 @@ def get_share_link_info(fileshare):
data['can_edit'] = False data['can_edit'] = False
if repo and path != '/' and not data['is_dir']: if repo and path != '/' and not data['is_dir']:
try:
dirent = seafile_api.get_dirent_by_path(repo_id, path) dirent = seafile_api.get_dirent_by_path(repo_id, path)
except Exception as e:
logger.error(e)
dirent = None
if dirent: if dirent:
try: try:
can_edit, error_msg = can_edit_file(obj_name, dirent.size, repo) can_edit, error_msg = can_edit_file(obj_name, dirent.size, repo)
@@ -201,8 +206,14 @@ class ShareLinks(APIView):
repo_id = fileshare.repo_id repo_id = fileshare.repo_id
if repo_id not in repo_folder_permission_dict: if repo_id not in repo_folder_permission_dict:
try:
permission = seafile_api.check_permission_by_path(repo_id, permission = seafile_api.check_permission_by_path(repo_id,
folder_path, fileshare.username) folder_path, fileshare.username)
except Exception as e:
logger.error(e)
permission = ''
repo_folder_permission_dict[repo_id] = permission repo_folder_permission_dict[repo_id] = permission
links_info = [] links_info = []

View File

@@ -469,6 +469,9 @@ CACHES = {
# rest_framwork # rest_framwork
REST_FRAMEWORK = { REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': [
'rest_framework.renderers.JSONRenderer',
],
'DEFAULT_THROTTLE_RATES': { 'DEFAULT_THROTTLE_RATES': {
'ping': '3000/minute', 'ping': '3000/minute',
'anon': '60/minute', 'anon': '60/minute',

View File

@@ -10,7 +10,7 @@
{% trans 'Current Path:' %} {% trans 'Current Path:' %}
{% for name, link in zipped %} {% for name, link in zipped %}
{% if not forloop.last %} {% if not forloop.last %}
<a href="{{ SITE_ROOT }}#common/lib/{{ repo.id }}/{{ link|strip_slash }}">{{ name }}</a> / <a href="{% url 'lib_view' repo.id repo.name link|strip_slash %}">{{ name }}</a> /
{% else %} {% else %}
<a href="{% url 'view_lib_file' repo.id path %}" target="_blank" >{{ name }}</a> <a href="{% url 'view_lib_file' repo.id path %}" target="_blank" >{{ name }}</a>
{% endif %} {% endif %}

View File

@@ -21,7 +21,7 @@
{% trans "Current Path:" %} {% trans "Current Path:" %}
{% for name, link in zipped %} {% for name, link in zipped %}
{% if not forloop.last %} {% if not forloop.last %}
<a href="{{ SITE_ROOT }}#common/lib/{{ repo.id }}/{{ link|strip_slash }}">{{ name }}</a> / <a href="{% url 'lib_view' repo.id repo.name link|strip_slash %}">{{ name }}</a> /
{% else %} {% else %}
<a href="{% url 'view_lib_file' repo.id link %}">{{ name }}</a> <a href="{% url 'view_lib_file' repo.id link %}">{{ name }}</a>
{% endif %} {% endif %}

View File

@@ -156,10 +156,11 @@ class ShibbolethRemoteUserMiddleware(RemoteUserMiddleware):
p = Profile(user=user.username) p = Profile(user=user.username)
if nickname.strip(): # set nickname when it's not empty if nickname.strip(): # set nickname when it's not empty
p.nickname = nickname p.nickname = nickname.encode("iso-8859-1").decode('utf8')
if institution: if institution:
p.institution = institution p.institution = institution
if contact_email: if contact_email:
p.contact_email = contact_email p.contact_email = contact_email