Commit 6228c23b5101c142f0e2f77452c45b6f97bb39f3

Authored by Antonio Terceiro
2 parents 808ba9fe 195b8404

Merge remote-tracking branch 'origin/rails3'

app/controllers/public/content_viewer_controller.rb
... ... @@ -31,8 +31,8 @@ class ContentViewerController < ApplicationController
31 31  
32 32 if request.post? && @page.forum?
33 33 process_forum_terms_of_use(user, params[:terms_accepted])
34   - elsif is_a_forum_topic?(@page)
35   - redirect_to @page.parent.url unless @page.parent.agrees_with_terms?(user)
  34 + elsif is_a_forum_topic?(@page) && !@page.parent.agrees_with_terms?(user)
  35 + redirect_to @page.parent.url
36 36 return
37 37 end
38 38  
... ...
app/helpers/application_helper.rb
... ... @@ -671,7 +671,7 @@ module ApplicationHelper
671 671  
672 672 def theme_javascript_ng
673 673 script = File.join(theme_path, 'theme.js')
674   - if File.join(Rails.root, 'public', script)
  674 + if File.exists?(File.join(Rails.root, 'public', script))
675 675 javascript_include_tag script
676 676 else
677 677 nil
... ...
app/models/article.rb
... ... @@ -2,7 +2,7 @@ require 'hpricot'
2 2  
3 3 class Article < ActiveRecord::Base
4 4  
5   - attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, :allow_members_to_edit, :translation_of_id, :language, :license_id, :parent_id, :display_posts_in_current_language, :category_ids, :posts_per_page, :moderate_comments, :accept_comments, :feed, :published, :source, :highlighted, :notify_comments, :display_hits, :slug, :external_feed_builder, :display_versions, :external_link
  5 + attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, :allow_members_to_edit, :translation_of_id, :language, :license_id, :parent_id, :display_posts_in_current_language, :category_ids, :posts_per_page, :moderate_comments, :accept_comments, :feed, :published, :source, :highlighted, :notify_comments, :display_hits, :slug, :external_feed_builder, :display_versions, :external_link, :image_builder
6 6  
7 7 acts_as_having_image
8 8  
... ...
app/models/person_notifier.rb
... ... @@ -82,7 +82,7 @@ class PersonNotifier
82 82 @url = @profile.environment.top_url
83 83 mail(
84 84 content_type: "text/html",
85   - from: "#{@profile.environment.name} <#{@profile.environment.contact_email}>",
  85 + from: "#{@profile.environment.name} <#{@profile.environment.noreply_email}>",
86 86 to: @profile.email,
87 87 subject: _("[%s] Network Activity") % [@profile.environment.name]
88 88 )
... ...
db/migrate/20140724134601_fix_yaml_encoding.rb 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +class FixYamlEncoding < ActiveRecord::Migration
  2 + def self.up
  3 + fix_encoding(Block, 'settings')
  4 + fix_encoding(Product, 'data')
  5 + fix_encoding(Environment, 'settings')
  6 + fix_encoding(Profile, 'data')
  7 + fix_encoding(ActionTracker::Record, 'params')
  8 + fix_encoding(Article, 'setting')
  9 + end
  10 +
  11 + def self.down
  12 + puts "Warning: cannot restore original encoding"
  13 + end
  14 +
  15 + private
  16 +
  17 + def self.fix_encoding(model, param)
  18 + result = model.find(:all, :conditions => "#{param} LIKE '%!binary%'")
  19 + puts "Fixing #{result.count} rows of #{model} (#{param})"
  20 + result.each {|r| r.update_column(param, deep_fix(r.send(param)).to_yaml)}
  21 + end
  22 +
  23 + def self.deep_fix(hash)
  24 + hash.each do |value|
  25 + value.force_encoding('UTF-8') if value.is_a?(String) && !value.frozen? && value.encoding == Encoding::ASCII_8BIT
  26 + deep_fix(value) if value.respond_to?(:each)
  27 + end
  28 + end
  29 +
  30 +end
... ...
features/manage_users.feature
... ... @@ -15,7 +15,7 @@ Background:
15 15 Scenario: deactive user
16 16 When I follow "Deactivate user" within "tr[title='Joao Silva']"
17 17 And I confirm the "Do you want to deactivate this user?" dialog
18   - Then I should see "Activate user" within "tr[title='Joao Silva']"
  18 + Then the "tr[title='Joao Silva'] td.actions a.icon-activate-user" button should be enabled
19 19  
20 20 @selenium
21 21 Scenario: activate user
... ... @@ -23,7 +23,7 @@ Background:
23 23 Given I confirm the "Do you want to deactivate this user?" dialog
24 24 When I follow "Activate user" within "tr[title='Paulo Santos']"
25 25 And I confirm the "Do you want to activate this user?" dialog
26   - Then I should see "Deactivate user" within "tr[title='Paulo Santos']"
  26 + Then the "tr[title='Paulo Santos'] td.actions a.icon-deactivate-user" button should be enabled
27 27  
28 28 @selenium
29 29 Scenario: remove user
... ... @@ -36,7 +36,7 @@ Background:
36 36 Scenario: admin user
37 37 When I follow "Set admin role" within "tr[title='Joao Silva']"
38 38 And I confirm the "Do you want to set this user as administrator?" dialog
39   - Then I should see "Reset admin role" within "tr[title='Joao Silva']"
  39 + Then the "tr[title='Joao Silva'] td.actions a.icon-reset-admin-role" button should be enabled
40 40  
41 41 @selenium
42 42 Scenario: unadmin user
... ... @@ -44,4 +44,4 @@ Background:
44 44 And I confirm the "Do you want to set this user as administrator?" dialog
45 45 When I follow "Reset admin role" within "tr[title='Paulo Santos']"
46 46 And I confirm the "Do you want to reset this user as administrator?" dialog
47   - Then I should see "Set admin role" within "tr[title='Paulo Santos']"
  47 + Then the "tr[title='Paulo Santos'] td.actions a.icon-set-admin-role" button should be enabled
... ...
features/support/selenium.rb
... ... @@ -10,7 +10,7 @@ end
10 10  
11 11 # FIXME: 'DELETE FROM ...' is being ran 3x - see cucumber.log
12 12 DatabaseCleaner.clean_with :truncation
13   -DatabaseCleaner.strategy = :truncation
  13 +DatabaseCleaner.strategy = :truncation, {:pre_count => true, :reset_ids => false}
14 14  
15 15 Before do
16 16 DatabaseCleaner.start
... ...
lib/noosfero/plugin/routes.rb
... ... @@ -24,7 +24,7 @@ Dir.glob(Rails.root.join(plugins_root, &#39;*&#39;, &#39;controllers&#39;)) do |controllers_dir|
24 24 end
25 25  
26 26 match 'plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin'
27   - match 'profile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_profile'
28   - match 'myprofile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_myprofile'
  27 + match 'profile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_profile', :profile => /#{Noosfero.identifier_format}/
  28 + match 'myprofile/:profile/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_myprofile', :profile => /#{Noosfero.identifier_format}/
29 29 match 'admin/plugin/' + plugin_name + '(/:action(/:id))', :controller => plugin_name + '_plugin_admin'
30 30 end
... ...
plugins/display_content/lib/display_content_block.rb
... ... @@ -120,7 +120,7 @@ class DisplayContentBlock &lt; Block
120 120 nodes_conditions = nodes.blank? ? '' : " AND articles.id IN(:nodes) "
121 121 nodes_conditions += ' OR articles.parent_id IN(:nodes) ' if !nodes.blank? && display_folder_children
122 122  
123   - docs = owner.articles.find(:all, :conditions => ["articles.type IN(:types) #{nodes.blank? ? '' : nodes_conditions}", {:nodes => self.nodes, :types => self.types}], :include => :profile)
  123 + docs = owner.articles.find(:all, :conditions => ["articles.type IN(:types) #{nodes.blank? ? '' : nodes_conditions}", {:nodes => self.nodes, :types => self.types}], :include => [:profile, :image, :tags])
124 124 proc do
125 125 block.block_title(block.title) +
126 126 content_tag('ul', docs.map {|item|
... ...
plugins/relevant_content/lib/relevant_content_plugin/relevant_content_block.rb
... ... @@ -18,6 +18,8 @@ class RelevantContentPlugin::RelevantContentBlock &lt; Block
18 18 settings_items :show_most_disliked, :type => :boolean, :default => 0
19 19 settings_items :show_most_voted, :type => :boolean, :default => 1
20 20  
  21 + attr_accessible :limit, :show_most_voted, :show_most_disliked, :show_most_liked, :show_most_commented, :show_most_read
  22 +
21 23 include ActionView::Helpers
22 24 include Rails.application.routes.url_helpers
23 25  
... ...
test/unit/external_feed_test.rb
... ... @@ -142,7 +142,7 @@ class ExternalFeedTest &lt; ActiveSupport::TestCase
142 142 should 'save hour when feed was fetched' do
143 143 external_feed = create(:external_feed)
144 144  
145   - now = Time.parse('2009-01-23 09:35')
  145 + now = Time.zone.parse('2009-01-23 09:35')
146 146 Time.stubs(:now).returns(now)
147 147  
148 148 external_feed.finish_fetch
... ...