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 main object info that label information exists
LinkinStarbc2012a35924
diff --git a/internal/repo/repo_test/tag_repo_test.go b/internal/repo/repo_test/tag_repo_test.goindex d659651c..d7b5e71c 100644--- a/internal/repo/repo_test/tag_repo_test.go+++ b/internal/repo/repo_test/tag_repo_test.go@@ -54,7 +54,7 @@ func Test_tagRepo_GetTagByID(t *testing.T) {tagOnce.Do(addTagList)tagCommonRepo := tag_common.NewTagCommonRepo(testDataSource, unique.NewUniqueIDRepo(testDataSource))- gotTag, exist, err := tagCommonRepo.GetTagByID(context.TODO(), testTagList[0].ID)+ gotTag, exist, err := tagCommonRepo.GetTagByID(context.TODO(), testTagList[0].ID, true)assert.NoError(t, err)assert.True(t, exist)assert.Equal(t, testTagList[0].SlugName, gotTag.SlugName)@@ -139,7 +139,7 @@ func Test_tagRepo_UpdateTag(t *testing.T) {tagCommonRepo := tag_common.NewTagCommonRepo(testDataSource, unique.NewUniqueIDRepo(testDataSource))- gotTag, exist, err := tagCommonRepo.GetTagByID(context.TODO(), testTagList[0].ID)+ gotTag, exist, err := tagCommonRepo.GetTagByID(context.TODO(), testTagList[0].ID, true)assert.NoError(t, err)assert.True(t, exist)assert.Equal(t, testTagList[0].DisplayName, gotTag.DisplayName)@@ -152,7 +152,7 @@ func Test_tagRepo_UpdateTagQuestionCount(t *testing.T) {err := tagCommonRepo.UpdateTagQuestionCount(context.TODO(), testTagList[0].ID, 100)assert.NoError(t, err)- gotTag, exist, err := tagCommonRepo.GetTagByID(context.TODO(), testTagList[0].ID)+ gotTag, exist, err := tagCommonRepo.GetTagByID(context.TODO(), testTagList[0].ID, true)assert.NoError(t, err)assert.True(t, exist)assert.Equal(t, 100, gotTag.QuestionCount)@@ -172,7 +172,7 @@ func Test_tagRepo_UpdateTagSynonym(t *testing.T) {tagCommonRepo := tag_common.NewTagCommonRepo(testDataSource, unique.NewUniqueIDRepo(testDataSource))- gotTag, exist, err := tagCommonRepo.GetTagByID(context.TODO(), testTagList[2].ID)+ gotTag, exist, err := tagCommonRepo.GetTagByID(context.TODO(), testTagList[2].ID, true)assert.NoError(t, err)assert.True(t, exist)assert.Equal(t, testTagList[0].ID, fmt.Sprintf("%d", gotTag.MainTagID))diff --git a/internal/repo/tag_common/tag_common_repo.go b/internal/repo/tag_common/tag_common_repo.goindex 50f8517f..99f16cc4 100644--- a/internal/repo/tag_common/tag_common_repo.go+++ b/internal/repo/tag_common/tag_common_repo.go@@ -122,12 +122,14 @@ func (tr *tagCommonRepo) GetTagListByNames(ctx context.Context, names []string)}// GetTagByID get tag one-func (tr *tagCommonRepo) GetTagByID(ctx context.Context, tagID string) (+func (tr *tagCommonRepo) GetTagByID(ctx context.Context, tagID string, includeDeleted bool) (tag *entity.Tag, exist bool, err error,) {tag = &entity.Tag{}session := tr.data.DB.Where(builder.Eq{"id": tagID})- session.Where(builder.Eq{"status": entity.TagStatusAvailable})+ if !includeDeleted {+ session.Where(builder.Eq{"status": entity.TagStatusAvailable})+ }exist, err = session.Get(tag)if err != nil {return nil, false, errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()diff --git a/internal/service/object_info/object_info.go b/internal/service/object_info/object_info.goindex aea2208d..2aa2f8ae 100644--- a/internal/service/object_info/object_info.go+++ b/internal/service/object_info/object_info.go@@ -113,7 +113,7 @@ func (os *ObjService) GetInfo(ctx context.Context, objectID string) (objInfo *sc}}case constant.TagObjectType:- tagInfo, exist, err := os.tagRepo.GetTagByID(ctx, objectID)+ tagInfo, exist, err := os.tagRepo.GetTagByID(ctx, objectID, true)if err != nil {return nil, err}diff --git a/internal/service/tag_common/tag_common.go b/internal/service/tag_common/tag_common.goindex ef04c06b..16b297a5 100644--- a/internal/service/tag_common/tag_common.go+++ b/internal/service/tag_common/tag_common.go@@ -25,7 +25,7 @@ type TagCommonRepo interface {GetTagBySlugName(ctx context.Context, slugName string) (tagInfo *entity.Tag, exist bool, err error)GetTagListByName(ctx context.Context, name string, limit int, hasReserved bool) (tagList []*entity.Tag, err error)GetTagListByNames(ctx context.Context, names []string) (tagList []*entity.Tag, err error)- GetTagByID(ctx context.Context, tagID string) (tag *entity.Tag, exist bool, err error)+ GetTagByID(ctx context.Context, tagID string, includeDeleted bool) (tag *entity.Tag, exist bool, err error)GetTagPage(ctx context.Context, page, pageSize int, tag *entity.Tag, queryCond string) (tagList []*entity.Tag, total int64, err error)GetRecommendTagList(ctx context.Context) (tagList []*entity.Tag, err error)GetReservedTagList(ctx context.Context) (tagList []*entity.Tag, err error)@@ -209,7 +209,7 @@ func (ts *TagCommonService) AddTagList(ctx context.Context, tagList []*entity.Ta// GetTagByID get object tagfunc (ts *TagCommonService) GetTagByID(ctx context.Context, tagID string) (tag *entity.Tag, exist bool, err error) {- tag, exist, err = ts.tagCommonRepo.GetTagByID(ctx, tagID)+ tag, exist, err = ts.tagCommonRepo.GetTagByID(ctx, tagID, false)if !exist {return}