Expose content_version for optimistic locking on issue and PR edits (#37035)
- Add `content_version` field to Issue and PullRequest API responses
- Accept optional `content_version` in `PATCH
/repos/{owner}/{repo}/issues/{index}` and `PATCH
/repos/{owner}/{repo}/pulls/{index}` — returns 409 Conflict when stale,
succeeds silently when omitted (backward compatible)
- Pre-check `content_version` before any mutations to prevent partial
writes (e.g. title updated but body rejected)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -62,7 +62,8 @@ func toIssue(ctx context.Context, doer *user_model.User, issue *issues_model.Iss
|
||||
Updated: issue.UpdatedUnix.AsTime(),
|
||||
PinOrder: util.Iif(issue.PinOrder == -1, 0, issue.PinOrder), // -1 means loaded with no pin order
|
||||
|
||||
TimeEstimate: issue.TimeEstimate,
|
||||
TimeEstimate: issue.TimeEstimate,
|
||||
ContentVersion: issue.ContentVersion,
|
||||
}
|
||||
|
||||
if issue.Repo != nil {
|
||||
|
||||
Reference in New Issue
Block a user