WIP: Add an 'updated_at' field to the EditIssueOption struct
This field adds the possibility to set the update date when modifying an issue through the API. A 'NoAutoDate' in-memory field is added in the Issue struct. If the update_at field is set, NoAutoDate is set to true and the Issue's UpdatedUnix field is filled. That information is passed down to the functions that actually updates the database, which have been modified to not auto update dates if requested. A guard is added to the 'EditIssue' API call, to checks that the udpate_at date is between the issue's creation date and the current date (to avoid 'malicious' changes). It also limits the new feature to project's owners and admins.
This commit is contained in:
parent
70fffdc61d
commit
c524d33402
9 changed files with 104 additions and 18 deletions
|
@ -110,6 +110,10 @@ func (issue *Issue) createCrossReferences(stdCtx context.Context, ctx *crossRefe
|
|||
if ctx.OrigComment != nil {
|
||||
refCommentID = ctx.OrigComment.ID
|
||||
}
|
||||
if ctx.OrigIssue.NoAutoTime {
|
||||
xref.Issue.NoAutoTime = true
|
||||
xref.Issue.UpdatedUnix = ctx.OrigIssue.UpdatedUnix
|
||||
}
|
||||
opts := &CreateCommentOptions{
|
||||
Type: ctx.Type,
|
||||
Doer: ctx.Doer,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue