MCPcopy Index your code
hub / github.com/apache/answer / getTimelineMainObjInfo

Method getTimelineMainObjInfo

internal/service/activity/activity.go:167–197  ·  view source on GitHub ↗
(ctx context.Context, objectID string)

Source from the content-addressed store, hash-verified

165}
166
167func (as *ActivityService) getTimelineMainObjInfo(ctx context.Context, objectID string) (
168 resp *schema.ActObjectInfo, err error) {
169 resp = &schema.ActObjectInfo{}
170 objInfo, err := as.objectInfoService.GetInfo(ctx, objectID)
171 if err != nil {
172 return nil, err
173 }
174 resp.Title = objInfo.Title
175 if objInfo.ObjectType == constant.TagObjectType {
176 tag, exist, _ := as.tagCommonService.GetTagByID(ctx, objInfo.TagID)
177 if exist {
178 resp.Title = tag.SlugName
179 resp.MainTagSlugName = tag.MainTagSlugName
180 }
181 }
182 resp.ObjectType = objInfo.ObjectType
183 resp.QuestionID = objInfo.QuestionID
184 resp.AnswerID = objInfo.AnswerID
185 if len(objInfo.ObjectCreatorUserID) > 0 {
186 // get object creator user info
187 userBasicInfo, exist, err := as.userCommon.GetUserBasicInfoByID(ctx, objInfo.ObjectCreatorUserID)
188 if err != nil {
189 return nil, err
190 }
191 if exist {
192 resp.Username = userBasicInfo.Username
193 resp.DisplayName = userBasicInfo.DisplayName
194 }
195 }
196 return resp, nil
197}
198
199func (as *ActivityService) getTimelineActivityComment(ctx context.Context, objectID, objectType,
200 activityType, revisionID string) (comment string) {

Callers 1

GetObjectTimelineMethod · 0.95

Calls 3

GetInfoMethod · 0.80
GetUserBasicInfoByIDMethod · 0.80
GetTagByIDMethod · 0.65

Tested by

no test coverage detected