diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index 61af80e1..a0ef043f 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 ce1d5476..5e47fd1d 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,