Merge pull request #355 from bootstraponline/author_fix
Fix author info (based on #350).
This commit is contained in:
@@ -59,7 +59,7 @@ utility, you can run it like so:
|
|||||||
|
|
||||||
$ gollum --help
|
$ 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
|
## REPO STRUCTURE
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,15 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
def author
|
def author
|
||||||
return DEFAULT_AUTHOR unless @page.version
|
first = @page.versions ? @page.versions.first : false
|
||||||
@page.version.author.name
|
return DEFAULT_AUTHOR unless first
|
||||||
|
first.author.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def date
|
def date
|
||||||
return Time.now.strftime(DATE_FORMAT) unless @page.version
|
first = @page.versions ? @page.versions.first : false
|
||||||
@page.version.authored_date.strftime(DATE_FORMAT)
|
return Time.now.strftime(DATE_FORMAT) unless first
|
||||||
|
first.authored_date.strftime(DATE_FORMAT)
|
||||||
end
|
end
|
||||||
|
|
||||||
def editable
|
def editable
|
||||||
|
|||||||
@@ -15,6 +15,27 @@ context "Frontend" do
|
|||||||
FileUtils.rm_rf(@path)
|
FileUtils.rm_rf(@path)
|
||||||
end
|
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
|
test "edits page" do
|
||||||
page_1 = @wiki.page('A')
|
page_1 = @wiki.page('A')
|
||||||
post "/edit/A", :content => 'abc',
|
post "/edit/A", :content => 'abc',
|
||||||
|
|||||||
Reference in New Issue
Block a user