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

Do not list encrypted repos in ajax/repos/

This commit is contained in:
zhengxie
2013-08-14 10:16:19 +08:00
parent f7363d89fb
commit 883a926f71
3 changed files with 8 additions and 4 deletions

View File

@@ -325,7 +325,7 @@ $('#msg-file-share-btn').click(function() {
var msg_file_share = $('#msg-file-share'),
btn = $(this);
$.ajax({
'url': '{% url 'get_my_repos' %}',
'url': '{% url 'get_my_unenc_repos' %}',
'cache': false,
'dataType': 'json',
'success': function(data) {

View File

@@ -104,7 +104,7 @@ urlpatterns = patterns('',
### Ajax ###
(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/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/repo/(?P<repo_id>[-0-9a-f]{36})/dir/$', list_dir, name='repo_dir_data'),

View File

@@ -140,7 +140,9 @@ def get_group_repos(request, group_id):
return HttpResponse(json.dumps(repo_list), content_type=content_type)
@login_required
def get_my_repos(request):
def get_my_unenc_repos(request):
"""Get my owned and unencrypted repos.
"""
if not request.is_ajax():
raise Http404
@@ -149,7 +151,9 @@ def get_my_repos(request):
repos = seafile_api.get_owned_repo_list(request.user.username)
repo_list = []
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)