Commit f3cd985b718e269e510c9c104764a5113aa05ec1
Exists in
master
and in
29 other branches
Merge branch 'AI3228_spreading_article' into 'master'
Ai3228 spreading article AI 3228 fix spreading article. http://noosfero.org/Development/ActionItem3228 See merge request !267
Showing
2 changed files
with
12 additions
and
1 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -248,12 +248,15 @@ class CmsController < MyProfileController |
248 | 248 | end.compact unless params[:marked_groups].nil? |
249 | 249 | if request.post? |
250 | 250 | @failed = {} |
251 | + if @marked_groups.empty? | |
252 | + return session[:notice] = _("Select some group to publish your article") | |
253 | + end | |
251 | 254 | @marked_groups.each do |item| |
252 | 255 | task = ApproveArticle.create!(:article => @article, :name => item[:name], :target => item[:group], :requestor => profile) |
253 | 256 | begin |
254 | 257 | task.finish unless item[:group].moderated_articles? |
255 | 258 | rescue Exception => ex |
256 | - @failed[ex.message] ? @failed[ex.message] << item[:group].name : @failed[ex.message] = [item[:group].name] | |
259 | + @failed[ex.message] ? @failed[ex.message] << item[:group].name : @failed[ex.message] = [item[:group].name] | |
257 | 260 | end |
258 | 261 | end |
259 | 262 | if @failed.blank? | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -1791,6 +1791,14 @@ class CmsControllerTest < ActionController::TestCase |
1791 | 1791 | assert_equal other_person, a.created_by |
1792 | 1792 | end |
1793 | 1793 | |
1794 | + should 'continue on the same page, when no group is selected' do | |
1795 | + c = Community.create!(:name => 'test comm', :identifier => 'test_comm') | |
1796 | + c.affiliate(profile, Profile::Roles.all_roles(c.environment.id)) | |
1797 | + article = profile.articles.create!(:name => 'something intresting', :body => 'ruby on rails') | |
1798 | + post :publish, :profile => profile.identifier, :id => article.id, :marked_groups => {c.id.to_s => {}} | |
1799 | + assert_template 'cms/publish' | |
1800 | + end | |
1801 | + | |
1794 | 1802 | protected |
1795 | 1803 | |
1796 | 1804 | # FIXME this is to avoid adding an extra dependency for a proper JSON parser. | ... | ... |