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

Method formatTimelineUserInfo

internal/service/activity/activity.go:235–258  ·  view source on GitHub ↗
(ctx context.Context, timeline []*schema.ActObjectTimeline)

Source from the content-addressed store, hash-verified

233}
234
235func (as *ActivityService) formatTimelineUserInfo(ctx context.Context, timeline []*schema.ActObjectTimeline) {
236 userExist := make(map[string]bool)
237 userIDs := make([]string, 0)
238 for _, info := range timeline {
239 if len(info.UserInfo.ID) == 0 || userExist[info.UserInfo.ID] {
240 continue
241 }
242 userIDs = append(userIDs, info.UserInfo.ID)
243 }
244 if len(userIDs) == 0 {
245 return
246 }
247 userInfoMapping, err := as.userCommon.BatchUserBasicInfoByID(ctx, userIDs)
248 if err != nil {
249 log.Error(err)
250 return
251 }
252 for _, info := range timeline {
253 if len(info.UserInfo.ID) == 0 {
254 continue
255 }
256 info.UserInfo = userInfoMapping[info.UserInfo.ID]
257 }
258}
259
260// GetObjectTimelineDetail get object timeline
261func (as *ActivityService) GetObjectTimelineDetail(ctx context.Context, req *schema.GetObjectTimelineDetailReq) (

Callers 1

GetObjectTimelineMethod · 0.95

Calls 1

Tested by

no test coverage detected