Fix the title reset bug

pull/1/head
yflory 8 years ago
parent 52d5821be0
commit 4963c77b61

@ -1,6 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html class="cp code"> <html class="cp code">
<head> <head>
<title>CryptPad</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<script data-main="main" src="/bower_components/requirejs/require.js"></script> <script data-main="main" src="/bower_components/requirejs/require.js"></script>
<script> <script>

@ -358,7 +358,7 @@ define([
updateDefaultTitle(json.metadata.defaultTitle); updateDefaultTitle(json.metadata.defaultTitle);
} }
if (typeof json.metadata.title !== "undefined") { if (typeof json.metadata.title !== "undefined") {
updateTitle(json.metadata.title); updateTitle(json.metadata.title || defaultName);
} }
} }
}; };
@ -500,15 +500,6 @@ define([
// set the hash // set the hash
if (!readOnly) { Cryptpad.replaceHash(editHash); } if (!readOnly) { Cryptpad.replaceHash(editHash); }
Cryptpad.getPadTitle(function (err, title) {
if (err) {
console.log("Unable to get pad title");
console.error(err);
return;
}
updateTitle(title || defaultName);
});
}; };
var unnotify = module.unnotify = function () { var unnotify = module.unnotify = function () {

@ -1,6 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html class="cp pad"> <html class="cp pad">
<head> <head>
<title>CryptPad</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link rel="icon" type="image/png" <link rel="icon" type="image/png"
href="/customize/main-favicon.png" href="/customize/main-favicon.png"

@ -448,7 +448,7 @@ define([
updateDefaultTitle(peerMetadata.metadata.defaultTitle); updateDefaultTitle(peerMetadata.metadata.defaultTitle);
} }
if (typeof peerMetadata.metadata.title !== "undefined") { if (typeof peerMetadata.metadata.title !== "undefined") {
updateTitle(peerMetadata.metadata.title); updateTitle(peerMetadata.metadata.title || defaultName);
} }
} }
}; };
@ -622,15 +622,6 @@ define([
// set the hash // set the hash
if (!readOnly) { Cryptpad.replaceHash(editHash); } if (!readOnly) { Cryptpad.replaceHash(editHash); }
Cryptpad.getPadTitle(function (err, title) {
if (err) {
console.error(err);
console.log("Couldn't get pad title");
return;
}
updateTitle(title || defaultName);
});
}; };
// this should only ever get called once, when the chain syncs // this should only ever get called once, when the chain syncs

@ -466,10 +466,13 @@ define([
var renameCb = function (err, title) { var renameCb = function (err, title) {
if (err) { return; } if (err) { return; }
document.title = title; document.title = title;
APP.proxy.info.title = title; APP.proxy.info.title = title === defaultName ? "" : title;
}; };
var suggestName = function (fallback) { var suggestName = function (fallback) {
if (document.title === defaultName) {
return fallback || "";
}
return document.title || defaultName || ""; return document.title || defaultName || "";
}; };
@ -692,15 +695,6 @@ define([
// set the hash // set the hash
if (!readOnly) { Cryptpad.replaceHash(editHash); } if (!readOnly) { Cryptpad.replaceHash(editHash); }
Cryptpad.getPadTitle(function (err, title) {
if (err) {
console.error(err);
console.log("Couldn't get pad title");
return;
}
updateTitle(title || defaultName);
});
}; };
var disconnect = function (info) { var disconnect = function (info) {

@ -1,6 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html class="cp slide"> <html class="cp slide">
<head> <head>
<title>CryptPad</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<script data-main="main" src="/bower_components/requirejs/require.js"></script> <script data-main="main" src="/bower_components/requirejs/require.js"></script>
<script> <script>

@ -393,7 +393,7 @@ define([
updateDefaultTitle(json.metadata.defaultTitle); updateDefaultTitle(json.metadata.defaultTitle);
} }
if (typeof json.metadata.title !== "undefined") { if (typeof json.metadata.title !== "undefined") {
updateTitle(json.metadata.title); updateTitle(json.metadata.title || defaultName);
} }
updateColors(json.metadata.color, json.metadata.backColor); updateColors(json.metadata.color, json.metadata.backColor);
} }
@ -589,15 +589,6 @@ define([
if (!window.location.hash || window.location.hash === '#') { if (!window.location.hash || window.location.hash === '#') {
Cryptpad.replaceHash(editHash); Cryptpad.replaceHash(editHash);
} }
Cryptpad.getPadTitle(function (err, title) {
if (err) {
console.log("Unable to get pad title");
console.error(err);
return;
}
updateTitle(title || defaultName);
});
}; };
var unnotify = module.unnotify = function () { var unnotify = module.unnotify = function () {

Loading…
Cancel
Save