Commit 074dd19074627e9fb04abede89d3ad4af323f2ff

Authored by Daniela Feitosa
2 parents 1112620e 2ab3f373

Merge branch 'merge-requests/28'

(ActionItem2051)
app/models/environment.rb
... ... @@ -230,7 +230,19 @@ class Environment < ActiveRecord::Base
230 230 settings_items :currency_separator, :type => String, :default => '.'
231 231 settings_items :currency_delimiter, :type => String, :default => ','
232 232  
233   - settings_items :trusted_sites_for_iframe, :type => Array, :default => ['itheora.org', 'tv.softwarelivre.org', 'stream.softwarelivre.org', 'www.youtube.com', 'player.vimeo.com']
  233 + settings_items :trusted_sites_for_iframe, :type => Array, :default => %w[
  234 + developer.myspace.com
  235 + itheora.org
  236 + maps.google.com
  237 + platform.twitter.com
  238 + player.vimeo.com
  239 + stream.softwarelivre.org
  240 + tv.softwarelivre.org
  241 + www.facebook.com
  242 + www.flickr.com
  243 + www.gmodules.com
  244 + www.youtube.com
  245 + ] + ('a' .. 'z').map{|i| "#{i}.yimg.com"}
234 246  
235 247 settings_items :enabled_plugins, :type => Array, :default => []
236 248  
... ...
db/migrate/069_add_enviroment_id_to_role.rb
1   -class Environment < ActiveRecord::Base; end
2 1 class Role < ActiveRecord::Base; end
3 2 class RoleWithEnvironment < ActiveRecord::Base
4 3 set_table_name 'roles'
... ...
db/migrate/083_set_visible_to_profiles.rb
1   -class Environment < ActiveRecord::Base
2   - set_table_name 'environments'
3   - serialize :settings, Hash
4   -end
5   -
6 1 class SetVisibleToProfiles < ActiveRecord::Migration
7 2 def self.up
8 3 templates = []
... ...
db/migrate/20110706171330_fix_misunderstood_script_filename.rb
... ... @@ -21,12 +21,6 @@ class ArticleSweeper &lt; ActiveRecord::Observer
21 21 end
22 22 end
23 23  
24   -class Environment < ActiveRecord::Base
25   - def self.verify_filename(filename)
26   - filename
27   - end
28   -end
29   -
30 24 class FixMisunderstoodScriptFilename < ActiveRecord::Migration
31 25 def self.up
32 26 Image.all.select { |i| !i.thumbnail? && File.extname(i.filename) == '.txt'}.map do |image|
... ...
db/migrate/20110728173905_add_more_trusted_sites_for_environments.rb 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +class AddMoreTrustedSitesForEnvironments < ActiveRecord::Migration
  2 + def self.up
  3 + default_sites = Environment.new.trusted_sites_for_iframe
  4 + Environment.all.each do |env|
  5 + env.trusted_sites_for_iframe += default_sites
  6 + env.trusted_sites_for_iframe.uniq!
  7 + env.save!
  8 + end
  9 + end
  10 +
  11 + def self.down
  12 + say 'Warning: This migration cant recover old data'
  13 + end
  14 +end
... ...
db/schema.rb
... ... @@ -9,7 +9,7 @@
9 9 #
10 10 # It's strongly recommended to check this file into your version control system.
11 11  
12   -ActiveRecord::Schema.define(:version => 20110714213405) do
  12 +ActiveRecord::Schema.define(:version => 20110728173905) do
13 13  
14 14 create_table "action_tracker", :force => true do |t|
15 15 t.integer "user_id"
... ...
test/unit/environment_test.rb
... ... @@ -1079,7 +1079,7 @@ class EnvironmentTest &lt; Test::Unit::TestCase
1079 1079 end
1080 1080  
1081 1081 should 'have a list of trusted sites by default' do
1082   - assert_equal ['itheora.org', 'tv.softwarelivre.org', 'stream.softwarelivre.org', 'www.youtube.com', 'player.vimeo.com'], Environment.new.trusted_sites_for_iframe
  1082 + assert_equal ['developer.myspace.com', 'itheora.org', 'maps.google.com', 'platform.twitter.com', 'player.vimeo.com', 'stream.softwarelivre.org', 'tv.softwarelivre.org', 'www.facebook.com', 'www.flickr.com', 'www.gmodules.com', 'www.youtube.com', 'a.yimg.com', 'b.yimg.com', 'c.yimg.com', 'd.yimg.com', 'e.yimg.com', 'f.yimg.com', 'g.yimg.com', 'h.yimg.com', 'i.yimg.com', 'j.yimg.com', 'k.yimg.com', 'l.yimg.com', 'm.yimg.com', 'n.yimg.com', 'o.yimg.com', 'p.yimg.com', 'q.yimg.com', 'r.yimg.com', 's.yimg.com', 't.yimg.com', 'u.yimg.com', 'v.yimg.com', 'w.yimg.com', 'x.yimg.com', 'y.yimg.com', 'z.yimg.com'], Environment.new.trusted_sites_for_iframe
1083 1083 end
1084 1084  
1085 1085 should 'have a list of trusted sites' do
... ...