Fixed notification translation.

This commit is contained in:
Ylian Saint-Hilaire 2021-01-11 11:56:21 -08:00
parent cb8fc7d150
commit 21e6b0320b
5 changed files with 1857 additions and 3 deletions

1826
db-good.js Normal file

File diff suppressed because it is too large Load Diff

28
db.js
View File

@ -40,8 +40,10 @@ module.exports.CreateDB = function (parent, func) {
obj.pluginsActive = ((parent.config) && (parent.config.settings) && (parent.config.settings.plugins != null) && (parent.config.settings.plugins != false) && ((typeof parent.config.settings.plugins != 'object') || (parent.config.settings.plugins.enabled != false)));
// MongoDB bulk write state
/*
obj.filePendingGet = null;
obj.filePendingGets = null;
*/
obj.filePendingSet = false;
obj.filePendingSets = null;
obj.filePendingCb = null;
@ -1058,7 +1060,30 @@ module.exports.CreateDB = function (parent, func) {
if (func != null) { if (obj.filePendingCb == null) { obj.filePendingCb = [ func ]; } else { obj.filePendingCb.push(func); } }
}
};
obj.Get = function (id, func) {
if (arguments.length > 2) {
var parms = [func];
for (var parmx = 2; parmx < arguments.length; ++parmx) { parms.push(arguments[parmx]); }
var func2 = function _func2(arg1, arg2) {
var userCallback = _func2.userArgs.shift();
_func2.userArgs.unshift(arg2);
_func2.userArgs.unshift(arg1);
userCallback.apply(obj, _func2.userArgs);
};
func2.userArgs = parms;
obj.file.find({ _id: id }).toArray(function (err, docs) {
if ((docs != null) && (docs.length > 0) && (docs[0].links != null)) { docs[0] = common.unEscapeLinksFieldName(docs[0]); }
func2(err, performTypedRecordDecrypt(docs));
});
} else {
obj.file.find({ _id: id }).toArray(function (err, docs) {
if ((docs != null) && (docs.length > 0) && (docs[0].links != null)) { docs[0] = common.unEscapeLinksFieldName(docs[0]); }
func(err, performTypedRecordDecrypt(docs));
});
}
};
/*
obj.Get = function (id, func) { // Fast Get operation using a bulk find() to reduce round trips to the database.
// Encode arguments into return function if any are present.
var func2 = func;
@ -1085,6 +1110,7 @@ module.exports.CreateDB = function (parent, func) {
if (obj.filePendingGet[id] == null) { obj.filePendingGet[id] = [func2]; } else { obj.filePendingGet[id].push(func2); }
}
};
*/
obj.GetAll = function (func) { obj.file.find({}).toArray(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); };
obj.GetHash = function (id, func) { obj.file.find({ _id: id }).project({ _id: 0, hash: 1 }).toArray(function (err, docs) { func(err, performTypedRecordDecrypt(docs)); }); };
@ -1467,6 +1493,7 @@ module.exports.CreateDB = function (parent, func) {
}
}
/*
// MongoDB pending bulk read operation, perform fast bulk document reads.
function fileBulkReadCompleted(err, docs) {
// Send out callbacks with results
@ -1490,6 +1517,7 @@ module.exports.CreateDB = function (parent, func) {
obj.file.find({ _id: { $in: findlist } }).toArray(fileBulkReadCompleted);
}
}
*/
// MongoDB pending bulk write operation, perform fast bulk document replacement.
function fileBulkWriteCompleted() {

File diff suppressed because one or more lines are too long

View File

@ -4856,7 +4856,7 @@
"SMS error: {0}"
];
if (typeof n.titleid == 'number') { try { n.title = translatedTitles[n.titleid]; } catch (ex) { } }
if (typeof n.msgid == 'number') { try { n.text = translatedMessages[n.msgid]; if (Array.isArray(n.args)) { format(n.text, ...n.args); } } catch (ex) { } }
if (typeof n.msgid == 'number') { try { n.text = translatedMessages[n.msgid]; if (Array.isArray(n.args)) { n.text = format(n.text, ...n.args); } } catch (ex) { } }
// Show notification within the web page.
if (n.time == null) { n.time = Date.now(); }

View File

@ -13325,7 +13325,7 @@
"SMS error: {0}"
];
if (typeof n.titleid == 'number') { try { n.title = translatedTitles[n.titleid]; } catch (ex) {} }
if (typeof n.msgid == 'number') { try { n.text = translatedMessages[n.msgid]; if (Array.isArray(n.args)) { format(n.text, ...n.args); } } catch (ex) {} }
if (typeof n.msgid == 'number') { try { n.text = translatedMessages[n.msgid]; if (Array.isArray(n.args)) { n.text = format(n.text, ...n.args); } } catch (ex) {} }
// Show notification within the web page.
if (n.time == null) { n.time = Date.now(); }