Fix client socket on delete event might not delete corresponding history record correctly
This commit is contained in:
parent
1418b7a801
commit
912063bee4
1 changed files with 14 additions and 3 deletions
|
@ -57,6 +57,9 @@ var syncScrollToView = syncScroll.syncScrollToView;
|
||||||
var historyModule = require('./history');
|
var historyModule = require('./history');
|
||||||
var writeHistory = historyModule.writeHistory;
|
var writeHistory = historyModule.writeHistory;
|
||||||
var deleteServerHistory = historyModule.deleteServerHistory;
|
var deleteServerHistory = historyModule.deleteServerHistory;
|
||||||
|
var getHistory = historyModule.getHistory;
|
||||||
|
var saveHistory = historyModule.saveHistory;
|
||||||
|
var removeHistory = historyModule.removeHistory;
|
||||||
|
|
||||||
var renderer = require('./render');
|
var renderer = require('./render');
|
||||||
var preventXSS = renderer.preventXSS;
|
var preventXSS = renderer.preventXSS;
|
||||||
|
@ -2292,9 +2295,17 @@ socket.on('error', function (data) {
|
||||||
location.href = serverurl + "/403";
|
location.href = serverurl + "/403";
|
||||||
});
|
});
|
||||||
socket.on('delete', function () {
|
socket.on('delete', function () {
|
||||||
deleteServerHistory(noteid, function (err, data) {
|
if (personalInfo.login) {
|
||||||
if (!err) location.href = serverurl;
|
deleteServerHistory(noteid, function (err, data) {
|
||||||
});
|
if (!err) location.href = serverurl;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
getHistory(function (notehistory) {
|
||||||
|
var newnotehistory = removeHistory(noteid, notehistory);
|
||||||
|
saveHistory(newnotehistory);
|
||||||
|
location.href = serverurl;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var retryOnDisconnect = false;
|
var retryOnDisconnect = false;
|
||||||
var retryTimer = null;
|
var retryTimer = null;
|
||||||
|
|
Loading…
Reference in a new issue