Commit f53bed06e57f40cc2e554ff071f9e0b19f0be1ab
Committed by
Antonio Terceiro
1 parent
5633e175
Exists in
master
and in
29 other branches
ActionItem1221AI: allow publishers use unpublished articles for draft
Showing
2 changed files
with
13 additions
and
1 deletions
Show diff stats
app/controllers/public/content_viewer_controller.rb
... | ... | @@ -27,7 +27,7 @@ class ContentViewerController < ApplicationController |
27 | 27 | end |
28 | 28 | |
29 | 29 | # only show unpublished articles to those who can edit then |
30 | - if @page && !@page.published && (!user || !user.has_permission?('post_content', profile)) | |
30 | + if @page && !@page.published && !@page.allow_post_content?(user) | |
31 | 31 | @page = nil |
32 | 32 | end |
33 | 33 | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -850,4 +850,16 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
850 | 850 | assert_tag :tag => 'li', :attributes => {:class => 'image-gallery-item'}, :child => {:tag => 'span', :content => 'a long abstract bigger then 40 chars for…'} |
851 | 851 | end |
852 | 852 | |
853 | + should 'allow publisher owner view private articles' do | |
854 | + c = Community.create!(:name => 'test_com') | |
855 | + u = create_user_with_permission('test_user', 'publish_content', c) | |
856 | + login_as u.identifier | |
857 | + a = c.articles.create!(:name => 'test-article', :last_changed_by => u, :published => false) | |
858 | + | |
859 | + get :view_page, :profile => c.identifier, :page => a.explode_path | |
860 | + | |
861 | + assert_response :success | |
862 | + assert_template 'view_page' | |
863 | + end | |
864 | + | |
853 | 865 | end | ... | ... |