fix: clear stale nonCurrentRelease regardless of polled review state

Previous fix only cleared stale APPROVED+nonCurrentRelease states when
poll returned mappedState==APPROVED. If the store API returned UNDER_REVIEW
(for the newly-submitted version) while the DB still held a stale
APPROVED+nonCurrentRelease from the old online version, the stale state
was never cleared.

Add universal cleanup: before any mappedState branching, if onlineVersionCode
< submittedCode and the DB entry has nonCurrentRelease/preExisting flags,
immediately clear the store review state.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
这个提交包含在:
XuqmGroup 2026-05-22 19:44:53 +08:00
父节点 0c9fd338eb
当前提交 619e822d85

查看文件

@ -840,6 +840,28 @@ public class StoreSubmissionService {
boolean isUnderReview = "UNDER_REVIEW".equals(existingState);
boolean isRejected = "REJECTED".equals(existingState);
boolean isApproved = "APPROVED".equals(existingState);
// Stale-state cleanup: previous buggy code wrote nonCurrentRelease/preExisting
// whenever an online version existed, regardless of whether it was newer or older.
// If the online version is OLDER than the submitted version, clear any stale marks
// so the user can submit this newer version.
if (!polled.getOnlineVersionCode().isBlank()) {
int cmp = compareVersionCodes(polled.getOnlineVersionCode(), String.valueOf(v.getVersionCode()));
if (cmp < 0 && entry instanceof Map<?, ?> m) {
Object nonCurrentRelease = m.get("nonCurrentRelease");
Object preExisting = m.get("preExisting");
if (Boolean.TRUE.equals(nonCurrentRelease) || Boolean.TRUE.equals(preExisting)) {
log.info("Manual refresh: {}/{} clearing stale nonCurrentRelease/preExisting — online {} < submitted {}",
v.getId(), storeType, polled.getOnlineVersionCode(), v.getVersionCode());
storeService.clearStoreReview(v.getId(), storeType);
isApproved = false;
isUnderReview = false;
isRejected = false;
existingState = "";
}
}
}
AppVersionEntity.StoreReviewState mappedState = mapToStoreReviewState(polled.getReviewState());
if (mappedState == AppVersionEntity.StoreReviewState.APPROVED) {
if (polled.isCurrentSubmissionLive()) {