mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-05 13:27:49 +08:00
disabled config sync for testing
This commit is contained in:
parent
42e87185dc
commit
b7d4714fce
3 changed files with 63 additions and 60 deletions
|
@ -317,49 +317,47 @@ function getAccountDataAndInit() {
|
|||
saveConfigToCookie(true);
|
||||
restartTest(false, true);
|
||||
} else if (db_getSnapshot().config !== undefined) {
|
||||
let configsDifferent = false;
|
||||
Object.keys(config).forEach((key) => {
|
||||
if (!configsDifferent) {
|
||||
try {
|
||||
if (key !== "resultFilters") {
|
||||
if (Array.isArray(config[key])) {
|
||||
config[key].forEach((arrval, index) => {
|
||||
if (arrval != db_getSnapshot().config[key][index]) {
|
||||
configsDifferent = true;
|
||||
console.log(
|
||||
`.config is different: ${arrval} != ${
|
||||
db_getSnapshot().config[key][index]
|
||||
}`
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (config[key] != db_getSnapshot().config[key]) {
|
||||
configsDifferent = true;
|
||||
console.log(
|
||||
`..config is different ${key}: ${config[key]} != ${
|
||||
db_getSnapshot().config[key]
|
||||
}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
configsDifferent = true;
|
||||
console.log(`...config is different: ${e.message}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (configsDifferent) {
|
||||
console.log("applying config from db");
|
||||
accountIconLoading(false);
|
||||
config = db_getSnapshot().config;
|
||||
applyConfig(config);
|
||||
updateSettingsPage();
|
||||
saveConfigToCookie(true);
|
||||
restartTest(false, true);
|
||||
}
|
||||
// let configsDifferent = false;
|
||||
// Object.keys(config).forEach((key) => {
|
||||
// if (!configsDifferent) {
|
||||
// try {
|
||||
// if (key !== "resultFilters") {
|
||||
// if (Array.isArray(config[key])) {
|
||||
// config[key].forEach((arrval, index) => {
|
||||
// if (arrval != db_getSnapshot().config[key][index]) {
|
||||
// configsDifferent = true;
|
||||
// console.log(
|
||||
// `.config is different: ${arrval} != ${db_getSnapshot().config[key][index]
|
||||
// }`
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// if (config[key] != db_getSnapshot().config[key]) {
|
||||
// configsDifferent = true;
|
||||
// console.log(
|
||||
// `..config is different ${key}: ${config[key]} != ${db_getSnapshot().config[key]
|
||||
// }`
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (e) {
|
||||
// console.log(e);
|
||||
// configsDifferent = true;
|
||||
// console.log(`...config is different: ${e.message}`);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// if (configsDifferent) {
|
||||
// console.log("applying config from db");
|
||||
// accountIconLoading(false);
|
||||
// config = db_getSnapshot().config;
|
||||
// applyConfig(config);
|
||||
// updateSettingsPage();
|
||||
// saveConfigToCookie(true);
|
||||
// restartTest(false, true);
|
||||
// }
|
||||
}
|
||||
dbConfigLoaded = true;
|
||||
} else {
|
||||
|
|
|
@ -102,23 +102,23 @@ async function saveConfigToCookie(noDbCheck = false) {
|
|||
}
|
||||
|
||||
async function saveConfigToDB() {
|
||||
if (firebase.auth().currentUser !== null) {
|
||||
accountIconLoading(true);
|
||||
CloudFunctions.saveConfig({
|
||||
uid: firebase.auth().currentUser.uid,
|
||||
obj: config,
|
||||
}).then((d) => {
|
||||
accountIconLoading(false);
|
||||
if (d.data.returnCode === 1) {
|
||||
} else {
|
||||
Misc.showNotification(
|
||||
`Error saving config to DB! ${d.data.message}`,
|
||||
4000
|
||||
);
|
||||
}
|
||||
return;
|
||||
});
|
||||
}
|
||||
// if (firebase.auth().currentUser !== null) {
|
||||
// accountIconLoading(true);
|
||||
// CloudFunctions.saveConfig({
|
||||
// uid: firebase.auth().currentUser.uid,
|
||||
// obj: config,
|
||||
// }).then((d) => {
|
||||
// accountIconLoading(false);
|
||||
// if (d.data.returnCode === 1) {
|
||||
// } else {
|
||||
// Misc.showNotification(
|
||||
// `Error saving config to DB! ${d.data.message}`,
|
||||
// 4000
|
||||
// );
|
||||
// }
|
||||
// return;
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
function resetConfig() {
|
||||
|
|
|
@ -1509,6 +1509,11 @@
|
|||
<key>esc</key>
|
||||
)
|
||||
</div>
|
||||
<div style="text-align: center">
|
||||
For testing purposes, account config synchronisation has been
|
||||
temporarily disabled (only local config will be remembered). Sorry
|
||||
for the inconvenience.
|
||||
</div>
|
||||
<!-- <div class="sectionGroupTitle">quick navigation</div> -->
|
||||
<div class="settingsGroup quickNav">
|
||||
<div class="links">
|
||||
|
|
Loading…
Reference in a new issue