{% trans "Tip: A snapshot will be generated after modification, which records the library state before this modification."%}{% trans "View Snapshot"%}
+{% endif %}
+
diff --git a/utils/__init__.py b/utils/__init__.py
index 5729589d46..fa2b2b6b0e 100644
--- a/utils/__init__.py
+++ b/utils/__init__.py
@@ -11,6 +11,7 @@ from django.contrib.sites.models import RequestSite
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.hashcompat import sha_constructor, md5_constructor
+from django.utils.translation import ugettext as _
from base.models import FileContributors, UserStarredFiles, DirFilesLastModifiedInfo
@@ -65,7 +66,7 @@ def render_permission_error(request, msg=None, extra_ctx=None):
"""
ctx = {}
- ctx['error_msg'] = msg or u'权限错误'
+ ctx['error_msg'] = msg or _('permissiong error')
if extra_ctx:
for k in extra_ctx:
@@ -80,7 +81,7 @@ def render_error(request, msg=None, extra_ctx=None):
"""
ctx = {}
- ctx['error_msg'] = msg or u'内部错误'
+ ctx['error_msg'] = msg or _('Internal error')
if extra_ctx:
for k in extra_ctx:
diff --git a/views.py b/views.py
index 52bbdd8db7..9cf83ad56e 100644
--- a/views.py
+++ b/views.py
@@ -117,8 +117,8 @@ def access_to_repo(request, repo_id, repo_ap=None):
Check whether user in the request can access to repo, which means user can
view directory entries on repo page. Only repo owner or person who is shared
can access to repo.
- NOTE: `repo_ap` may be used in future.
+ NOTE: This function is deprecated, use `get_user_permission`.
"""
if not request.user.is_authenticated():
token = request.COOKIES.get('anontoken', None)
@@ -670,9 +670,10 @@ def get_subdir(request):
@ctx_switch_required
def repo_history(request, repo_id):
"""
- View repo history.
+ List library modification histories.
"""
- if not access_to_repo(request, repo_id, ''):
+ user_perm = get_user_permission(request, repo_id)
+ if not user_perm:
return render_permission_error(request, _(u'Unable to view library modification'))
repo = get_repo(repo_id)
@@ -713,6 +714,7 @@ def repo_history(request, repo_id):
'next_page': current_page+1,
'per_page': per_page,
'page_next': page_next,
+ 'user_perm': user_perm,
}, context_instance=RequestContext(request))
@login_required