Defect #36561 ยป defect-36561.patch
app/controllers/wiki_controller.rb | ||
---|---|---|
89 | 89 |
end |
90 | 90 |
@content = @page.content_for_version(params[:version]) |
91 | 91 |
if @content.nil? |
92 |
if User.current.allowed_to?(:edit_wiki_pages, @project) && editable? && !api_request? |
|
92 |
if params[:version].blank? && User.current.allowed_to?(:edit_wiki_pages, @project) && editable? && !api_request?
|
|
93 | 93 |
edit |
94 | 94 |
render :action => 'edit' |
95 | 95 |
else |
app/models/wiki_page.rb | ||
---|---|---|
162 | 162 |
end |
163 | 163 | |
164 | 164 |
def content_for_version(version=nil) |
165 |
if content |
|
166 |
result = content.versions.find_by_version(version.to_i) if version |
|
167 |
result ||= content |
|
168 |
result |
|
169 |
end |
|
165 |
(content && version) ? content.versions.find_by_version(version.to_i) : content |
|
170 | 166 |
end |
171 | 167 | |
172 | 168 |
def diff(version_to=nil, version_from=nil) |
test/functional/wiki_controller_test.rb | ||
---|---|---|
201 | 201 |
assert_select 'select[name=?] option[value="2"][selected=selected]', 'wiki_page[parent_id]' |
202 | 202 |
end |
203 | 203 | |
204 |
def test_show_unexistent_version_page |
|
205 |
@request.session[:user_id] = 2 |
|
206 |
get :show, :params => {:project_id => 1, :id => 'CookBook_documentation', :version => 100} |
|
207 |
assert_response 404 |
|
208 |
end |
|
209 | ||
204 | 210 |
def test_show_should_not_show_history_without_permission |
205 | 211 |
Role.anonymous.remove_permission! :view_wiki_edits |
206 | 212 |
get :show, :params => {:project_id => 1, :id => 'Page with sections', :version => 2} |