diff --git a/seahub/api2/endpoints/repo_history.py b/seahub/api2/endpoints/repo_history.py index 975853ac21..d9ebd879e8 100644 --- a/seahub/api2/endpoints/repo_history.py +++ b/seahub/api2/endpoints/repo_history.py @@ -10,7 +10,8 @@ from rest_framework import status from seahub.api2.throttling import UserRateThrottle from seahub.api2.authentication import TokenAuthentication from seahub.api2.utils import api_error - +from seahub.profile.models import Profile +from seahub.base.templatetags.seahub_tags import email2nickname from seahub.options.models import UserOptions, CryptoOptionNotSetError from seahub.utils.timeutils import timestamp_to_isoformat_timestr from seahub.utils import new_merge_with_no_conflict @@ -27,9 +28,11 @@ class RepoHistory(APIView): throttle_classes = (UserRateThrottle, ) def get_item_info(self, commit): - + email = commit.creator_name item_info = { - 'creator': commit.creator_name, + "name": email2nickname(email), + "contact_email": Profile.objects.get_contact_email_by_user(email), + 'email': email, 'time': timestamp_to_isoformat_timestr(commit.ctime), 'description': commit.desc, 'commit_id': commit.id, diff --git a/tests/api/endpoints/test_repo_history.py b/tests/api/endpoints/test_repo_history.py index dd8a1f3a16..8da8dae397 100644 --- a/tests/api/endpoints/test_repo_history.py +++ b/tests/api/endpoints/test_repo_history.py @@ -20,4 +20,4 @@ class RepoHistoryTest(BaseTestCase): resp = self.client.get(self.url) self.assertEqual(200, resp.status_code) json_resp = json.loads(resp.content) - assert json_resp['data'][0]['creator'] == self.user_name + assert json_resp['data'][0]['email'] == self.user_name