Merge pull request #355 from bootstraponline/author_fix

Fix author info (based on #350).
This commit is contained in:
bootstraponline
2012-05-23 11:40:26 -07:00
3 changed files with 28 additions and 5 deletions
+1 -1
View File
@@ -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
+6 -4
View File
@@ -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
+21
View File
@@ -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 <b>user1/, last_response.body
page2 = 'page2'
user2 = 'user2'
@wiki.write_page(page2, :markdown, '',
{ :name => user2, :email => user2 });
get page2
assert_match /Last edited by <b>user2/, last_response.body
get page1
assert_match /Last edited by <b>user1/, last_response.body
end
test "edits page" do
page_1 = @wiki.page('A')
post "/edit/A", :content => 'abc',