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.

feat(question): add question pending status tip

LinkinStars087f0a0d21ef
diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml
index 2d595775..88443eac 100644
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@ -201,6 +201,8 @@ backend:
question:
already_deleted:
other: This post has been deleted.
+ under_review:
+ other: Your post is awaiting review. It will be visible after it has been approved.
not_found:
other: Question not found.
cannot_deleted:
diff --git a/internal/base/reason/reason.go b/internal/base/reason/reason.go
index 99a7a6d9..55f24322 100644
--- a/internal/base/reason/reason.go
+++ b/internal/base/reason/reason.go
@@ -45,6 +45,7 @@ const (
QuestionCannotClose = "error.question.cannot_close"
QuestionCannotUpdate = "error.question.cannot_update"
QuestionAlreadyDeleted = "error.question.already_deleted"
+ QuestionUnderReview = "error.question.under_review"
AnswerNotFound = "error.answer.not_found"
AnswerCannotDeleted = "error.answer.cannot_deleted"
AnswerCannotUpdate = "error.answer.cannot_update"
diff --git a/internal/schema/question_schema.go b/internal/schema/question_schema.go
index 44ff1303..4df89cf6 100644
--- a/internal/schema/question_schema.go
+++ b/internal/schema/question_schema.go
@@ -279,9 +279,10 @@ type AdminQuestionInfo struct {
type OperationLevel string
const (
- OperationLevelInfo OperationLevel = "info"
- OperationLevelDanger OperationLevel = "danger"
- OperationLevelWarning OperationLevel = "warning"
+ OperationLevelInfo OperationLevel = "info"
+ OperationLevelDanger OperationLevel = "danger"
+ OperationLevelWarning OperationLevel = "warning"
+ OperationLevelSecondary OperationLevel = "secondary"
)
type Operation struct {
diff --git a/internal/service/content/question_service.go b/internal/service/content/question_service.go
index 58b7b931..db777eab 100644
--- a/internal/service/content/question_service.go
+++ b/internal/service/content/question_service.go
@@ -965,6 +965,12 @@ func (qs *QuestionService) GetQuestion(ctx context.Context, questionID, userID s
operation.Level = schema.OperationLevelDanger
question.Operation = operation
}
+ if question.Status == entity.QuestionStatusPending {
+ operation := &schema.Operation{}
+ operation.Msg = translator.Tr(handler.GetLangByCtx(ctx), reason.QuestionUnderReview)
+ operation.Level = schema.OperationLevelSecondary
+ question.Operation = operation
+ }
question.Description = htmltext.FetchExcerpt(question.HTML, "...", 240)
question.MemberActions = permission.GetQuestionPermission(ctx, userID, question.UserID, question.Status,