AddCommentReq add comment request
| 30 | |
| 31 | // AddCommentReq add comment request |
| 32 | type AddCommentReq struct { |
| 33 | // object id |
| 34 | ObjectID string `validate:"required" json:"object_id"` |
| 35 | // reply comment id |
| 36 | ReplyCommentID string `validate:"omitempty" json:"reply_comment_id"` |
| 37 | // original comment content |
| 38 | OriginalText string `validate:"required,notblank,gte=2,lte=600" json:"original_text"` |
| 39 | // parsed comment content |
| 40 | ParsedText string `json:"-"` |
| 41 | // @ user id list |
| 42 | MentionUsernameList []string `validate:"omitempty" json:"mention_username_list"` |
| 43 | CaptchaID string `json:"captcha_id"` |
| 44 | CaptchaCode string `json:"captcha_code"` |
| 45 | |
| 46 | // user id |
| 47 | UserID string `json:"-"` |
| 48 | // whether user can add it |
| 49 | CanAdd bool `json:"-"` |
| 50 | // whether user can edit it |
| 51 | CanEdit bool `json:"-"` |
| 52 | // whether user can delete it |
| 53 | CanDelete bool `json:"-"` |
| 54 | |
| 55 | IP string `json:"-"` |
| 56 | UserAgent string `json:"-"` |
| 57 | } |
| 58 | |
| 59 | func (req *AddCommentReq) Check() (errFields []*validator.FormErrorField, err error) { |
| 60 | req.ParsedText = converter.Markdown2HTML(req.OriginalText) |
nothing calls this directly
no outgoing calls
no test coverage detected