diff --git a/seahub/templates/snippets/current_commit.html b/seahub/templates/snippets/current_commit.html
index 22050cd844..c4372f8870 100644
--- a/seahub/templates/snippets/current_commit.html
+++ b/seahub/templates/snippets/current_commit.html
@@ -1,19 +1,15 @@
{% load seahub_tags avatar_tags i18n %}
- {{ current_commit.props.desc|translate_commit_desc }}
- {% trans "Details"%}
+ {{ info_commit.props.desc|translate_commit_desc }}
+ {% trans "Details"%}
- {% if current_commit.props.creator_name %}
- {% if not current_commit.second_parent_id %}
- {% avatar current_commit.props.creator_name 20 %}
- {{ current_commit.creator_name|email2nickname }}
- {% else %}
- {% trans "Generated by system"%}
- {% endif %}
+ {% if info_commit.props.creator_name %}
+ {% avatar info_commit.props.creator_name 20 %}
+ {{ info_commit.creator_name|email2nickname }}
{% else %}
{% trans "Unknown"%}
{% endif %}
- {{ current_commit.props.ctime|translate_seahub_time }}
+ {{ info_commit.props.ctime|translate_seahub_time }}
{% trans "History"%}
diff --git a/seahub/views/ajax.py b/seahub/views/ajax.py
index b590df426e..b8f3483d91 100644
--- a/seahub/views/ajax.py
+++ b/seahub/views/ajax.py
@@ -238,8 +238,8 @@ def list_dir(request, repo_id):
server_crypto = UserOptions.objects.is_server_crypto(username)
except CryptoOptionNotSetError:
# Assume server_crypto is ``False`` if this option is not set.
- server_crypto = False
-
+ server_crypto = False
+
if repo.encrypted and \
(repo.enc_version == 1 or (repo.enc_version == 2 and server_crypto)) \
and not seafile_api.is_password_set(repo.id, username):
@@ -253,9 +253,14 @@ def list_dir(request, repo_id):
return HttpResponse(json.dumps({'error': err_msg}),
status=500, content_type=content_type)
+ if new_merge_with_no_conflict(head_commit):
+ info_commit = get_commit_before_new_merge(head_commit)
+ else:
+ info_commit = head_commit
+
path = request.GET.get('p', '/')
if path[-1] != '/':
- path = path + '/'
+ path = path + '/'
more_start = None
file_list, dir_list, dirent_more = get_repo_dirents(request, repo.id, head_commit, path, offset=0, limit=100)
@@ -284,6 +289,7 @@ def list_dir(request, repo_id):
'ENABLE_SUB_LIBRARY': settings.ENABLE_SUB_LIBRARY,
"sub_lib_enabled": sub_lib_enabled,
'current_commit': head_commit,
+ 'info_commit': info_commit,
}
html = render_to_string('snippets/repo_dir_data.html', ctx,
context_instance=RequestContext(request))
@@ -958,12 +964,15 @@ def get_current_commit(request, repo_id):
err_msg = _(u'Error: no head commit id')
return HttpResponse(json.dumps({'error': err_msg}),
status=500, content_type=content_type)
+
if new_merge_with_no_conflict(head_commit):
- head_commit = get_commit_before_new_merge(head_commit)
+ info_commit = get_commit_before_new_merge(head_commit)
+ else:
+ info_commit = head_commit
ctx = {
'repo': repo,
- 'current_commit': head_commit
+ 'info_commit': info_commit
}
html = render_to_string('snippets/current_commit.html', ctx,
context_instance=RequestContext(request))
diff --git a/seahub/views/repo.py b/seahub/views/repo.py
index 7843e8e4f6..b3e0715e89 100644
--- a/seahub/views/repo.py
+++ b/seahub/views/repo.py
@@ -187,7 +187,7 @@ def render_repo(request, repo):
applet_root = get_ccnetapplet_root()
httpserver_root = get_httpserver_root()
max_upload_file_size = get_max_upload_file_size()
-
+
protocol = request.is_secure() and 'https' or 'http'
domain = RequestSite(request).domain
@@ -196,15 +196,18 @@ def render_repo(request, repo):
head_commit = get_commit(repo.head_cmmt_id)
if not head_commit:
raise Http404
+
if new_merge_with_no_conflict(head_commit):
- head_commit = get_commit_before_new_merge(head_commit)
-
+ info_commit = get_commit_before_new_merge(head_commit)
+ else:
+ info_commit = head_commit
+
repo_size = get_repo_size(repo.id)
no_quota = is_no_quota(repo.id)
search_repo_id = None if repo.encrypted else repo.id
repo_owner = seafile_api.get_repo_owner(repo.id)
is_repo_owner = True if repo_owner == username else False
-
+
more_start = None
file_list, dir_list, dirent_more = get_repo_dirents(request, repo.id, head_commit, path, offset=0, limit=100)
if dirent_more:
@@ -229,6 +232,7 @@ def render_repo(request, repo):
'repo_owner': repo_owner,
'is_repo_owner': is_repo_owner,
'current_commit': head_commit,
+ 'info_commit': info_commit,
'password_set': True,
'repo_size': repo_size,
'dir_list': dir_list,