mirror of https://gitee.com/answerdev/answer.git
feat: activity object info return username
This commit is contained in:
parent
820d87e318
commit
224b569013
|
@ -46,6 +46,7 @@ type ActObjectInfo struct {
|
|||
ObjectType string `json:"object_type"`
|
||||
QuestionID string `json:"question_id"`
|
||||
AnswerID string `json:"answer_id"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
// GetObjectTimelineDetailReq get object timeline detail request
|
||||
|
|
|
@ -72,6 +72,16 @@ func (as *ActivityService) GetObjectTimeline(ctx context.Context, req *schema.Ge
|
|||
resp.ObjectInfo.ObjectType = objInfo.ObjectType
|
||||
resp.ObjectInfo.QuestionID = objInfo.QuestionID
|
||||
resp.ObjectInfo.AnswerID = objInfo.AnswerID
|
||||
if len(objInfo.ObjectCreatorUserID) > 0 {
|
||||
// get object creator user info
|
||||
userBasicInfo, exist, err := as.userCommon.GetUserBasicInfoByID(ctx, objInfo.ObjectCreatorUserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if exist {
|
||||
resp.ObjectInfo.Username = userBasicInfo.Username
|
||||
}
|
||||
}
|
||||
|
||||
activityList, err := as.activityRepo.GetObjectAllActivity(ctx, req.ObjectID, req.ShowVote)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue