mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 10:50:24 +00:00
update repo history api
add 'name' and 'contact_email' to result
This commit is contained in:
@@ -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,
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user