Closed btbonval closed 11 years ago
tried making arbitrary revision numbers in the URL and still return the current version without any kind of error.
Also seeing it on another randomly selected web page: http://www.publiclab.org/wiki/revisions/guides
The latest revision (http://www.publiclab.org/wiki/revisions/guides/16180) is shown to have had a H3 header added. Going to the previous revision, or any older revision, shows that header still in place. (http://www.publiclab.org/wiki/revisions/guides/4788)
Ignores invalid revisions
It looks like the path /wiki/revisions/:id
works, but the path /wiki/revisions/:id/:rid
is effectively functioning as /wiki/:id
.
That's likely a route priority issue in config/routes.rb On Oct 8, 2013 11:57 PM, "Bryan Bonvallet" notifications@github.com wrote:
It looks like the path /wiki/revisions/:id works, but the path /wiki/revisions/:id/:rid is effectively functioning as /wiki/:id.
— Reply to this email directly or view it on GitHubhttps://github.com/jywarren/plots2/issues/187#issuecomment-25945200 .
Not a routing problem.
Started GET "/wiki/revisions/guides/8984" for 127.0.0.1 at 2013-10-15 22:20:26 -0400
Processing by WikiController#revision as HTML
Parameters: {"id"=>"guides", "vid"=>"8984"}
Strangely, WikiController@revision does not seem to be doing critical tasks, like this does not get maintained, as the title loses the "Revision for" bit:
@title = "Revision for '"+@node.title+"'"
Well, the title in the template isn't being taken from the procedure:
<h2><%= @node.latest.title %></h2>
also need to check this out to see if it bothers to look at revision that is requested:
@node.render_body,
oh @title
is the actual browser title, not the title of the wiki page. it shows up correctly.
@revision
is the only thing of substance that cares about the :vid
, but it is only referenced in the edit template.
The revision function independently extracts vid without checking if it is related at all to the node retrieved by slug, and then the revision retrieved by the vid is summarily ignored. So problem found.
DrupalRevision does not have render_body, although DrupalNode does. Not clear how to resolve grabbing the revision body in favor of the node body when showing a revision.
Everything besides that should be sorted (e.g. a number of cases where @node
could be replaced with @revision
).
DrupalNode's render_body is simply calling body, which is:
def body
if self.latest
self.latest.body
else
nil
end
end
self.latest
is a DrupalNodeRevision.
So basically, render_body can be moved into DrupalNodeRevision and called there, so that there is no reliance on only the latest revision.
Boom! moving render_body to DrupalNodeRevision fixed viewing revisions.
now viewing wikis is broken.
def root
@node = DrupalNode.find_root_by_slug(params[:id])
@title = @node.title
@revision = @node.latest
@tags = @node.tags
@tagnames = @tags.collect(&:name)
render :template => "wiki/show"
end
@revision
is coming up nil for :slug => 'guides'
even though in Rails Console @node.latest
comes up just fine. Blarg.
oh, root
is used in a different context than show
for some reason, rather than being routes of the same thing, even though all wiki pages can work. #199
show
updated to properly use @revision
, everything appears happy.
http://www.publiclab.org/wiki/revisions/barnstars
click any date to see an old revision: it will return the current version