mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-24 21:07:17 +00:00
Fix file last update time in sub repo
This commit is contained in:
@@ -116,8 +116,10 @@ class UserStarredFilesManager(models.Manager):
|
||||
continue
|
||||
|
||||
try:
|
||||
dirent = seafile_api.get_dirent_by_path(sfile.repo.id,
|
||||
sfile.path)
|
||||
# get real path for sub repo
|
||||
real_path = sfile.repo.origin_path + sfile.path if sfile.repo.origin_path else sfile.path
|
||||
dirent = seafile_api.get_dirent_by_path(sfile.repo.store_id,
|
||||
real_path)
|
||||
sfile.last_modified = dirent.mtime
|
||||
except SearpcError as e:
|
||||
logger.error(e)
|
||||
@@ -207,4 +209,3 @@ class DeviceToken(models.Model):
|
||||
|
||||
def __unicode__(self):
|
||||
return "/".join(self.user, self.token)
|
||||
|
||||
|
@@ -7,4 +7,3 @@ def list_dir_by_path(cmmt, path):
|
||||
return []
|
||||
else:
|
||||
return seafile_api.list_dir_by_commit_and_path(cmmt.repo_id, cmmt.id, path)
|
||||
|
||||
|
@@ -58,7 +58,6 @@ from seahub.utils.file_types import (IMAGE, PDF, DOCUMENT, SPREADSHEET,
|
||||
MARKDOWN, TEXT, SF, OPENDOCUMENT)
|
||||
from seahub.utils.star import is_file_starred
|
||||
from seahub.utils import HAS_OFFICE_CONVERTER, FILEEXT_TYPE_MAP
|
||||
|
||||
if HAS_OFFICE_CONVERTER:
|
||||
from seahub.utils import (
|
||||
query_office_convert_status, query_office_file_pages, add_office_convert_task,
|
||||
@@ -436,7 +435,9 @@ def view_file(request, repo_id):
|
||||
|
||||
# fetch file contributors and latest contributor
|
||||
try:
|
||||
dirent = seafile_api.get_dirent_by_path(repo.id, path)
|
||||
# get real path for sub repo
|
||||
real_path = repo.origin_path + path if repo.origin_path else path
|
||||
dirent = seafile_api.get_dirent_by_path(repo.store_id, real_path)
|
||||
latest_contributor, last_modified = dirent.modifier, dirent.mtime
|
||||
except SearpcError as e:
|
||||
logger.error(e)
|
||||
|
Reference in New Issue
Block a user