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.

update short id

aichy126d7d652040c77
diff --git a/internal/service/answer_service.go b/internal/service/answer_service.go
index 1860bf7d..baeaca00 100644
--- a/internal/service/answer_service.go
+++ b/internal/service/answer_service.go
@@ -22,6 +22,7 @@ import (
"github.com/answerdev/answer/internal/service/revision_common"
usercommon "github.com/answerdev/answer/internal/service/user_common"
"github.com/answerdev/answer/pkg/encryption"
+ "github.com/answerdev/answer/pkg/uid"
"github.com/segmentfault/pacman/errors"
"github.com/segmentfault/pacman/log"
)
@@ -159,7 +160,7 @@ func (as *AnswerService) Insert(ctx context.Context, req *schema.AnswerAddReq) (
if err != nil {
log.Error("IncreaseAnswerCount error", err.Error())
}
- err = as.questionCommon.UpdateLastAnswer(ctx, req.QuestionID, insertData.ID)
+ err = as.questionCommon.UpdateLastAnswer(ctx, req.QuestionID, uid.DeShortID(insertData.ID))
if err != nil {
log.Error("UpdateLastAnswer error", err.Error())
}
diff --git a/internal/service/notification_common/notification.go b/internal/service/notification_common/notification.go
index 1a14c466..eb148cd4 100644
--- a/internal/service/notification_common/notification.go
+++ b/internal/service/notification_common/notification.go
@@ -198,7 +198,7 @@ func (ns *NotificationCommon) SendNotificationToAllFollower(ctx context.Context,
}
condObjectID := msg.ObjectID
if len(questionID) > 0 {
- condObjectID = questionID
+ condObjectID = uid.DeShortID(questionID)
}
userIDs, err := ns.followRepo.GetFollowUserIDs(ctx, condObjectID)
if err != nil {
diff --git a/internal/service/rank/rank_service.go b/internal/service/rank/rank_service.go
index dac7df20..56ad07ca 100644
--- a/internal/service/rank/rank_service.go
+++ b/internal/service/rank/rank_service.go
@@ -15,6 +15,7 @@ import (
"github.com/answerdev/answer/internal/service/role"
usercommon "github.com/answerdev/answer/internal/service/user_common"
"github.com/answerdev/answer/pkg/htmltext"
+ "github.com/answerdev/answer/pkg/uid"
"github.com/segmentfault/pacman/errors"
"github.com/segmentfault/pacman/log"
"xorm.io/xorm"
@@ -124,6 +125,7 @@ func (rs *RankService) CheckOperationPermissions(ctx context.Context, userID str
// CheckOperationObjectOwner check operation object owner
func (rs *RankService) CheckOperationObjectOwner(ctx context.Context, userID, objectID string) bool {
+ objectID = uid.DeShortID(objectID)
objectInfo, err := rs.objectInfoService.GetInfo(ctx, objectID)
if err != nil {
log.Error(err)