Merge branch 'feat/1.3.0/review' into test

This commit is contained in:
LinkinStars
2024-03-14 12:12:57 +08:00
4 changed files with 13 additions and 3 deletions
+2
View File
@@ -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:
+1
View File
@@ -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"
+4 -3
View File
@@ -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 {
@@ -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,