Commit bfc655ab0467101fa80337e78d6b28dcfb36222a
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'stable' of gitlab.com:participa/noosfero into stable
Showing
33 changed files
with
123 additions
and
35 deletions
Show diff stats
app/controllers/application_controller.rb
| ... | ... | @@ -9,6 +9,11 @@ class ApplicationController < ActionController::Base |
| 9 | 9 | before_filter :allow_cross_domain_access |
| 10 | 10 | before_filter :login_required, :if => :private_environment? |
| 11 | 11 | before_filter :verify_members_whitelist, :if => [:private_environment?, :user] |
| 12 | + before_filter :log_user | |
| 13 | + | |
| 14 | + def log_user | |
| 15 | + Rails.logger.info "Logged in: #{user.identifier}" if user | |
| 16 | + end | |
| 12 | 17 | |
| 13 | 18 | def verify_members_whitelist |
| 14 | 19 | render_access_denied unless user.is_admin? || environment.in_whitelist?(user) | ... | ... |
app/controllers/box_organizer_controller.rb
| ... | ... | @@ -84,9 +84,9 @@ class BoxOrganizerController < ApplicationController |
| 84 | 84 | if request.xhr? and params[:query] |
| 85 | 85 | search = params[:query] |
| 86 | 86 | path_list = if boxes_holder.is_a?(Environment) && boxes_holder.enabled?('use_portal_community') && boxes_holder.portal_community |
| 87 | - boxes_holder.portal_community.articles.find(:all, :conditions=>"name ILIKE '%#{search}%' or path ILIKE '%#{search}%'", :limit=>20).map { |content| "/{portal}/"+content.path } | |
| 87 | + boxes_holder.portal_community.articles.find(:all, :conditions=>"articles.name ILIKE '%#{search}%' or articles.path ILIKE '%#{search}%'", :limit=>20).map { |content| "/{portal}/"+content.path } | |
| 88 | 88 | elsif boxes_holder.is_a?(Profile) |
| 89 | - boxes_holder.articles.find(:all, :conditions=>"name ILIKE '%#{search}%' or path ILIKE '%#{search}%'", :limit=>20).map { |content| "/{profile}/"+content.path } | |
| 89 | + boxes_holder.articles.find(:all, :conditions=>"articles.name ILIKE '%#{search}%' or articles.path ILIKE '%#{search}%'", :limit=>20).map { |content| "/{profile}/"+content.path } | |
| 90 | 90 | else |
| 91 | 91 | [] |
| 92 | 92 | end | ... | ... |
app/controllers/public/account_controller.rb
| ... | ... | @@ -359,11 +359,11 @@ class AccountController < ApplicationController |
| 359 | 359 | end |
| 360 | 360 | |
| 361 | 361 | def get_signup_start_time |
| 362 | - Rails.cache.read params[:signup_time_key] | |
| 362 | + Rails.cache.read params[:signup_time_key] if params[:signup_time_key].present? | |
| 363 | 363 | end |
| 364 | 364 | |
| 365 | 365 | def clear_signup_start_time |
| 366 | - Rails.cache.delete params[:signup_time_key] if params[:signup_time_key] | |
| 366 | + Rails.cache.delete params[:signup_time_key] if params[:signup_time_key].present? | |
| 367 | 367 | end |
| 368 | 368 | |
| 369 | 369 | def may_be_a_bot | ... | ... |
app/controllers/public/profile_controller.rb
| ... | ... | @@ -65,13 +65,13 @@ class ProfileController < PublicController |
| 65 | 65 | |
| 66 | 66 | def friends |
| 67 | 67 | if is_cache_expired?(profile.friends_cache_key(params)) |
| 68 | - @friends = profile.friends.includes(relations_to_include).paginate(:per_page => per_page, :page => params[:npage]) | |
| 68 | + @friends = profile.friends.includes(relations_to_include).paginate(:per_page => per_page, :page => params[:npage], :total_entries => profile.friends.count) | |
| 69 | 69 | end |
| 70 | 70 | end |
| 71 | 71 | |
| 72 | 72 | def members |
| 73 | 73 | if is_cache_expired?(profile.members_cache_key(params)) |
| 74 | - @members = profile.members_by_name.includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage]) | |
| 74 | + @members = profile.members_by_name.includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage], :total_entries => profile.members.count) | |
| 75 | 75 | end |
| 76 | 76 | end |
| 77 | 77 | ... | ... |
app/helpers/application_helper.rb
| ... | ... | @@ -907,13 +907,15 @@ module ApplicationHelper |
| 907 | 907 | end |
| 908 | 908 | |
| 909 | 909 | def page_title |
| 910 | - (@page ? @page.title + ' - ' : '') + | |
| 911 | - (@topic ? @topic.title + ' - ' : '') + | |
| 912 | - (@section ? @section.title + ' - ' : '') + | |
| 913 | - (@toc ? _('Online Manual') + ' - ' : '') + | |
| 914 | - (controller.controller_name == 'chat' ? _('Chat') + ' - ' : '') + | |
| 915 | - (profile ? profile.short_name : environment.name) + | |
| 916 | - (@category ? " - #{@category.full_name}" : '') | |
| 910 | + CGI.escapeHTML( | |
| 911 | + (@page ? @page.title + ' - ' : '') + | |
| 912 | + (@topic ? @topic.title + ' - ' : '') + | |
| 913 | + (@section ? @section.title + ' - ' : '') + | |
| 914 | + (@toc ? _('Online Manual') + ' - ' : '') + | |
| 915 | + (controller.controller_name == 'chat' ? _('Chat') + ' - ' : '') + | |
| 916 | + (profile ? profile.short_name : environment.name) + | |
| 917 | + (@category ? " - #{@category.full_name}" : '') | |
| 918 | + ) | |
| 917 | 919 | end |
| 918 | 920 | |
| 919 | 921 | # DEPRECATED. Do not use this. |
| ... | ... | @@ -1285,11 +1287,13 @@ module ApplicationHelper |
| 1285 | 1287 | end |
| 1286 | 1288 | |
| 1287 | 1289 | def delete_article_message(article) |
| 1288 | - if article.folder? | |
| 1289 | - _("Are you sure that you want to remove the folder \"%s\"? Note that all the items inside it will also be removed!") % article.name | |
| 1290 | - else | |
| 1291 | - _("Are you sure that you want to remove the item \"%s\"?") % article.name | |
| 1292 | - end | |
| 1290 | + CGI.escapeHTML( | |
| 1291 | + if article.folder? | |
| 1292 | + _("Are you sure that you want to remove the folder \"%s\"? Note that all the items inside it will also be removed!") % article.name | |
| 1293 | + else | |
| 1294 | + _("Are you sure that you want to remove the item \"%s\"?") % article.name | |
| 1295 | + end | |
| 1296 | + ) | |
| 1293 | 1297 | end |
| 1294 | 1298 | |
| 1295 | 1299 | def expirable_link_to(expired, content, url, options = {}) | ... | ... |
app/helpers/layout_helper.rb
| ... | ... | @@ -93,7 +93,7 @@ module LayoutHelper |
| 93 | 93 | end |
| 94 | 94 | |
| 95 | 95 | def meta_description_tag(article=nil) |
| 96 | - article ? truncate(strip_tags(article.body.to_s), :length => 200) : environment.name | |
| 96 | + article ? CGI.escapeHTML(truncate(strip_tags(article.body.to_s), :length => 200)) : environment.name | |
| 97 | 97 | end |
| 98 | 98 | end |
| 99 | 99 | ... | ... |
app/models/block.rb
| ... | ... | @@ -230,7 +230,7 @@ class Block < ActiveRecord::Base |
| 230 | 230 | duplicated_block.created_at = nil |
| 231 | 231 | duplicated_block.updated_at = nil |
| 232 | 232 | duplicated_block.save! |
| 233 | - duplicated_block.insert_at(self.position + 1) | |
| 233 | + duplicated_block.insert_at((self.position || 0) + 1) | |
| 234 | 234 | duplicated_block |
| 235 | 235 | end |
| 236 | 236 | ... | ... |
app/models/profile.rb
app/models/user.rb
app/views/content_viewer/view_page.html.erb
| ... | ... | @@ -72,7 +72,7 @@ |
| 72 | 72 | |
| 73 | 73 | <div class="comments" id="comments_list"> |
| 74 | 74 | |
| 75 | - <% if @page.accept_comments? || @comments_count > 0 %> | |
| 75 | + <% if @page.accept_comments? || (@comments_count.present? && @comments_count > 0) %> | |
| 76 | 76 | <h3 <%= 'class="no-comments-yet"' if @comments_count == 0 %>> |
| 77 | 77 | <%= display_number_of_comments(@comments_count) %> |
| 78 | 78 | </h3> | ... | ... |
app/views/layouts/application-ng.html.erb
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | <meta property="og:url" content="<%= @page ? url_for(@page.url) : @environment.top_url %>"> |
| 18 | 18 | <meta property="og:title" content="<%= h page_title %>"> |
| 19 | 19 | <meta property="og:site_name" content="<%= profile ? profile.name : @environment.name %>"> |
| 20 | - <meta property="og:description" content="<%= @page ? truncate(strip_tags(@page.body.to_s), :length => 200) : @environment.name %>"> | |
| 20 | + <meta property="og:description" content="<%= meta_description_tag(@page) %>"> | |
| 21 | 21 | |
| 22 | 22 | <!-- site root --> |
| 23 | 23 | <meta property="noosfero:root" content="<%= Noosfero.root %>"/> | ... | ... |
app/views/profile/_profile_activities_list.html.erb
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | <% activities.each do |a| %> |
| 3 | 3 | <% activity = a.klass.constantize.find(a.id) %> |
| 4 | 4 | <% if activity.kind_of?(ActionTracker::Record) %> |
| 5 | + <% next unless activity.target %> | |
| 5 | 6 | <%= render :partial => 'profile_activity', :locals => { :activity => activity, :tab_action => 'wall' } if activity.visible? %> |
| 6 | 7 | <% else %> |
| 7 | 8 | <%= render :partial => 'profile_scraps', :locals => { :activity => activity, :scrap => activity } %> | ... | ... |
lib/tasks/ci.rake
| ... | ... | @@ -35,7 +35,7 @@ namespace :ci do |
| 35 | 35 | |
| 36 | 36 | sh 'testrb', '-Itest', *tests unless tests.empty? |
| 37 | 37 | sh 'cucumber', *features unless features.empty? |
| 38 | - sh 'cucumber', '-p', 'selenium', *features unless features.empty? | |
| 38 | + sh 'xvfb-run', 'cucumber', '-p', 'selenium', *features unless features.empty? | |
| 39 | 39 | |
| 40 | 40 | changed_plugins.each do |plugin| |
| 41 | 41 | task = "test:noosfero_plugins:#{plugin}" | ... | ... |
lib/user_activation_job.rb
plugins/comment_paragraph/lib/ext/article.rb
| ... | ... | @@ -8,7 +8,7 @@ class Article |
| 8 | 8 | |
| 9 | 9 | def body_change_with_comments |
| 10 | 10 | if body && body_changed? && !self.comments.empty? |
| 11 | - paragraphs_with_comments = self.comments.where("'paragraph_id' IS NOT NULL") | |
| 11 | + paragraphs_with_comments = self.comments.where("paragraph_id IS NOT NULL") | |
| 12 | 12 | errors[:base] << (N_('You are unable to change the body of the article when paragraphs are commented')) unless (paragraphs_with_comments).empty? |
| 13 | 13 | end |
| 14 | 14 | end | ... | ... |
plugins/community_track/lib/community_track_plugin.rb
| ... | ... | @@ -13,8 +13,7 @@ class CommunityTrackPlugin < Noosfero::Plugin |
| 13 | 13 | end |
| 14 | 14 | |
| 15 | 15 | def content_types |
| 16 | - return [] if !context.kind_of?(CmsController) | |
| 17 | - if context.respond_to?(:params) && context.params | |
| 16 | + if context.kind_of?(CmsController) && context.respond_to?(:params) && context.params | |
| 18 | 17 | types = [] |
| 19 | 18 | parent_id = context.params[:parent_id] |
| 20 | 19 | types << CommunityTrackPlugin::Track if context.profile.community? && !parent_id | ... | ... |
plugins/community_track/test/unit/community_track_plugin_test.rb
| ... | ... | @@ -7,6 +7,7 @@ class CommunityTrackPluginTest < ActiveSupport::TestCase |
| 7 | 7 | @profile = fast_create(Community) |
| 8 | 8 | @params = {} |
| 9 | 9 | @context = mock |
| 10 | + @context.stubs(:kind_of?).returns(CmsController) | |
| 10 | 11 | @context.stubs(:profile).returns(@profile) |
| 11 | 12 | @context.stubs(:params).returns(@params) |
| 12 | 13 | @plugin.stubs(:context).returns(@context) | ... | ... |
plugins/oauth_client/public/style.css
plugins/oauth_client/views/oauth_client_plugin_admin/index.html.erb
plugins/oauth_provider/controllers/oauth_provider_authorizations_controller.rb
0 → 100644
plugins/oauth_provider/lib/oauth_provider_plugin.rb
| ... | ... | @@ -8,6 +8,10 @@ class OauthProviderPlugin < Noosfero::Plugin |
| 8 | 8 | _("Oauth Provider.") |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | + def stylesheet? | |
| 12 | + true | |
| 13 | + end | |
| 14 | + | |
| 11 | 15 | Doorkeeper.configure do |
| 12 | 16 | orm :active_record |
| 13 | 17 | |
| ... | ... | @@ -36,7 +40,8 @@ class OauthProviderPlugin < Noosfero::Plugin |
| 36 | 40 | use_doorkeeper do |
| 37 | 41 | controllers ({ |
| 38 | 42 | :applications => 'oauth_provider_applications', |
| 39 | - :authorized_applications => 'oauth_provider_authorized_applications' | |
| 43 | + :authorized_applications => 'oauth_provider_authorized_applications', | |
| 44 | + :authorizations => 'oauth_provider_authorizations' | |
| 40 | 45 | }) |
| 41 | 46 | end |
| 42 | 47 | end | ... | ... |
| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | +.oauth-provider-authorize .actions form { | |
| 2 | + display: inline-block; | |
| 3 | +} | |
| 4 | +.oauth-provider-authorize .h4 { | |
| 5 | + font-size: 14px; | |
| 6 | + color: rgb(36, 36, 36) | |
| 7 | +} | |
| 8 | +.oauth-provider-authorize #oauth-permissions { | |
| 9 | + color: rgb(92, 92, 92); | |
| 10 | +} | |
| 11 | +.oauth-provider .actions { | |
| 12 | + margin-top: 10px; | |
| 13 | +} | ... | ... |
plugins/oauth_provider/views/doorkeeper/applications/index.html.erb
| 1 | +<div class="oauth-provider"> | |
| 1 | 2 | <div class="page-header"> |
| 2 | 3 | <h3><%= link_to _('Oauh Provider'), '/admin/plugin/oauth_provider' %></h3> |
| 3 | 4 | </div> |
| ... | ... | @@ -24,3 +25,7 @@ |
| 24 | 25 | <% end %> |
| 25 | 26 | </tbody> |
| 26 | 27 | </table> |
| 28 | +<div class="actions"> | |
| 29 | + <%= button(:back, _('Go back'), {:controller => 'oauth_provider_plugin_admin', :action => 'index'}) %> | |
| 30 | +</div> | |
| 31 | +</div> | ... | ... |
plugins/oauth_provider/views/doorkeeper/authorizations/new.html.erb
| 1 | +<div class="oauth-provider-authorize"> | |
| 2 | + | |
| 1 | 3 | <header class="page-header" role="banner"> |
| 2 | 4 | <h1><%= _('Authorize required') %></h1> |
| 3 | 5 | </header> |
| ... | ... | @@ -26,7 +28,7 @@ |
| 26 | 28 | <%= hidden_field_tag :state, @pre_auth.state %> |
| 27 | 29 | <%= hidden_field_tag :response_type, @pre_auth.response_type %> |
| 28 | 30 | <%= hidden_field_tag :scope, @pre_auth.scope %> |
| 29 | - <%= submit_tag _("Authorize"), class: "btn btn-success btn-lg btn-block" %> | |
| 31 | + <%= submit_button :ok, _("Authorize") %> | |
| 30 | 32 | <% end %> |
| 31 | 33 | <%= form_tag oauth_authorization_path, method: :delete do %> |
| 32 | 34 | <%= hidden_field_tag :client_id, @pre_auth.client.uid %> |
| ... | ... | @@ -34,7 +36,8 @@ |
| 34 | 36 | <%= hidden_field_tag :state, @pre_auth.state %> |
| 35 | 37 | <%= hidden_field_tag :response_type, @pre_auth.response_type %> |
| 36 | 38 | <%= hidden_field_tag :scope, @pre_auth.scope %> |
| 37 | - <%= submit_tag _("Deny"), class: "btn btn-danger btn-lg btn-block" %> | |
| 39 | + <%= submit_button :cancel, _("Deny") %> | |
| 38 | 40 | <% end %> |
| 39 | 41 | </div> |
| 40 | 42 | </main> |
| 43 | +</div> | ... | ... |
plugins/oauth_provider/views/doorkeeper/authorized_applications/index.html.erb
plugins/oauth_provider/views/oauth_provider_plugin_admin/index.html.erb
plugins/people_block/controllers/people_block_plugin_profile_controller.rb
| ... | ... | @@ -6,12 +6,13 @@ class PeopleBlockPluginProfileController < ProfileController |
| 6 | 6 | if is_cache_expired?(profile.members_cache_key(params)) |
| 7 | 7 | unless params[:role_key].blank? |
| 8 | 8 | role = Role.find_by_key_and_environment_id(params[:role_key], profile.environment) |
| 9 | - @members = profile.members.with_role(role.id).includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage]) | |
| 9 | + @members = profile.members.with_role(role.id) | |
| 10 | 10 | @members_title = role.name |
| 11 | 11 | else |
| 12 | - @members = profile.members.includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage]) | |
| 12 | + @members = profile.members | |
| 13 | 13 | @members_title = 'members' |
| 14 | 14 | end |
| 15 | + @members = @members.includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage], :total_entries => @members.count) | |
| 15 | 16 | end |
| 16 | 17 | render "profile/members" |
| 17 | 18 | end | ... | ... |
plugins/proposals_discussion/lib/proposals_discussion_plugin/discussion.rb
plugins/proposals_discussion/lib/proposals_discussion_plugin/topic.rb
public/designs/themes/base/footer.html.erb
| 1 | 1 | <div id="footer-links"> |
| 2 | - <a id="link-to-doc" class='icon-help'><%= link_to _('Manual'), '/doc' %></a> | |
| 2 | + <%= link_to _('Manual'), '/doc', id: "link-to-doc", class: 'icon-help' %> | |
| 3 | 3 | </div><!-- end id="footer-links" --> |
| 4 | 4 | <div id="copyright"> |
| 5 | 5 | <p><%= _('This social network uses <a href="http://noosfero.org/">Noosfero</a>, developed by %s and licensed under the <a href="http://www.gnu.org/licenses/agpl.html">GNU Affero General Public License</a> version 3 or any later version.') % link_to('Colivre', 'http://colivre.coop.br/') %></p> | ... | ... |
public/stylesheets/application.css
| ... | ... | @@ -2007,7 +2007,7 @@ a.button.disabled, input.disabled { |
| 2007 | 2007 | } |
| 2008 | 2008 | #content .comment-header .comment-actions-reply { |
| 2009 | 2009 | float: right; |
| 2010 | - background-image: url(../designs/icons/tango/Tango/16x16/actions/go-jump.png); | |
| 2010 | + background-image: url(/designs/icons/tango/Tango/16x16/actions/go-jump.png); | |
| 2011 | 2011 | height: 12px; |
| 2012 | 2012 | } |
| 2013 | 2013 | #content .comment-header ul { | ... | ... |
test/unit/user_activation_job_test.rb
| ... | ... | @@ -29,6 +29,17 @@ class NotifyActivityToProfilesJobTest < ActiveSupport::TestCase |
| 29 | 29 | end |
| 30 | 30 | end |
| 31 | 31 | |
| 32 | + should 'not destroy user if not activated but is template' do | |
| 33 | + user = new_user :login => 'test3' | |
| 34 | + user.person.is_template = true | |
| 35 | + user.person.save | |
| 36 | + job = UserActivationJob.new(user.id) | |
| 37 | + assert_no_difference 'User.count' do | |
| 38 | + job.perform | |
| 39 | + process_delayed_job_queue | |
| 40 | + end | |
| 41 | + end | |
| 42 | + | |
| 32 | 43 | protected |
| 33 | 44 | def new_user(options = {}) |
| 34 | 45 | user = User.new({ :login => 'quire', :email => 'quire@example.com', :password => 'quire', :password_confirmation => 'quire' }.merge(options)) | ... | ... |
test/unit/user_test.rb
| ... | ... | @@ -525,6 +525,13 @@ class UserTest < ActiveSupport::TestCase |
| 525 | 525 | assert_match /UserActivationJob/, Delayed::Job.last.handler |
| 526 | 526 | end |
| 527 | 527 | |
| 528 | + should 'not create job to check activation to template users' do | |
| 529 | + Person.any_instance.stubs(:is_template?).returns(true) | |
| 530 | + | |
| 531 | + user = new_user | |
| 532 | + assert_equal 0, Delayed::Job.by_handler("--- !ruby/struct:UserActivationJob\nuser_id: #{user.id}\n").count | |
| 533 | + end | |
| 534 | + | |
| 528 | 535 | should 'deactivate an user' do |
| 529 | 536 | user = new_user |
| 530 | 537 | user.activate | ... | ... |