diff --git a/internal/service/activity/activity.go b/internal/service/activity/activity.go index 4fe151b9..f971583b 100644 --- a/internal/service/activity/activity.go +++ b/internal/service/activity/activity.go @@ -18,6 +18,7 @@ import ( usercommon "github.com/answerdev/answer/internal/service/user_common" "github.com/answerdev/answer/pkg/converter" "github.com/answerdev/answer/pkg/obj" + "github.com/answerdev/answer/pkg/uid" "github.com/segmentfault/pacman/log" ) @@ -91,6 +92,10 @@ func (as *ActivityService) GetObjectTimeline(ctx context.Context, req *schema.Ge item.CancelledAt = act.CancelledAt.Unix() } + if item.ObjectType == constant.QuestionObjectType || item.ObjectType == constant.AnswerObjectType { + item.ObjectID = uid.EnShortID(act.ObjectID) + } + // database save activity type is number, change to activity type string is like "question.asked". // so we need to cut the front part of '.' _, item.ActivityType, _ = strings.Cut(config.ID2KeyMapping[act.ActivityType], ".")