Commit 2a69ff0063e8fbc0cc8c69ebf7c375e19b0514ee

Authored by Leandro Santos
2 parents 076e26f5 790467eb

Merge branch 'master' of gitlab.com:noosfero/noosfero

config/initializers/delayed_job_config.rb
@@ -23,3 +23,13 @@ end @@ -23,3 +23,13 @@ end
23 # end 23 # end
24 # alias_method_chain :handle_failed_job, :loggin 24 # alias_method_chain :handle_failed_job, :loggin
25 #end 25 #end
  26 +
  27 +# Chain delayed job's handle_failed_job method to do exception notification
  28 +Delayed::Worker.class_eval do
  29 + def handle_failed_job_with_notification job, error
  30 + handle_failed_job_without_notification job, error
  31 + ExceptionNotifier.notify_exception error, exception_recipients: NOOSFERO_CONF['exception_recipients'],
  32 + data: {job: job, handler: job.handler} rescue nil
  33 + end
  34 + alias_method_chain :handle_failed_job, :notification
  35 +end
po/pt/noosfero.po
@@ -13,8 +13,8 @@ msgid "" @@ -13,8 +13,8 @@ msgid ""
13 msgstr "" 13 msgstr ""
14 "Project-Id-Version: 1.1-166-gaf47713\n" 14 "Project-Id-Version: 1.1-166-gaf47713\n"
15 "POT-Creation-Date: 2015-06-01 17:26-0300\n" 15 "POT-Creation-Date: 2015-06-01 17:26-0300\n"
16 -"PO-Revision-Date: 2015-06-02 02:14+0200\n"  
17 -"Last-Translator: Eduardo Vital <vitaldu@gmail.com>\n" 16 +"PO-Revision-Date: 2015-06-02 19:44+0200\n"
  17 +"Last-Translator: Arthur Del Esposte <arthurmde@gmail.com>\n"
18 "Language-Team: Portuguese " 18 "Language-Team: Portuguese "
19 "<https://hosted.weblate.org/projects/noosfero/noosfero/pt/>\n" 19 "<https://hosted.weblate.org/projects/noosfero/noosfero/pt/>\n"
20 "Language: pt\n" 20 "Language: pt\n"
@@ -378,9 +378,8 @@ msgid &quot;Manage environment users&quot; @@ -378,9 +378,8 @@ msgid &quot;Manage environment users&quot;
378 msgstr "Gerenciar usuários do ambiente" 378 msgstr "Gerenciar usuários do ambiente"
379 379
380 #: app/models/environment.rb:32 380 #: app/models/environment.rb:32
381 -#, fuzzy  
382 msgid "Manage environment organizations" 381 msgid "Manage environment organizations"
383 -msgstr "Gerenciar ambiente de validadores" 382 +msgstr "Gerenciar organizações do ambiente"
384 383
385 #: app/models/environment.rb:33 384 #: app/models/environment.rb:33
386 msgid "Manage environment templates" 385 msgid "Manage environment templates"
@@ -697,14 +696,12 @@ msgstr &quot;&quot; @@ -697,14 +696,12 @@ msgstr &quot;&quot;
697 "podem ser feitas." 696 "podem ser feitas."
698 697
699 #: app/models/forum.rb:38 698 #: app/models/forum.rb:38
700 -#, fuzzy  
701 msgid "Logged users" 699 msgid "Logged users"
702 -msgstr "Identificado(a) como %s" 700 +msgstr "Usuários logados"
703 701
704 #: app/models/forum.rb:41 702 #: app/models/forum.rb:41
705 -#, fuzzy  
706 msgid "Me" 703 msgid "Me"
707 -msgstr "Masculino" 704 +msgstr "Eu"
708 705
709 #: app/models/forum.rb:42 app/models/block.rb:250 706 #: app/models/forum.rb:42 app/models/block.rb:250
710 #: app/helpers/application_helper.rb:563 707 #: app/helpers/application_helper.rb:563
@@ -712,9 +709,8 @@ msgid &quot;Friends&quot; @@ -712,9 +709,8 @@ msgid &quot;Friends&quot;
712 msgstr "Amigos" 709 msgstr "Amigos"
713 710
714 #: app/models/forum.rb:45 711 #: app/models/forum.rb:45
715 -#, fuzzy  
716 msgid "Administrators" 712 msgid "Administrators"
717 -msgstr "Administração" 713 +msgstr "Administradores"
718 714
719 #: app/models/forum.rb:46 app/models/block.rb:250 715 #: app/models/forum.rb:46 app/models/block.rb:250
720 #: app/helpers/profile_helper.rb:43 app/helpers/application_helper.rb:571 716 #: app/helpers/profile_helper.rb:43 app/helpers/application_helper.rb:571
@@ -1831,14 +1827,12 @@ msgid &quot;Article suggestion&quot; @@ -1831,14 +1827,12 @@ msgid &quot;Article suggestion&quot;
1831 msgstr "Sugestão de artigo" 1827 msgstr "Sugestão de artigo"
1832 1828
1833 #: app/models/suggest_article.rb:64 1829 #: app/models/suggest_article.rb:64
1834 -#, fuzzy  
1835 msgid "%{requestor} suggested the publication of the article: %{subject}." 1830 msgid "%{requestor} suggested the publication of the article: %{subject}."
1836 -msgstr "%{sender} sugeriu a publicação do artigo: %{subject}." 1831 +msgstr "%{requestor} sugeriu a publicação do artigo: %{subject}."
1837 1832
1838 #: app/models/suggest_article.rb:77 1833 #: app/models/suggest_article.rb:77
1839 -#, fuzzy  
1840 msgid "%{requestor} suggested the publication of the article: %{article}." 1834 msgid "%{requestor} suggested the publication of the article: %{article}."
1841 -msgstr "%{sender} sugeriu a publicação do artigo %{article}." 1835 +msgstr "%{requestor} sugeriu a publicação do artigo %{article}."
1842 1836
1843 #: app/models/rss_feed.rb:6 1837 #: app/models/rss_feed.rb:6
1844 msgid "RssFeed" 1838 msgid "RssFeed"
@@ -2221,11 +2215,11 @@ msgstr &quot;Não logado&quot; @@ -2221,11 +2215,11 @@ msgstr &quot;Não logado&quot;
2221 2215
2222 #: app/models/block.rb:256 2216 #: app/models/block.rb:256
2223 msgid "Can be modified" 2217 msgid "Can be modified"
2224 -msgstr "" 2218 +msgstr "Pode ser modificada"
2225 2219
2226 #: app/models/block.rb:257 2220 #: app/models/block.rb:257
2227 msgid "Cannot be modified" 2221 msgid "Cannot be modified"
2228 -msgstr "" 2222 +msgstr "Não pode ser modificada"
2229 2223
2230 #: app/models/block.rb:263 2224 #: app/models/block.rb:263
2231 msgid "Can be moved" 2225 msgid "Can be moved"
@@ -2563,9 +2557,8 @@ msgid &quot;Public&quot; @@ -2563,9 +2557,8 @@ msgid &quot;Public&quot;
2563 msgstr "Público" 2557 msgstr "Público"
2564 2558
2565 #: app/helpers/application_helper.rb:944 2559 #: app/helpers/application_helper.rb:944
2566 -#, fuzzy  
2567 msgid "Clone %s" 2560 msgid "Clone %s"
2568 -msgstr "Clonar" 2561 +msgstr "Clonar %s"
2569 2562
2570 #: app/helpers/application_helper.rb:958 2563 #: app/helpers/application_helper.rb:958
2571 msgid "Online Manual" 2564 msgid "Online Manual"
@@ -2842,21 +2835,20 @@ msgid &quot;See all connections&quot; @@ -2842,21 +2835,20 @@ msgid &quot;See all connections&quot;
2842 msgstr "Ver todas as conexões" 2835 msgstr "Ver todas as conexões"
2843 2836
2844 #: app/helpers/application_helper.rb:1518 2837 #: app/helpers/application_helper.rb:1518
2845 -#, fuzzy  
2846 msgid "Full screen" 2838 msgid "Full screen"
2847 -msgstr "Post completo" 2839 +msgstr "Tela cheia"
2848 2840
2849 #: app/helpers/application_helper.rb:1523 2841 #: app/helpers/application_helper.rb:1523
2850 msgid "Go to full screen mode" 2842 msgid "Go to full screen mode"
2851 -msgstr "" 2843 +msgstr "Ir para o modo tela cheia"
2852 2844
2853 #: app/helpers/application_helper.rb:1526 2845 #: app/helpers/application_helper.rb:1526
2854 msgid "Exit full screen" 2846 msgid "Exit full screen"
2855 -msgstr "" 2847 +msgstr "Sair da tela cheia"
2856 2848
2857 #: app/helpers/application_helper.rb:1532 2849 #: app/helpers/application_helper.rb:1532
2858 msgid "Exit full screen mode" 2850 msgid "Exit full screen mode"
2859 -msgstr "" 2851 +msgstr "Sair do modo tela cheia"
2860 2852
2861 #: app/helpers/manage_products_helper.rb:156 2853 #: app/helpers/manage_products_helper.rb:156
2862 #: app/views/manage_products/_display_category.html.erb:3 2854 #: app/views/manage_products/_display_category.html.erb:3
@@ -2988,9 +2980,8 @@ msgid &quot;search in all categories&quot; @@ -2988,9 +2980,8 @@ msgid &quot;search in all categories&quot;
2988 msgstr "procurar em todas as categorias" 2980 msgstr "procurar em todas as categorias"
2989 2981
2990 #: app/helpers/search_helper.rb:158 2982 #: app/helpers/search_helper.rb:158
2991 -#, fuzzy  
2992 msgid "Choose a template" 2983 msgid "Choose a template"
2993 -msgstr "O modelo \"%s\"" 2984 +msgstr "Escolha um template"
2994 2985
2995 #: app/helpers/boxes_helper.rb:106 2986 #: app/helpers/boxes_helper.rb:106
2996 msgid "This block is invisible. Your visitors will not see it." 2987 msgid "This block is invisible. Your visitors will not see it."
@@ -4081,9 +4072,8 @@ msgid &quot;Community fields not updated successfully.&quot; @@ -4081,9 +4072,8 @@ msgid &quot;Community fields not updated successfully.&quot;
4081 msgstr "Campos de comunidade não atualizados com sucesso." 4072 msgstr "Campos de comunidade não atualizados com sucesso."
4082 4073
4083 #: app/controllers/admin/organizations_controller.rb:7 4074 #: app/controllers/admin/organizations_controller.rb:7
4084 -#, fuzzy  
4085 msgid "Organization profiles" 4075 msgid "Organization profiles"
4086 -msgstr "Método de Aprovação de Organização" 4076 +msgstr "Perfis de organizações"
4087 4077
4088 #: app/controllers/admin/organizations_controller.rb:9 4078 #: app/controllers/admin/organizations_controller.rb:9
4089 #: app/views/tasks/index.html.erb:7 app/views/tasks/index.html.erb:34 4079 #: app/views/tasks/index.html.erb:7 app/views/tasks/index.html.erb:34
@@ -4093,9 +4083,8 @@ msgid &quot;All&quot; @@ -4093,9 +4083,8 @@ msgid &quot;All&quot;
4093 msgstr "Todos" 4083 msgstr "Todos"
4094 4084
4095 #: app/controllers/admin/organizations_controller.rb:33 4085 #: app/controllers/admin/organizations_controller.rb:33
4096 -#, fuzzy  
4097 msgid "%s enabled" 4086 msgid "%s enabled"
4098 -msgstr "%s não foi habilitado." 4087 +msgstr "%s habilitado"
4099 4088
4100 #: app/controllers/admin/organizations_controller.rb:35 4089 #: app/controllers/admin/organizations_controller.rb:35
4101 #, fuzzy 4090 #, fuzzy
@@ -4103,9 +4092,8 @@ msgid &quot;%s could not be enabled&quot; @@ -4103,9 +4092,8 @@ msgid &quot;%s could not be enabled&quot;
4103 msgstr "%s não pode ser enviado" 4092 msgstr "%s não pode ser enviado"
4104 4093
4105 #: app/controllers/admin/organizations_controller.rb:42 4094 #: app/controllers/admin/organizations_controller.rb:42
4106 -#, fuzzy  
4107 msgid "%s disabled" 4095 msgid "%s disabled"
4108 -msgstr "Desabilitado" 4096 +msgstr "%s desabilitado"
4109 4097
4110 #: app/controllers/admin/organizations_controller.rb:44 4098 #: app/controllers/admin/organizations_controller.rb:44
4111 #, fuzzy 4099 #, fuzzy
@@ -4568,9 +4556,8 @@ msgid &quot;Files&quot; @@ -4568,9 +4556,8 @@ msgid &quot;Files&quot;
4568 msgstr "Arquivos" 4556 msgstr "Arquivos"
4569 4557
4570 #: app/controllers/my_profile/profile_roles_controller.rb:52 4558 #: app/controllers/my_profile/profile_roles_controller.rb:52
4571 -#, fuzzy  
4572 msgid "Role successfuly removed!" 4559 msgid "Role successfuly removed!"
4573 -msgstr "Produto removido com sucesso" 4560 +msgstr "Papel removido com sucesso!"
4574 4561
4575 #: app/controllers/my_profile/profile_roles_controller.rb:54 4562 #: app/controllers/my_profile/profile_roles_controller.rb:54
4576 #, fuzzy 4563 #, fuzzy
@@ -4579,7 +4566,7 @@ msgstr &quot;Falhou em criar papel&quot; @@ -4579,7 +4566,7 @@ msgstr &quot;Falhou em criar papel&quot;
4579 4566
4580 #: app/controllers/my_profile/profile_roles_controller.rb:85 4567 #: app/controllers/my_profile/profile_roles_controller.rb:85
4581 msgid "Error" 4568 msgid "Error"
4582 -msgstr "" 4569 +msgstr "Erro"
4583 4570
4584 #: app/controllers/my_profile/tasks_controller.rb:28 4571 #: app/controllers/my_profile/tasks_controller.rb:28
4585 #, fuzzy 4572 #, fuzzy
vendor/plugins/delayed_job/lib/delayed/backend/base.rb
@@ -73,9 +73,8 @@ module Delayed @@ -73,9 +73,8 @@ module Delayed
73 ParseObjectFromYaml = /\!ruby\/\w+\:([^\s]+)/ 73 ParseObjectFromYaml = /\!ruby\/\w+\:([^\s]+)/
74 74
75 def name 75 def name
76 - @name ||= payload_object.respond_to?(:display_name) ?  
77 - payload_object.display_name :  
78 - payload_object.class.name 76 + obj = payload_object
  77 + @name ||= obj.respond_to?(:display_name) ? obj.display_name : obj.class.name
79 rescue DeserializationError 78 rescue DeserializationError
80 ParseObjectFromYaml.match(handler)[1] 79 ParseObjectFromYaml.match(handler)[1]
81 end 80 end
vendor/plugins/monkey_patches/init.rb
1 -require File.join(File.dirname(__FILE__), 'attachment_fu_validates_attachment/init')  
2 -require File.join(File.dirname(__FILE__), 'attachment_fu/init')  
3 -require File.join(File.dirname(__FILE__), 'white_list_sanitizer_unescape_before_reescape/init') 1 +require_relative 'attachment_fu_validates_attachment/init'
  2 +require_relative 'attachment_fu/init'
  3 +require_relative 'white_list_sanitizer_unescape_before_reescape/init'
vendor/plugins/monkey_patches/rescue_delayed_job_crashes/init.rb
@@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
1 -Delayed::Worker.module_eval do  
2 - # based on https://groups.google.com/forum/#!topic/delayed_job/ZGMUFFppNgs  
3 - class Delayed::Worker::ExceptionNotification < ActionMailer::Base  
4 - def mail job, error  
5 - environment = Environment.default  
6 -  
7 - recipients NOOSFERO_CONF['exception_recipients']  
8 - from environment.noreply_email  
9 - reply_to environment.noreply_email  
10 - subject "[#{environment.name}] DelayedJob ##{job.id}: #{error.message}"  
11 - body render(:text => "  
12 -Job:  
13 -#{job.inspect}  
14 -  
15 -Handler:  
16 -#{job.handler}  
17 -  
18 -Backtrace:  
19 -#{error.backtrace.join("\n")}  
20 - ")  
21 - end  
22 - end  
23 -  
24 - def handle_failed_job_with_notification(job, error)  
25 - Delayed::Worker::ExceptionNotification.deliver_mail job, error if NOOSFERO_CONF['exception_recipients'].present?  
26 - handle_failed_job_without_notification job, error  
27 - end  
28 - alias_method_chain :handle_failed_job, :notification  
29 -  
30 - def handle_failed_job_with_rescue(job, error)  
31 - handle_failed_job_without_rescue(job, error)  
32 - rescue => e # don't crash here  
33 - end  
34 - alias_method_chain :handle_failed_job, :rescue  
35 -  
36 - protected  
37 -  
38 - # This code must be replicated because there is no other way to pass the job  
39 - # through and use alias_method_chain as we used on the previous method  
40 - def reserve_and_run_one_job  
41 - # We get up to 5 jobs from the db. In case we cannot get exclusive access to a job we try the next.  
42 - # this leads to a more even distribution of jobs across the worker processes  
43 - job = Delayed::Job.find_available(name, 5, self.class.max_run_time).detect do |job|  
44 - if job.lock_exclusively!(self.class.max_run_time, name)  
45 - say "acquired lock on #{job.name}"  
46 - true  
47 - else  
48 - say "failed to acquire exclusive lock for #{job.name}", Logger::WARN  
49 - false  
50 - end  
51 - end  
52 -  
53 - run(job) if job  
54 - rescue => e  
55 - handle_failed_job(job, e)  
56 - end  
57 -end