File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -928,6 +928,13 @@ type NewIssueOptions struct {
928928
929929func newIssue (ctx context.Context , doer * user_model.User , opts NewIssueOptions ) (err error ) {
930930 e := db .GetEngine (ctx )
931+ // codeberg specific
932+ var id int64
933+ has , err := e .Table ("issue" ).Where ("poster_id = ?" , doer .ID ).And ("unix_timestamp()-created_unix<30" ).Limit (1 ).Get (& id )
934+ if has == true {
935+ return fmt .Errorf ("NewIssue: Unknown error" )
936+ }
937+
931938 opts .Issue .Title = strings .TrimSpace (opts .Issue .Title )
932939
933940 if opts .Issue .MilestoneID > 0 {
Original file line number Diff line number Diff line change @@ -761,6 +761,15 @@ func (c *Comment) LoadPushCommits() (err error) {
761761
762762func createComment (ctx context.Context , opts * CreateCommentOptions ) (_ * Comment , err error ) {
763763 e := db .GetEngine (ctx )
764+ // codeberg-specific
765+ if opts .Type == CommentTypeComment {
766+ var id int64
767+ has , _ := e .Table ("comment" ).Where ("poster_id = ?" , opts .Doer .ID ).And ("unix_timestamp()-created_unix<10" ).And ("type=0" ).Limit (1 ).Get (& id )
768+ if has == true {
769+ return nil , fmt .Errorf ("NewComment: Unknown error" )
770+ }
771+ }
772+
764773 var LabelID int64
765774 if opts .Label != nil {
766775 LabelID = opts .Label .ID
You can’t perform that action at this time.
0 commit comments