diff --git a/README.md b/README.md index 415bbe54..4a3cddf2 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ utility, you can run it like so: $ gollum --help -Note that the gollum server will not run on Windows because of [an issue](https://github.com/rtomayko/posix-spawn/issues/9) with posix-spawn. +Note that the gollum server will not run on Windows because of [an issue](https://github.com/rtomayko/posix-spawn/issues/9) with posix-spawn (which is used by Grit). ## REPO STRUCTURE diff --git a/lib/gollum/frontend/views/page.rb b/lib/gollum/frontend/views/page.rb index 953cdb10..16576f2b 100644 --- a/lib/gollum/frontend/views/page.rb +++ b/lib/gollum/frontend/views/page.rb @@ -14,13 +14,15 @@ module Precious end def author - return DEFAULT_AUTHOR unless @page.version - @page.version.author.name + first = @page.versions ? @page.versions.first : false + return DEFAULT_AUTHOR unless first + first.author.name end def date - return Time.now.strftime(DATE_FORMAT) unless @page.version - @page.version.authored_date.strftime(DATE_FORMAT) + first = @page.versions ? @page.versions.first : false + return Time.now.strftime(DATE_FORMAT) unless first + first.authored_date.strftime(DATE_FORMAT) end def editable diff --git a/test/test_app.rb b/test/test_app.rb index f83f9922..301c808d 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -15,6 +15,27 @@ context "Frontend" do FileUtils.rm_rf(@path) end + test "retain edit information" do + page1 = 'page1' + user1 = 'user1' + @wiki.write_page(page1, :markdown, '', + { :name => user1, :email => user1 }); + + get page1 + assert_match /Last edited by user1/, last_response.body + + page2 = 'page2' + user2 = 'user2' + @wiki.write_page(page2, :markdown, '', + { :name => user2, :email => user2 }); + + get page2 + assert_match /Last edited by user2/, last_response.body + + get page1 + assert_match /Last edited by user1/, last_response.body + end + test "edits page" do page_1 = @wiki.page('A') post "/edit/A", :content => 'abc',