mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-25 06:33:48 +00:00
Do not list encrypted repos in ajax/repos/
This commit is contained in:
@@ -325,7 +325,7 @@ $('#msg-file-share-btn').click(function() {
|
|||||||
var msg_file_share = $('#msg-file-share'),
|
var msg_file_share = $('#msg-file-share'),
|
||||||
btn = $(this);
|
btn = $(this);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
'url': '{% url 'get_my_repos' %}',
|
'url': '{% url 'get_my_unenc_repos' %}',
|
||||||
'cache': false,
|
'cache': false,
|
||||||
'dataType': 'json',
|
'dataType': 'json',
|
||||||
'success': function(data) {
|
'success': function(data) {
|
||||||
|
@@ -104,7 +104,7 @@ urlpatterns = patterns('',
|
|||||||
### Ajax ###
|
### Ajax ###
|
||||||
(r'^ajax/repo/(?P<repo_id>[-0-9a-f]{36})/dirents/$', get_dirents),
|
(r'^ajax/repo/(?P<repo_id>[-0-9a-f]{36})/dirents/$', get_dirents),
|
||||||
url(r'^ajax/group/(?P<group_id>\d+)/repos/$', get_group_repos, name='get_group_repos'),
|
url(r'^ajax/group/(?P<group_id>\d+)/repos/$', get_group_repos, name='get_group_repos'),
|
||||||
url(r'^ajax/repos/$', get_my_repos, name='get_my_repos'),
|
url(r'^ajax/my-unenc-repos/$', get_my_unenc_repos, name='get_my_unenc_repos'),
|
||||||
url(r'^ajax/contacts/$', get_contacts, name='get_contacts'),
|
url(r'^ajax/contacts/$', get_contacts, name='get_contacts'),
|
||||||
|
|
||||||
url(r'^ajax/repo/(?P<repo_id>[-0-9a-f]{36})/dir/$', list_dir, name='repo_dir_data'),
|
url(r'^ajax/repo/(?P<repo_id>[-0-9a-f]{36})/dir/$', list_dir, name='repo_dir_data'),
|
||||||
|
@@ -140,7 +140,9 @@ def get_group_repos(request, group_id):
|
|||||||
return HttpResponse(json.dumps(repo_list), content_type=content_type)
|
return HttpResponse(json.dumps(repo_list), content_type=content_type)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def get_my_repos(request):
|
def get_my_unenc_repos(request):
|
||||||
|
"""Get my owned and unencrypted repos.
|
||||||
|
"""
|
||||||
if not request.is_ajax():
|
if not request.is_ajax():
|
||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
@@ -149,7 +151,9 @@ def get_my_repos(request):
|
|||||||
repos = seafile_api.get_owned_repo_list(request.user.username)
|
repos = seafile_api.get_owned_repo_list(request.user.username)
|
||||||
repo_list = []
|
repo_list = []
|
||||||
for repo in repos:
|
for repo in repos:
|
||||||
repo_list.append({"name": repo.props.name, "id": repo.props.id})
|
if repo.encrypted:
|
||||||
|
continue
|
||||||
|
repo_list.append({"name": repo.name, "id": repo.id})
|
||||||
|
|
||||||
return HttpResponse(json.dumps(repo_list), content_type=content_type)
|
return HttpResponse(json.dumps(repo_list), content_type=content_type)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user