Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: timeline accept answer activity type format, parse the close problem correctly

LinkinStar4e8283eac9e0
diff --git a/internal/base/constant/acticity.go b/internal/base/constant/acticity.go
index d9b9787f..8300147b 100644
--- a/internal/base/constant/acticity.go
+++ b/internal/base/constant/acticity.go
@@ -11,6 +11,9 @@ const (
ActVoteUp = "vote_up"
ActUpVote = "upvote"
ActDownVote = "downvote"
+ ActFollow = "follow"
+ ActAccepted = "accepted"
+ ActAccept = "accept"
)
const (
diff --git a/internal/service/activity/activity.go b/internal/service/activity/activity.go
index ed399b1c..6169a2b6 100644
--- a/internal/service/activity/activity.go
+++ b/internal/service/activity/activity.go
@@ -165,7 +165,7 @@ func (as *ActivityService) getTimelineActivityComment(ctx context.Context, objec
log.Error(err)
} else {
closeMsg := &schema.CloseQuestionMeta{}
- if err := json.Unmarshal([]byte(metaInfo.Value), closeMsg); err != nil {
+ if err := json.Unmarshal([]byte(metaInfo.Value), closeMsg); err == nil {
return closeMsg.CloseMsg
}
}
@@ -274,7 +274,8 @@ func (as *ActivityService) getOneObjectDetail(ctx context.Context, revisionID st
func formatActivity(activityType string) (isHidden bool, formattedActivityType string) {
if activityType == constant.ActVotedUp ||
- activityType == constant.ActVotedDown {
+ activityType == constant.ActVotedDown ||
+ activityType == constant.ActFollow {
return true, ""
}
if activityType == constant.ActVoteUp {
@@ -283,5 +284,8 @@ func formatActivity(activityType string) (isHidden bool, formattedActivityType s
if activityType == constant.ActVoteDown {
return false, constant.ActDownVote
}
+ if activityType == constant.ActAccepted {
+ return false, constant.ActAccept
+ }
return false, activityType
}