Commit 2e81bdc6a537fe2b6e6393814308cc751aa82aa1
Exists in
master
and in
29 other branches
Merge branch 'master' into next
Showing
8 changed files
with
42 additions
and
6 deletions
Show diff stats
app/models/user.rb
@@ -159,6 +159,7 @@ class User < ActiveRecord::Base | @@ -159,6 +159,7 @@ class User < ActiveRecord::Base | ||
159 | @task.name = self.name | 159 | @task.name = self.name |
160 | @task.email = self.email | 160 | @task.email = self.email |
161 | @task.target = self.environment | 161 | @task.target = self.environment |
162 | + @task.requestor = self.person | ||
162 | @task.save | 163 | @task.save |
163 | end | 164 | end |
164 | 165 | ||
@@ -301,6 +302,10 @@ class User < ActiveRecord::Base | @@ -301,6 +302,10 @@ class User < ActiveRecord::Base | ||
301 | end | 302 | end |
302 | end | 303 | end |
303 | 304 | ||
305 | + def moderate_registration_pending? | ||
306 | + return ModerateUserRegistration.exists?(:requestor_id => self.person.id, :target_id => self.environment.id, :status => Task::Status::ACTIVE) | ||
307 | + end | ||
308 | + | ||
304 | def data_hash(gravatar_default = nil) | 309 | def data_hash(gravatar_default = nil) |
305 | friends_list = {} | 310 | friends_list = {} |
306 | enterprises = person.enterprises.map { |e| { 'name' => e.short_name, 'identifier' => e.identifier } } | 311 | enterprises = person.enterprises.map { |e| { 'name' => e.short_name, 'identifier' => e.identifier } } |
app/views/layouts/application-ng.html.erb
@@ -6,6 +6,10 @@ | @@ -6,6 +6,10 @@ | ||
6 | <!--<meta http-equiv="refresh" content="1"/>--> | 6 | <!--<meta http-equiv="refresh" content="1"/>--> |
7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | 7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
8 | 8 | ||
9 | + <% unless defined? MetadataPlugin and environment.enabled_plugins.include? 'MetadataPlugin' %> | ||
10 | + <meta name="description" content="<%= @environment.name %>" /> | ||
11 | + <% end %> | ||
12 | + | ||
9 | <!-- site root --> | 13 | <!-- site root --> |
10 | <meta property="noosfero:root" content="<%= Noosfero.root %>"/> | 14 | <meta property="noosfero:root" content="<%= Noosfero.root %>"/> |
11 | 15 |
lib/user_activation_job.rb
1 | class UserActivationJob < Struct.new(:user_id) | 1 | class UserActivationJob < Struct.new(:user_id) |
2 | def perform | 2 | def perform |
3 | user = User.find(user_id) | 3 | user = User.find(user_id) |
4 | - user.destroy unless user.activated? || user.person.is_template? | 4 | + user.destroy unless user.activated? || user.person.is_template? || user.moderate_registration_pending? |
5 | end | 5 | end |
6 | end | 6 | end |
plugins/metadata/lib/ext/environment.rb
@@ -2,6 +2,10 @@ require_dependency 'environment' | @@ -2,6 +2,10 @@ require_dependency 'environment' | ||
2 | 2 | ||
3 | class Environment | 3 | class Environment |
4 | 4 | ||
5 | + metadata_spec tags: { | ||
6 | + description: proc{ |e, plugin| e.name }, | ||
7 | + } | ||
8 | + | ||
5 | metadata_spec namespace: :og, tags: { | 9 | metadata_spec namespace: :og, tags: { |
6 | type: 'website', | 10 | type: 'website', |
7 | title: proc{ |e, plugin| e.name }, | 11 | title: proc{ |e, plugin| e.name }, |
plugins/pg_search/db/migrate/20130320010063_create_indexes_for_search.rb
1 | class CreateIndexesForSearch < ActiveRecord::Migration | 1 | class CreateIndexesForSearch < ActiveRecord::Migration |
2 | + SEARCHABLES = %w[ article comment qualifier national_region certifier profile license scrap category ] | ||
3 | + KLASSES = SEARCHABLES.map {|searchable| searchable.camelize.constantize } | ||
2 | def self.up | 4 | def self.up |
3 | - searchables = %w[ article comment qualifier national_region certifier profile license scrap category ] | ||
4 | - klasses = searchables.map {|searchable| searchable.camelize.constantize } | ||
5 | - klasses.each do |klass| | 5 | + KLASSES.each do |klass| |
6 | fields = klass.pg_search_plugin_fields | 6 | fields = klass.pg_search_plugin_fields |
7 | execute "create index pg_search_plugin_#{klass.name.singularize.downcase} on #{klass.table_name} using gin(to_tsvector('simple', #{fields}))" | 7 | execute "create index pg_search_plugin_#{klass.name.singularize.downcase} on #{klass.table_name} using gin(to_tsvector('simple', #{fields}))" |
8 | end | 8 | end |
9 | end | 9 | end |
10 | 10 | ||
11 | def self.down | 11 | def self.down |
12 | - klasses.each do |klass| | 12 | + KLASSES.each do |klass| |
13 | execute "drop index pg_search_plugin_#{klass.name.singularize.downcase}" | 13 | execute "drop index pg_search_plugin_#{klass.name.singularize.downcase}" |
14 | end | 14 | end |
15 | end | 15 | end |
public/javascripts/application.js
@@ -1064,7 +1064,7 @@ jQuery(document).ready(function(){ | @@ -1064,7 +1064,7 @@ jQuery(document).ready(function(){ | ||
1064 | function apply_zoom_to_images(zoom_text) { | 1064 | function apply_zoom_to_images(zoom_text) { |
1065 | jQuery(function($) { | 1065 | jQuery(function($) { |
1066 | $(window).load( function() { | 1066 | $(window).load( function() { |
1067 | - $('#article .article-body img').each( function(index) { | 1067 | + $('#article .article-body img:not(.disable-zoom)').each( function(index) { |
1068 | var original = original_image_dimensions($(this).attr('src')); | 1068 | var original = original_image_dimensions($(this).attr('src')); |
1069 | if ($(this).width() < original['width'] || $(this).height() < original['height']) { | 1069 | if ($(this).width() < original['width'] || $(this).height() < original['height']) { |
1070 | $(this).wrap('<div class="zoomable-image" />'); | 1070 | $(this).wrap('<div class="zoomable-image" />'); |
test/unit/user_activation_job_test.rb
@@ -40,6 +40,18 @@ class UserActivationJobTest < ActiveSupport::TestCase | @@ -40,6 +40,18 @@ class UserActivationJobTest < ActiveSupport::TestCase | ||
40 | end | 40 | end |
41 | end | 41 | end |
42 | 42 | ||
43 | + should 'not destroy user if a moderate user registration task exists' do | ||
44 | + env = Environment.default | ||
45 | + env.enable('skip_new_user_email_confirmation') | ||
46 | + env.enable('admin_must_approve_new_users') | ||
47 | + user = new_user :login => 'test3' | ||
48 | + job = UserActivationJob.new(user.id) | ||
49 | + assert_no_difference 'User.count' do | ||
50 | + job.perform | ||
51 | + process_delayed_job_queue | ||
52 | + end | ||
53 | + end | ||
54 | + | ||
43 | protected | 55 | protected |
44 | def new_user(options = {}) | 56 | def new_user(options = {}) |
45 | user = User.new({ :login => 'quire', :email => 'quire@example.com', :password => 'quire', :password_confirmation => 'quire' }.merge(options)) | 57 | user = User.new({ :login => 'quire', :email => 'quire@example.com', :password => 'quire', :password_confirmation => 'quire' }.merge(options)) |
test/unit/user_test.rb
@@ -302,6 +302,17 @@ class UserTest < ActiveSupport::TestCase | @@ -302,6 +302,17 @@ class UserTest < ActiveSupport::TestCase | ||
302 | assert !user.email_activation_pending? | 302 | assert !user.email_activation_pending? |
303 | end | 303 | end |
304 | 304 | ||
305 | + should 'has moderate registration pending' do | ||
306 | + user = create_user('cooler') | ||
307 | + ModerateUserRegistration.create!(:requestor => user.person, :target => Environment.default) | ||
308 | + assert user.moderate_registration_pending? | ||
309 | + end | ||
310 | + | ||
311 | + should 'not has moderate registration pending if not have a pending task' do | ||
312 | + user = create_user('cooler') | ||
313 | + assert !user.moderate_registration_pending? | ||
314 | + end | ||
315 | + | ||
305 | should 'be able to use [] operator to find users by login' do | 316 | should 'be able to use [] operator to find users by login' do |
306 | user = fast_create(User) | 317 | user = fast_create(User) |
307 | assert_equal user, User[user.login] | 318 | assert_equal user, User[user.login] |