forked from longtao.wu/droboticflow
543 lines
19 KiB
Go
543 lines
19 KiB
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"droboticflow/internal/domain"
|
|
"droboticflow/internal/store"
|
|
"errors"
|
|
"fmt"
|
|
"github.com/go-chi/chi/v5"
|
|
"net/http"
|
|
"sort"
|
|
"strconv"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
func continuationKey(org, user, project, stage string) string {
|
|
return fmt.Sprintf("%s:%s:%s:%s", org, user, project, stage)
|
|
}
|
|
func continuationExpiry() string {
|
|
return time.Now().UTC().Add(45 * time.Second).Format(time.RFC3339Nano)
|
|
}
|
|
func continuationFailure(w http.ResponseWriter, code string) {
|
|
renderJSON(w, 409, map[string]string{"error": "连续审查已暂停,请核对任务和页面编辑权后手动继续。", "code": code})
|
|
}
|
|
func (server *server) continuationSave(ctx context.Context, next *domain.ReviewContinuation, origin *domain.ReviewSession) error {
|
|
ok, e := server.store.CompareAndSwapReviewContinuation(ctx, *next, next.Revision, origin)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
if !ok {
|
|
return errors.New("review_continuation_changed")
|
|
}
|
|
next.Revision++
|
|
return nil
|
|
}
|
|
func (server *server) continuationOrigin(ctx context.Context, v domain.ReviewContinuation) (*domain.ReviewSession, error) {
|
|
if v.SessionKey == "" {
|
|
return nil, nil
|
|
}
|
|
s, e := server.store.GetReviewSession(ctx, v.SessionKey)
|
|
if e != nil {
|
|
return nil, e
|
|
}
|
|
if s == nil || s.PageID != v.SessionPageID || s.UserID != v.UserID || s.Generation != v.SessionGeneration || s.ExpiresAt <= nowISO() {
|
|
return nil, store.ErrReviewContinuationOrigin
|
|
}
|
|
return s, nil
|
|
}
|
|
func (server *server) continuationBind(r *http.Request, v *domain.ReviewContinuation, itemID string) error {
|
|
item, e := server.store.GetHumanItem(r.Context(), itemID)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
if item == nil || item.OrganizationID != v.OrganizationID || (v.ProjectID != "" && item.ProjectID != v.ProjectID) || item.AssignedUserID != v.UserID || (item.Status != domain.HumanItemClaimed && item.Status != domain.HumanItemInProgress) {
|
|
return store.ErrReviewContinuationOrigin
|
|
}
|
|
batch, e := server.store.GetHumanBatch(r.Context(), item.BatchID)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
stage, _, found := humanStage(batch, item.CurrentStageID)
|
|
if !found || !continuationStage(stage, v.Stage) || server.reviewDecisionProtocol(r.Context(), *item) != "receipt" || !server.canAccessHumanItem(r.Context(), r, *item, annotationRoleForHumanStage(stage)) || item.LatestAuthorUserID == v.UserID {
|
|
return store.ErrReviewContinuationOrigin
|
|
}
|
|
s, e := server.store.GetReviewSession(r.Context(), reviewSessionKey(*item))
|
|
if e != nil {
|
|
return e
|
|
}
|
|
generation, _ := strconv.Atoi(r.Header.Get("X-Review-Generation"))
|
|
if s == nil || s.PageID != r.Header.Get("X-Review-Page") || s.UserID != v.UserID || s.Generation != generation || s.ExpiresAt <= nowISO() || s.WriteID != "" {
|
|
return store.ErrReviewContinuationOrigin
|
|
}
|
|
version, e := server.reviewResultVersion(r.Context(), *item)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
if version != s.ResultVersion {
|
|
return store.ErrReviewContinuationOrigin
|
|
}
|
|
v.CurrentItemID = item.ID
|
|
v.SessionKey = s.ID
|
|
v.SessionPageID = s.PageID
|
|
v.SessionGeneration = s.Generation
|
|
return nil
|
|
}
|
|
func continuationStage(stage domain.HumanStageDefinition, kind string) bool {
|
|
return kind == "quality" && stage.Kind == domain.HumanStageReview && annotationRoleForHumanStage(stage) == domain.AnnotationAssignmentRole("quality_reviewer") || kind == "acceptance" && stage.Kind == domain.HumanStageAcceptance
|
|
}
|
|
func continuationClearOrigin(v *domain.ReviewContinuation) {
|
|
v.CurrentItemID = ""
|
|
v.SessionKey = ""
|
|
v.SessionPageID = ""
|
|
v.SessionGeneration = 0
|
|
}
|
|
func (server *server) continuationResponse(w http.ResponseWriter, r *http.Request, v domain.ReviewContinuation) {
|
|
var item *domain.HumanItemRecord
|
|
var e error
|
|
if v.CurrentItemID != "" {
|
|
item, e = server.store.GetHumanItem(r.Context(), v.CurrentItemID)
|
|
}
|
|
if e != nil {
|
|
renderError(w, 500, e)
|
|
return
|
|
}
|
|
status := "active"
|
|
if !v.Active {
|
|
status = "paused"
|
|
} else if item == nil {
|
|
status = "waiting"
|
|
}
|
|
renderJSON(w, 200, map[string]any{"generation": v.Generation, "status": status, "item": item, "expiresAt": v.ExpiresAt, "bound": v.SessionKey != "", "pending": v.PendingItemID != ""})
|
|
}
|
|
func (server *server) handleReviewContinuation(w http.ResponseWriter, r *http.Request) {
|
|
var input struct {
|
|
Action string `json:"action"`
|
|
Stage string `json:"stage"`
|
|
PageID string `json:"pageId"`
|
|
Generation int `json:"generation"`
|
|
ItemID string `json:"itemId"`
|
|
OperationID string `json:"operationId"`
|
|
Scope string `json:"scope"`
|
|
ProjectID string `json:"projectId"`
|
|
Compact bool `json:"compact"`
|
|
}
|
|
if !decodeJSON(w, r, &input) {
|
|
return
|
|
}
|
|
input.PageID = strings.TrimSpace(input.PageID)
|
|
if len(input.PageID) < 1 || len(input.PageID) > 120 || (input.Stage != "quality" && input.Stage != "acceptance") {
|
|
renderValidationError(w, validationIssue{Field: "continuation", Message: "valid pageId and review stage are required"})
|
|
return
|
|
}
|
|
switch input.Action {
|
|
case "start", "pause", "renew", "bind", "next":
|
|
default:
|
|
renderValidationError(w, validationIssue{Field: "action", Message: "unknown continuation action"})
|
|
return
|
|
}
|
|
principal, _ := currentPrincipal(r)
|
|
if principal == nil {
|
|
renderJSON(w, 401, map[string]string{"error": "登录后再继续"})
|
|
return
|
|
}
|
|
project := chi.URLParam(r, "id")
|
|
if project == "" {
|
|
if input.Stage != "acceptance" || (input.Scope != "all" && input.Scope != "project") || (input.Scope == "project" && strings.TrimSpace(input.ProjectID) == "") || (input.Scope == "all" && input.ProjectID != "") {
|
|
renderValidationError(w, validationIssue{Field: "scope", Message: "请选择全部项目或一个具体项目"})
|
|
return
|
|
}
|
|
if input.Scope == "project" {
|
|
project = strings.TrimSpace(input.ProjectID)
|
|
}
|
|
}
|
|
org := server.requestOrganizationID(r)
|
|
key := continuationKey(org, principal.User.ID, project, input.Stage)
|
|
v, e := server.store.GetReviewContinuation(r.Context(), key)
|
|
if e != nil {
|
|
renderError(w, 500, e)
|
|
return
|
|
}
|
|
if v == nil {
|
|
v = &domain.ReviewContinuation{ID: key, OrganizationID: org, ProjectID: project, UserID: principal.User.ID, Stage: input.Stage}
|
|
}
|
|
// Pausing is allowed even after the source task changes or the review lease is lost.
|
|
if input.Action == "pause" {
|
|
if v.PageID != input.PageID || v.Generation != input.Generation {
|
|
continuationFailure(w, "review_continuation_lost")
|
|
return
|
|
}
|
|
v.Active = false
|
|
v.ExpiresAt = ""
|
|
if e = server.continuationSave(r.Context(), v, nil); e != nil {
|
|
continuationFailure(w, "review_continuation_lost")
|
|
return
|
|
}
|
|
server.continuationResponse(w, r, *v)
|
|
return
|
|
}
|
|
user, e := server.store.GetUser(r.Context(), principal.User.ID)
|
|
expectedRole := domain.UserRoleQualityReviewer
|
|
if input.Stage == "acceptance" {
|
|
expectedRole = domain.UserRoleAcceptanceReviewer
|
|
}
|
|
memberships, memberErr := server.annotationMembershipsForUser(r.Context(), org, project, principal.User.ID)
|
|
if e != nil || memberErr != nil {
|
|
renderError(w, 500, errors.New("无法核对审查权限"))
|
|
return
|
|
}
|
|
hasAccess := len(memberships) > 0
|
|
if input.Stage == "acceptance" {
|
|
a := server.acceptanceAccessFor(r.Context(), principal.User.ID)
|
|
hasAccess = a.active && (a.enabled || (a.user.AcceptanceAccessMode != "managed" && hasAccess))
|
|
id := input.ItemID
|
|
if id == "" {
|
|
id = v.CurrentItemID
|
|
}
|
|
if !hasAccess && id != "" {
|
|
item, err := server.store.GetHumanItem(r.Context(), id)
|
|
if err != nil {
|
|
renderError(w, 500, err)
|
|
return
|
|
}
|
|
hasAccess = item != nil && a.active && item.AcceptanceClaim.Matches(*item, *a.user) && (project == "" || item.ProjectID == project)
|
|
}
|
|
}
|
|
if user == nil || user.DeletedAt != "" || user.Status == domain.UserStatusDisabled || user.Role != expectedRole || !hasAccess {
|
|
if server.acceptanceAuthorizationDenied(w, r) {
|
|
return
|
|
}
|
|
renderJSON(w, 403, map[string]string{"error": "审查权限已变化,请刷新核对", "code": "review_continuation_forbidden"})
|
|
return
|
|
}
|
|
if input.Action == "start" {
|
|
if v.Active && v.ExpiresAt > nowISO() && v.PageID != input.PageID {
|
|
// A page that explicitly took over the bound task may replace the
|
|
// old queue owner; an unrelated page cannot steal a waiting queue.
|
|
_, oldOriginError := server.continuationOrigin(r.Context(), *v)
|
|
if v.CurrentItemID != "" && (v.SessionKey == "" || oldOriginError == nil || input.ItemID != v.CurrentItemID) {
|
|
continuationFailure(w, "review_continuation_owned_elsewhere")
|
|
return
|
|
}
|
|
}
|
|
v.Generation++
|
|
v.PageID = input.PageID
|
|
v.Active = true
|
|
v.ExpiresAt = continuationExpiry()
|
|
if v.PendingItemID == "" {
|
|
continuationClearOrigin(v)
|
|
if input.ItemID != "" {
|
|
if e = server.continuationBind(r, v, input.ItemID); e != nil {
|
|
continuationFailure(w, "review_session_lost")
|
|
return
|
|
}
|
|
}
|
|
}
|
|
origin, err := server.continuationOrigin(r.Context(), *v)
|
|
if err != nil {
|
|
continuationFailure(w, "review_session_lost")
|
|
return
|
|
}
|
|
if e = server.continuationSave(r.Context(), v, origin); e != nil {
|
|
continuationFailure(w, "review_continuation_lost")
|
|
return
|
|
}
|
|
} else {
|
|
if !v.Active || v.PageID != input.PageID || v.Generation != input.Generation || v.ExpiresAt <= nowISO() {
|
|
continuationFailure(w, "review_continuation_lost")
|
|
return
|
|
}
|
|
}
|
|
origin, e := server.continuationOrigin(r.Context(), *v)
|
|
if e != nil {
|
|
continuationFailure(w, "review_session_lost")
|
|
return
|
|
}
|
|
if input.Action == "bind" {
|
|
if v.CurrentItemID == "" || v.CurrentItemID != input.ItemID {
|
|
continuationFailure(w, "review_continuation_item_changed")
|
|
return
|
|
}
|
|
if e = server.continuationBind(r, v, input.ItemID); e != nil {
|
|
continuationFailure(w, "review_session_lost")
|
|
return
|
|
}
|
|
origin, e = server.continuationOrigin(r.Context(), *v)
|
|
} else if input.Action == "next" && v.CurrentItemID != "" && v.SessionKey != "" {
|
|
op, err := server.store.FindReviewOperation(r.Context(), org, v.UserID, v.CurrentItemID, input.OperationID)
|
|
if err != nil {
|
|
renderError(w, 500, err)
|
|
return
|
|
}
|
|
if op == nil || op.Status != "completed" || op.Kind != input.Stage || (op.Decision != "approved" && op.Decision != "rejected") || (project != "" && op.ProjectID != project) || op.SessionKey != v.SessionKey || op.PageID != v.SessionPageID || op.Generation != v.SessionGeneration || op.UserID != v.UserID || op.ItemID != v.CurrentItemID {
|
|
continuationFailure(w, "review_decision_not_completed")
|
|
return
|
|
}
|
|
v.LastOperationID = op.OperationID
|
|
continuationClearOrigin(v)
|
|
}
|
|
v.ExpiresAt = continuationExpiry()
|
|
if e != nil {
|
|
continuationFailure(w, "review_session_lost")
|
|
return
|
|
}
|
|
saveOrigin := origin
|
|
if input.Action == "renew" {
|
|
saveOrigin = nil
|
|
}
|
|
if e = server.continuationSave(r.Context(), v, saveOrigin); e != nil {
|
|
continuationFailure(w, "review_continuation_lost")
|
|
return
|
|
}
|
|
if (input.Action == "start" || input.Action == "next") && v.CurrentItemID == "" {
|
|
if e = server.continuationChoose(r, v, origin); e != nil {
|
|
if errors.Is(e, store.ErrHumanClaimConflict) || errors.Is(e, store.ErrReviewContinuationOrigin) {
|
|
continuationFailure(w, "review_session_lost")
|
|
} else {
|
|
renderError(w, 500, e)
|
|
}
|
|
return
|
|
}
|
|
}
|
|
if input.Action == "renew" && input.Compact {
|
|
itemID := ""
|
|
if v.CurrentItemID != "" {
|
|
items, err := server.store.ListHumanItems(r.Context(), org, domain.HumanItemQuery{IDs: []string{v.CurrentItemID}, IdentityProjection: true, Limit: 1})
|
|
if err != nil {
|
|
renderError(w, 500, err)
|
|
return
|
|
}
|
|
if len(items) > 0 {
|
|
itemID = v.CurrentItemID
|
|
}
|
|
}
|
|
status := "waiting"
|
|
if itemID != "" {
|
|
status = "active"
|
|
}
|
|
renderJSON(w, 200, map[string]any{"generation": v.Generation, "status": status, "itemId": itemID, "expiresAt": v.ExpiresAt, "bound": v.SessionKey != "", "pending": v.PendingItemID != ""})
|
|
return
|
|
}
|
|
server.continuationResponse(w, r, *v)
|
|
}
|
|
|
|
func (server *server) continuationChoose(r *http.Request, v *domain.ReviewContinuation, origin *domain.ReviewSession) error {
|
|
ctx := r.Context()
|
|
// Replaying a response cannot claim another task while this admission is unresolved.
|
|
if v.PendingItemID != "" {
|
|
return server.continuationFinishClaim(r, v)
|
|
}
|
|
// Receipt decisions only support these fixed stages; exclude unrelated work
|
|
// before pagination. Keep batch/protocol/authorization checks below.
|
|
stageID := domain.FanyuV58StageQualityReview
|
|
if v.Stage == "acceptance" {
|
|
stageID = fanyuV5PrePackageAcceptanceStageID
|
|
}
|
|
var priority *acceptancePriorityResolver
|
|
if v.Stage == "acceptance" {
|
|
var err error
|
|
priority, err = server.newAcceptancePriorityResolver(ctx, v.OrganizationID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
phases := []int{0, 2}
|
|
if priority != nil && priority.active(v.ProjectID) {
|
|
phases = []int{0, 1, 2}
|
|
}
|
|
for _, phase := range phases {
|
|
owned := phase == 0
|
|
for offset := 0; ; offset += 100 {
|
|
items, e := server.store.ListReviewCandidates(ctx, v.OrganizationID, v.ProjectID, v.UserID, owned, offset, 100, stageID)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
if phase == 1 {
|
|
if err := priority.prime(items); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
candidates := make([]domain.HumanItemRecord, 0, len(items))
|
|
listCtx, e := server.withHumanListReads(ctx, v.OrganizationID, v.ProjectID, items)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
pageRequest := r.WithContext(listCtx)
|
|
batches := map[string]*domain.HumanBatchRecord{}
|
|
for _, item := range items {
|
|
mine := item.AssignedUserID == v.UserID && (item.Status == domain.HumanItemClaimed || item.Status == domain.HumanItemInProgress)
|
|
available := item.AssignedUserID == "" && (item.Status == domain.HumanItemReady || item.Status == domain.HumanItemSubmitted || item.Status == domain.HumanItemRework)
|
|
if (!mine && !available) || item.LatestAuthorUserID == v.UserID {
|
|
continue
|
|
}
|
|
batch, loaded := batches[item.BatchID]
|
|
if !loaded {
|
|
batch, e = server.humanBatchForListRead(listCtx, item.BatchID)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
batches[item.BatchID] = batch
|
|
}
|
|
stage, _, found := humanStage(batch, item.CurrentStageID)
|
|
if !found || !continuationStage(stage, v.Stage) || server.reviewDecisionProtocol(listCtx, item) != "receipt" || !(mine && server.canAccessHumanItem(listCtx, pageRequest, item, annotationRoleForHumanStage(stage)) || !mine && server.canClaimHumanItem(listCtx, pageRequest, item, annotationRoleForHumanStage(stage))) {
|
|
continue
|
|
}
|
|
if phase == 1 {
|
|
matches, err := priority.matches(item)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !matches {
|
|
continue
|
|
}
|
|
}
|
|
candidates = append(candidates, item)
|
|
}
|
|
sort.Slice(candidates, func(i, j int) bool {
|
|
return continuationCandidateLess(candidates[i], candidates[j], v.UserID)
|
|
})
|
|
for _, item := range candidates {
|
|
// Re-read before admitting the one operation; the CAS also fences original page generation.
|
|
fresh, e := server.store.GetReviewContinuation(ctx, v.ID)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
if fresh == nil || !fresh.Active || fresh.PageID != v.PageID || fresh.Generation != v.Generation || fresh.Revision != v.Revision {
|
|
return store.ErrReviewContinuationOrigin
|
|
}
|
|
if item.AssignedUserID == v.UserID {
|
|
latest, err := server.store.GetHumanItem(ctx, item.ID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if latest == nil || latest.Version != item.Version || latest.AssignedUserID != v.UserID || (latest.Status != domain.HumanItemClaimed && latest.Status != domain.HumanItemInProgress) {
|
|
continue
|
|
}
|
|
v.CurrentItemID = item.ID
|
|
return server.continuationSave(ctx, v, origin)
|
|
}
|
|
v.PendingItemID = item.ID
|
|
v.PendingVersion = item.Version
|
|
if e = server.continuationSave(ctx, v, origin); e != nil {
|
|
return e
|
|
}
|
|
e = server.continuationFinishClaim(r, v)
|
|
if errors.Is(e, errContinuationCandidateChanged) {
|
|
continue
|
|
}
|
|
return e
|
|
}
|
|
if len(items) < 100 {
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func continuationCandidateTime(item domain.HumanItemRecord, mine bool) (time.Time, bool) {
|
|
if mine {
|
|
if claimed, err := time.Parse(time.RFC3339Nano, item.ClaimedAt); err == nil {
|
|
return claimed, true
|
|
}
|
|
}
|
|
created, err := time.Parse(time.RFC3339Nano, item.CreatedAt)
|
|
return created, err == nil
|
|
}
|
|
|
|
func continuationCandidateLess(a, b domain.HumanItemRecord, userID string) bool {
|
|
am, bm := a.AssignedUserID == userID, b.AssignedUserID == userID
|
|
if am != bm {
|
|
return am
|
|
}
|
|
at, aKnown := continuationCandidateTime(a, am)
|
|
bt, bKnown := continuationCandidateTime(b, bm)
|
|
if aKnown != bKnown {
|
|
return aKnown
|
|
}
|
|
if aKnown && !at.Equal(bt) {
|
|
return at.Before(bt)
|
|
}
|
|
return a.ID < b.ID
|
|
}
|
|
|
|
var errContinuationCandidateChanged = errors.New("review continuation candidate claimed elsewhere")
|
|
|
|
func (server *server) continuationFinishClaim(r *http.Request, v *domain.ReviewContinuation) error {
|
|
ctx := r.Context()
|
|
item, e := server.store.GetHumanItem(ctx, v.PendingItemID)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
if item == nil {
|
|
v.PendingItemID = ""
|
|
v.PendingVersion = 0
|
|
if e = server.continuationSave(ctx, v, nil); e != nil {
|
|
return e
|
|
}
|
|
return errContinuationCandidateChanged
|
|
}
|
|
if item.AssignedUserID == v.UserID && (item.Status != domain.HumanItemClaimed && item.Status != domain.HumanItemInProgress) {
|
|
return store.ErrReviewContinuationOrigin
|
|
}
|
|
if item.AssignedUserID != v.UserID {
|
|
if item.Version != v.PendingVersion || item.AssignedUserID != "" {
|
|
v.PendingItemID = ""
|
|
v.PendingVersion = 0
|
|
if e = server.continuationSave(ctx, v, nil); e != nil {
|
|
return e
|
|
}
|
|
return errContinuationCandidateChanged
|
|
}
|
|
batch, e := server.store.GetHumanBatch(ctx, item.BatchID)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
stage, _, found := humanStage(batch, item.CurrentStageID)
|
|
if !found || !continuationStage(stage, v.Stage) || server.reviewDecisionProtocol(ctx, *item) != "receipt" || !server.canClaimHumanItem(ctx, r, *item, annotationRoleForHumanStage(stage)) {
|
|
return store.ErrHumanClaimConflict
|
|
}
|
|
item.AssignedUserID = v.UserID
|
|
item.Status = domain.HumanItemClaimed
|
|
item.ClaimedAt = nowISO()
|
|
item.Version++
|
|
claimed, e := server.store.ClaimHumanItemVersioned(ctx, *item, v.PendingVersion, domain.UserRole(annotationRoleForHumanStage(stage)))
|
|
if e != nil {
|
|
return e
|
|
}
|
|
if !claimed {
|
|
v.PendingItemID = ""
|
|
v.PendingVersion = 0
|
|
if e = server.continuationSave(ctx, v, nil); e != nil {
|
|
return e
|
|
}
|
|
return errContinuationCandidateChanged
|
|
}
|
|
}
|
|
// These are idempotent forward repairs if a prior response was lost after claim.
|
|
if e = server.store.UpsertHumanStageAttempt(ctx, domain.HumanStageAttemptRecord{OrganizationID: item.OrganizationID, ItemID: item.ID, StageID: item.CurrentStageID, Round: item.ReviewRound, Status: domain.HumanItemClaimed, AssigneeUserID: v.UserID}); e != nil {
|
|
return e
|
|
}
|
|
if e = server.syncLegacyTaskFromHumanItem(ctx, *item); e != nil {
|
|
return e
|
|
}
|
|
// If pause won during the admitted claim, retain its inactive state and only record the result.
|
|
fresh, e := server.store.GetReviewContinuation(ctx, v.ID)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
if fresh == nil || fresh.PendingItemID != item.ID {
|
|
return store.ErrReviewContinuationOrigin
|
|
}
|
|
fresh.CurrentItemID = item.ID
|
|
fresh.PendingItemID = ""
|
|
fresh.PendingVersion = 0
|
|
if e = server.continuationSave(ctx, fresh, nil); e != nil {
|
|
return e
|
|
}
|
|
*v = *fresh
|
|
return nil
|
|
}
|