[bug] Add 'updateVersion' notification; For bug 75503

This commit is contained in:
Sergey Konovalov
2025-07-08 01:40:09 +03:00
parent 7fadb24b1d
commit 093da6c733
3 changed files with 22 additions and 4 deletions

View File

@ -1031,7 +1031,8 @@ const c_oPublishType = {
closeConnection: 13,
changesNotify: 14,
changeConnecitonInfo: 15,
rpc: 16
rpc: 16,
updateVersion: 17
};
const c_oAscCsvDelimiter = {
None: 0,

View File

@ -3800,6 +3800,13 @@ exports.install = function(server, callbackFunction) {
sendDataRpc(ctx, participant, data.responseKey, data.data);
});
break;
case commonDefines.c_oPublishType.updateVersion:
// To finalize form or refresh file in live view
participants = getParticipants(data.docId);
_.each(participants, function(participant) {
sendData(ctx, participant, {type: "updateVersion", success: data.success});
});
break;
default:
ctx.logger.debug('pubsub unknown message type:%s', msg);
}

View File

@ -972,6 +972,10 @@ const commandSfcCallback = co.wrap(function*(ctx, cmd, isSfcm, isEncrypted) {
const userLastChangeId = cmd.getUserId() || cmd.getUserActionId();
const userLastChangeIndex = cmd.getUserIndex() || cmd.getUserActionIndex();
let replyStr;
let isSfcmSuccess = false;
let isSfcSuccess = false;
let needRetry = false;
let needUpdateVersionEvent = !isSfcm && !isEncrypted;
if (constants.EDITOR_CHANGES !== statusInfo || isSfcm) {
var saveKey = docId + cmd.getSaveKey();
var isError = constants.NO_ERROR != statusInfo;
@ -997,9 +1001,7 @@ const commandSfcCallback = co.wrap(function*(ctx, cmd, isSfcm, isEncrypted) {
}
lastOpenDate = row.last_open_date;
}
var isSfcmSuccess = false;
let storeForgotten = false;
let needRetry = false;
var statusOk;
var statusErr;
if (isSfcm) {
@ -1198,6 +1200,7 @@ const commandSfcCallback = co.wrap(function*(ctx, cmd, isSfcm, isEncrypted) {
ctx.logger.warn('sendServerRequest returned an error: data = %s', replyStr);
}
if (requestRes) {
isSfcSuccess = true;
updateIfTask = undefined;
yield docsCoServer.cleanDocumentOnExitPromise(ctx, docId, true, callbackUserIndex);
if (isOpenFromForgotten) {
@ -1217,7 +1220,10 @@ const commandSfcCallback = co.wrap(function*(ctx, cmd, isSfcm, isEncrypted) {
}
} else {
updateIfTask = undefined;
needUpdateVersionEvent = false;
}
} else {
needUpdateVersionEvent = false;
}
}
} else {
@ -1253,7 +1259,7 @@ const commandSfcCallback = co.wrap(function*(ctx, cmd, isSfcm, isEncrypted) {
//cleanupRes can be false in case of simultaneous opening. it is OK
let cleanupRes = yield cleanupCacheIf(ctx, updateMask);
ctx.logger.debug('storeForgotten cleanupRes=%s', cleanupRes);
}
}
}
if (forceSave) {
yield* docsCoServer.setForceSave(ctx, docId, forceSave, cmd, isSfcmSuccess && !isError, outputSfc?.getUrl());
@ -1273,6 +1279,10 @@ const commandSfcCallback = co.wrap(function*(ctx, cmd, isSfcm, isEncrypted) {
yield docsCoServer.cleanDocumentOnExitNoChangesPromise(ctx, docId, undefined, userLastChangeIndex, true);
}
if (needUpdateVersionEvent && !needRetry) {
yield docsCoServer.publish(ctx, {type: commonDefines.c_oPublishType.updateVersion, ctx: ctx, docId: docId, success: isSfcSuccess});
}
if ((docsCoServer.getIsShutdown() && !isSfcm) || cmd.getRedisKey()) {
let keyRedis = cmd.getRedisKey() ? cmd.getRedisKey() : redisKeyShutdown;
yield docsCoServer.editorStat.removeShutdown(keyRedis, docId);