From b821a9ceea3758956a0b56d369a9c8c25537ca2b Mon Sep 17 00:00:00 2001 From: Claudio Cicali Date: Mon, 28 Dec 2015 10:36:17 +0100 Subject: [PATCH] Fixes #118 --- ChangeLog.md | 1 + lib/models.js | 10 +++++++--- public/css/style.css | 2 +- routes/wiki.js | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 75d9ce58..8e593910 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -9,6 +9,7 @@ Version 1.6.0, December 28th, 2015 - Adds the CONTRIBUTING file - Adds more tests - Fixes a TOC bug (@creynold) +- Fixes #118 - Fixes a crash on a certain git configuration Requires `npm install` diff --git a/lib/models.js b/lib/models.js index 4006db95..98178e8f 100644 --- a/lib/models.js +++ b/lib/models.js @@ -256,7 +256,9 @@ Page.prototype.fetch = function (extended) { if (!extended) { return Promiserr.all([this.fetchContent(), - this.fetchMetadata()]); + this.fetchMetadata(), + this.fetchHashes(1) + ]); } else { return Promiserr.all([this.fetchContent(), @@ -344,7 +346,9 @@ Page.prototype.fetchMetadata = function () { }.bind(this)); }; -Page.prototype.fetchHashes = function () { +Page.prototype.fetchHashes = function (howmany) { + + howmany = howmany || 2; return new Promiserr(function (resolve, reject) { @@ -353,7 +357,7 @@ Page.prototype.fetchHashes = function () { return; } - gitmech.hashes(this.filename, 2, function (err, hashes) { + gitmech.hashes(this.filename, howmany, function (err, hashes) { this.lastCommand = "hashes"; diff --git a/public/css/style.css b/public/css/style.css index e27b90d9..e673375a 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -268,7 +268,7 @@ hr { } .alert { - box-shadow: 0 0 5px silver; + border: 1px solid #E8E2BF; border-radius: 0; } diff --git a/routes/wiki.js b/routes/wiki.js index f704151a..cc55ff41 100644 --- a/routes/wiki.js +++ b/routes/wiki.js @@ -84,7 +84,7 @@ function _getWikiPage(req, res) { if (!page.error) { res.locals.canEdit = true; - if (page.revision != "HEAD") { + if (page.revision !== "HEAD" && page.revision != page.hashes[0]) { res.locals.warning = "You're not reading the latest revision of this page, which is " + "here."; res.locals.canEdit = false; }