Commit 0273bf74fddf75bb90dcf5c5d13f015770a4e6d4
Exists in
master
and in
27 other branches
Merge remote-tracking branch 'origin/master'
Showing
8 changed files
with
39 additions
and
16 deletions
Show diff stats
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
| ... | ... | @@ -91,7 +91,7 @@ module LayoutHelper |
| 91 | 91 | end |
| 92 | 92 | |
| 93 | 93 | def meta_description_tag(article=nil) |
| 94 | - article ? truncate(strip_tags(article.body.to_s), :length => 200) : environment.name | |
| 94 | + article ? CGI.escapeHTML(truncate(strip_tags(article.body.to_s), :length => 200)) : environment.name | |
| 95 | 95 | end |
| 96 | 96 | end |
| 97 | 97 | ... | ... |
app/models/user.rb
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 %>"/> | ... | ... |
lib/user_activation_job.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> | ... | ... |
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 | ... | ... |