Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/schema/question_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ type QuestionUpdate struct {
Content string `validate:"gte=0,lte=65535" json:"content"`
// html
HTML string `json:"-"`
InviteUser []string `validate:"omitempty" json:"invite_user"`
InviteUser []string `validate:"omitempty,max=20" json:"invite_user"`
// tags
Tags []*TagItem `validate:"dive" json:"tags"`
// edit summary
Expand All @@ -205,7 +205,7 @@ type QuestionRecoverReq struct {

type QuestionUpdateInviteUser struct {
ID string `validate:"required" json:"id"`
InviteUser []string `validate:"omitempty" json:"invite_user"`
InviteUser []string `validate:"omitempty,max=20" json:"invite_user"`
UserID string `json:"-"`
QuestionPermission
CaptchaID string `json:"captcha_id"` // captcha_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ interface Props {
questionId: string;
readOnly?: boolean;
}
const MAX_INVITE_USERS = 20;

const Index: FC<Props> = ({ questionId, readOnly = false }) => {
const { t } = useTranslation('translation', {
keyPrefix: 'invite_to_answer',
Expand Down Expand Up @@ -69,6 +71,9 @@ const Index: FC<Props> = ({ questionId, readOnly = false }) => {
return _.id !== user.id;
});
} else {
if (userList.length >= MAX_INVITE_USERS) {
return;
}
userList.push(user);
}
setUsers(userList);
Expand Down