Commit 4c75b9bdf3503d23e04cec9dd6854dbf59774469

Authored by Daniela Feitosa
2 parents e22c4b28 a349f151

Merge branch 'stable' into noosfero_0.47.0

Conflicts:
	test/unit/block_test.rb
app/models/block.rb
... ... @@ -141,7 +141,7 @@ class Block < ActiveRecord::Base
141 141 end
142 142  
143 143 alias :active_record_cache_key :cache_key
144   - def cache_key(language='en')
  144 + def cache_key(language='en', user=nil)
145 145 active_record_cache_key+'-'+language
146 146 end
147 147  
... ...
app/models/members_block.rb
... ... @@ -36,4 +36,15 @@ class MembersBlock < ProfileListBlock
36 36 }
37 37 end
38 38  
  39 + def cache_key(language='en', user=nil)
  40 + logged = ''
  41 + if user
  42 + logged += '-logged-in'
  43 + if user.is_member_of? self.owner
  44 + logged += '-member'
  45 + end
  46 + end
  47 + super + logged
  48 + end
  49 +
39 50 end
... ...
app/views/shared/block.rhtml
1 1 <% if block.cacheable? && use_cache %>
2   - <% cache_timeout(block.cache_key(language), block.timeout) do %>
  2 + <% cache_timeout(block.cache_key(language, user), block.timeout) do %>
3 3 <%= display_block_content(block, user, main_content) %>
4 4 <% end %>
5 5 <% else %>
... ...
po/eo/noosfero.po
... ... @@ -7,7 +7,7 @@ msgid &quot;&quot;
7 7 msgstr ""
8 8 "Project-Id-Version: noosfero 0.45.2\n"
9 9 "POT-Creation-Date: 2014-01-17 18:26-0000\n"
10   -"PO-Revision-Date: 2011-03-30 20:52-0300\n"
  10 +"PO-Revision-Date: 2014-03-25 15:35+0000\n"
11 11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 12 "Language-Team: LANGUAGE <LL@li.org>\n"
13 13 "Language: eo\n"
... ... @@ -107,7 +107,7 @@ msgstr &quot;&quot;
107 107 #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:25
108 108 #: app/views/profile/_private_profile.rhtml:10
109 109 msgid "Join"
110   -msgstr ""
  110 +msgstr "Eniri"
111 111  
112 112 #: app/helpers/application_helper.rb:554
113 113 #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:4
... ... @@ -291,7 +291,7 @@ msgstr &quot;&quot;
291 291  
292 292 #: app/helpers/application_helper.rb:1118
293 293 msgid "See all"
294   -msgstr ""
  294 +msgstr "Vidi ĉiujn"
295 295  
296 296 #: app/helpers/application_helper.rb:1121
297 297 msgid "<span>Manage</span> %s"
... ... @@ -678,11 +678,11 @@ msgstr &quot;&quot;
678 678  
679 679 #: app/helpers/forum_helper.rb:14 app/helpers/blog_helper.rb:23
680 680 msgid "&laquo; Newer posts"
681   -msgstr ""
  681 +msgstr "&laquo; Pli freŝaj afiŝoj"
682 682  
683 683 #: app/helpers/forum_helper.rb:15 app/helpers/blog_helper.rb:24
684 684 msgid "Older posts &raquo;"
685   -msgstr ""
  685 +msgstr "Malpli freŝaj afiŝoj &raquo"
686 686  
687 687 #: app/helpers/forum_helper.rb:18
688 688 msgid "Discussion topic"
... ... @@ -763,63 +763,63 @@ msgstr &quot;&quot;
763 763 #: app/helpers/dates_helper.rb:7 app/helpers/forms_helper.rb:172
764 764 #: plugins/display_content/lib/display_content_block.rb:4
765 765 msgid "January"
766   -msgstr ""
  766 +msgstr "Januaro"
767 767  
768 768 #: app/helpers/dates_helper.rb:8 app/helpers/forms_helper.rb:172
769 769 #: plugins/display_content/lib/display_content_block.rb:5
770 770 msgid "February"
771   -msgstr ""
  771 +msgstr "Februaro"
772 772  
773 773 #: app/helpers/dates_helper.rb:9 app/helpers/forms_helper.rb:172
774 774 #: plugins/display_content/lib/display_content_block.rb:6
775 775 msgid "March"
776   -msgstr ""
  776 +msgstr "Marto"
777 777  
778 778 #: app/helpers/dates_helper.rb:10 app/helpers/forms_helper.rb:172
779 779 #: plugins/display_content/lib/display_content_block.rb:7
780 780 msgid "April"
781   -msgstr ""
  781 +msgstr "Aprilo"
782 782  
783 783 #: app/helpers/dates_helper.rb:11 app/helpers/forms_helper.rb:172
784 784 #: app/helpers/forms_helper.rb:173
785 785 #: plugins/display_content/lib/display_content_block.rb:8
786 786 msgid "May"
787   -msgstr ""
  787 +msgstr "Majo"
788 788  
789 789 #: app/helpers/dates_helper.rb:12 app/helpers/forms_helper.rb:172
790 790 #: plugins/display_content/lib/display_content_block.rb:9
791 791 msgid "June"
792   -msgstr ""
  792 +msgstr "Junio"
793 793  
794 794 #: app/helpers/dates_helper.rb:13 app/helpers/forms_helper.rb:172
795 795 #: plugins/display_content/lib/display_content_block.rb:10
796 796 msgid "July"
797   -msgstr ""
  797 +msgstr "Julio"
798 798  
799 799 #: app/helpers/dates_helper.rb:14 app/helpers/forms_helper.rb:172
800 800 #: plugins/display_content/lib/display_content_block.rb:11
801 801 msgid "August"
802   -msgstr ""
  802 +msgstr "Aŭgusto"
803 803  
804 804 #: app/helpers/dates_helper.rb:15 app/helpers/forms_helper.rb:172
805 805 #: plugins/display_content/lib/display_content_block.rb:12
806 806 msgid "September"
807   -msgstr ""
  807 +msgstr "Septembro"
808 808  
809 809 #: app/helpers/dates_helper.rb:16 app/helpers/forms_helper.rb:172
810 810 #: plugins/display_content/lib/display_content_block.rb:13
811 811 msgid "October"
812   -msgstr ""
  812 +msgstr "Oktobro"
813 813  
814 814 #: app/helpers/dates_helper.rb:17 app/helpers/forms_helper.rb:172
815 815 #: plugins/display_content/lib/display_content_block.rb:14
816 816 msgid "November"
817   -msgstr ""
  817 +msgstr "Novembro"
818 818  
819 819 #: app/helpers/dates_helper.rb:18 app/helpers/forms_helper.rb:172
820 820 #: plugins/display_content/lib/display_content_block.rb:15
821 821 msgid "December"
822   -msgstr ""
  822 +msgstr "Decembro"
823 823  
824 824 #: app/helpers/dates_helper.rb:28
825 825 #: plugins/display_content/lib/display_content_block.rb:153
... ... @@ -834,7 +834,7 @@ msgstr &quot;&quot;
834 834 #: app/helpers/dates_helper.rb:31
835 835 #: plugins/display_content/lib/display_content_block.rb:156
836 836 msgid "%{month_name} %{day}, %{year}"
837   -msgstr ""
  837 +msgstr "La %{day}-a de %{month_name} %{year}"
838 838  
839 839 #: app/helpers/dates_helper.rb:31
840 840 #: plugins/display_content/lib/display_content_block.rb:156
... ... @@ -8043,7 +8043,7 @@ msgstr &quot;&quot;
8043 8043  
8044 8044 #: app/views/account/index_anonymous.rhtml:10
8045 8045 msgid "Sign up."
8046   -msgstr ""
  8046 +msgstr "Aliĝi"
8047 8047  
8048 8048 #: app/views/account/index_anonymous.rhtml:11
8049 8049 msgid ""
... ...
po/es/noosfero.po
... ... @@ -7,7 +7,7 @@ msgid &quot;&quot;
7 7 msgstr ""
8 8 "Project-Id-Version: noosfero 0.45.2\n"
9 9 "POT-Creation-Date: 2014-01-17 18:26-0000\n"
10   -"PO-Revision-Date: 2013-01-03 18:39-0300\n"
  10 +"PO-Revision-Date: 2014-03-25 14:55+0000\n"
11 11 "Last-Translator: Luis David Aguilar Carlos <ludwig9003@gmail.com>,Freddy "
12 12 "Martín Hernández Facio <fmhf14@gmail.com>, Pedro Alonzo Ramírez Tovar <pedro."
13 13 "alonzo709@gmail.com>\n"
... ... @@ -292,7 +292,6 @@ msgid &quot;Next&quot;
292 292 msgstr "Siguiente"
293 293  
294 294 #: app/helpers/application_helper.rb:1118
295   -#, fuzzy
296 295 msgid "See all"
297 296 msgstr "Ver todos"
298 297  
... ... @@ -690,11 +689,11 @@ msgstr &quot;Configurar foro&quot;
690 689  
691 690 #: app/helpers/forum_helper.rb:14 app/helpers/blog_helper.rb:23
692 691 msgid "&laquo; Newer posts"
693   -msgstr "&laquo; Entradas recientes"
  692 +msgstr "&laquo; Noticias más nuevas"
694 693  
695 694 #: app/helpers/forum_helper.rb:15 app/helpers/blog_helper.rb:24
696 695 msgid "Older posts &raquo;"
697   -msgstr "Entradas antiguas &raquo;"
  696 +msgstr "Noticias más viejas &raquo;"
698 697  
699 698 #: app/helpers/forum_helper.rb:18
700 699 msgid "Discussion topic"
... ... @@ -841,15 +840,13 @@ msgstr &quot;%{day} de %{month} %{year}&quot;
841 840  
842 841 #: app/helpers/dates_helper.rb:28 app/helpers/dates_helper.rb:40
843 842 #: plugins/display_content/lib/display_content_block.rb:153
844   -#, fuzzy
845 843 msgid "%{month}/%{day}"
846   -msgstr "%{day} de %{month} %{year}"
  844 +msgstr "%{day}/%{month}"
847 845  
848 846 #: app/helpers/dates_helper.rb:31
849 847 #: plugins/display_content/lib/display_content_block.rb:156
850   -#, fuzzy
851 848 msgid "%{month_name} %{day}, %{year}"
852   -msgstr "%{day} de %{month} %{year}"
  849 +msgstr "%{day} de %{month} de %{year}"
853 850  
854 851 # LAs cadenas de este tipo NO se traducen
855 852 #: app/helpers/dates_helper.rb:31
... ... @@ -877,21 +874,19 @@ msgstr &quot;%{month} %{year}&quot;
877 874  
878 875 #: app/helpers/dates_helper.rb:53
879 876 msgid "%{day} %{month} %{year}, %{hour}:%{minutes}"
880   -msgstr "%{day} %{month} %{year}, %{hour}:%{minutes}"
  877 +msgstr "%{day} de %{month} de %{year}, %{hour}:%{minutes}"
881 878  
882 879 #: app/helpers/dates_helper.rb:65
883   -#, fuzzy
884 880 msgid "from %{month} %{day1} to %{day2}, %{year}"
885   -msgstr "%{day} de %{month} %{year}"
  881 +msgstr "de %{day1} para %{day2} de %{month} de %{year}"
886 882  
887 883 #: app/helpers/dates_helper.rb:72
888   -#, fuzzy
889 884 msgid "from %{date1} to %{date2}, %{year}"
890   -msgstr "Por %{author} el %{date}"
  885 +msgstr "de %{date1} para %{date2} de %{year}"
891 886  
892 887 #: app/helpers/dates_helper.rb:79
893 888 msgid "from %{date1} to %{date2}"
894   -msgstr "Por %{author} el %{date}"
  889 +msgstr "de %{date1} para %{date2}"
895 890  
896 891 #: app/helpers/dates_helper.rb:89 app/helpers/forms_helper.rb:163
897 892 msgid "Sun"
... ...
po/it/noosfero.po
... ... @@ -8,7 +8,7 @@ msgid &quot;&quot;
8 8 msgstr ""
9 9 "Project-Id-Version: noosfero 0.45.2\n"
10 10 "POT-Creation-Date: 2014-01-17 18:26-0000\n"
11   -"PO-Revision-Date: 2012-06-05 10:27-0300\n"
  11 +"PO-Revision-Date: 2014-03-25 15:39+0000\n"
12 12 "Last-Translator: Daniela Feitosa <danielafeitosa@colivre.coop.br>\n"
13 13 "Language-Team: LANGUAGE TEAM <LL@li.org>\n"
14 14 "Language: it\n"
... ... @@ -109,7 +109,7 @@ msgstr &quot;&quot;
109 109 #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:25
110 110 #: app/views/profile/_private_profile.rhtml:10
111 111 msgid "Join"
112   -msgstr ""
  112 +msgstr "Accedere"
113 113  
114 114 #: app/helpers/application_helper.rb:554
115 115 #: app/views/blocks/profile_info_actions/_join_leave_community.rhtml:4
... ... @@ -752,63 +752,63 @@ msgstr &quot;&quot;
752 752 #: app/helpers/dates_helper.rb:7 app/helpers/forms_helper.rb:172
753 753 #: plugins/display_content/lib/display_content_block.rb:4
754 754 msgid "January"
755   -msgstr ""
  755 +msgstr "gennaio"
756 756  
757 757 #: app/helpers/dates_helper.rb:8 app/helpers/forms_helper.rb:172
758 758 #: plugins/display_content/lib/display_content_block.rb:5
759 759 msgid "February"
760   -msgstr ""
  760 +msgstr "febbraio"
761 761  
762 762 #: app/helpers/dates_helper.rb:9 app/helpers/forms_helper.rb:172
763 763 #: plugins/display_content/lib/display_content_block.rb:6
764 764 msgid "March"
765   -msgstr ""
  765 +msgstr "marzo"
766 766  
767 767 #: app/helpers/dates_helper.rb:10 app/helpers/forms_helper.rb:172
768 768 #: plugins/display_content/lib/display_content_block.rb:7
769 769 msgid "April"
770   -msgstr ""
  770 +msgstr "aprile"
771 771  
772 772 #: app/helpers/dates_helper.rb:11 app/helpers/forms_helper.rb:172
773 773 #: app/helpers/forms_helper.rb:173
774 774 #: plugins/display_content/lib/display_content_block.rb:8
775 775 msgid "May"
776   -msgstr ""
  776 +msgstr "maggio"
777 777  
778 778 #: app/helpers/dates_helper.rb:12 app/helpers/forms_helper.rb:172
779 779 #: plugins/display_content/lib/display_content_block.rb:9
780 780 msgid "June"
781   -msgstr ""
  781 +msgstr "giugno"
782 782  
783 783 #: app/helpers/dates_helper.rb:13 app/helpers/forms_helper.rb:172
784 784 #: plugins/display_content/lib/display_content_block.rb:10
785 785 msgid "July"
786   -msgstr ""
  786 +msgstr "luglio"
787 787  
788 788 #: app/helpers/dates_helper.rb:14 app/helpers/forms_helper.rb:172
789 789 #: plugins/display_content/lib/display_content_block.rb:11
790 790 msgid "August"
791   -msgstr ""
  791 +msgstr "agosto"
792 792  
793 793 #: app/helpers/dates_helper.rb:15 app/helpers/forms_helper.rb:172
794 794 #: plugins/display_content/lib/display_content_block.rb:12
795 795 msgid "September"
796   -msgstr ""
  796 +msgstr "settembre"
797 797  
798 798 #: app/helpers/dates_helper.rb:16 app/helpers/forms_helper.rb:172
799 799 #: plugins/display_content/lib/display_content_block.rb:13
800 800 msgid "October"
801   -msgstr ""
  801 +msgstr "ottobre"
802 802  
803 803 #: app/helpers/dates_helper.rb:17 app/helpers/forms_helper.rb:172
804 804 #: plugins/display_content/lib/display_content_block.rb:14
805 805 msgid "November"
806   -msgstr ""
  806 +msgstr "novembre"
807 807  
808 808 #: app/helpers/dates_helper.rb:18 app/helpers/forms_helper.rb:172
809 809 #: plugins/display_content/lib/display_content_block.rb:15
810 810 msgid "December"
811   -msgstr ""
  811 +msgstr "dicembre"
812 812  
813 813 #: app/helpers/dates_helper.rb:28
814 814 #: plugins/display_content/lib/display_content_block.rb:153
... ... @@ -823,7 +823,7 @@ msgstr &quot;&quot;
823 823 #: app/helpers/dates_helper.rb:31
824 824 #: plugins/display_content/lib/display_content_block.rb:156
825 825 msgid "%{month_name} %{day}, %{year}"
826   -msgstr ""
  826 +msgstr "%{day} %{month_name} %{year}"
827 827  
828 828 #: app/helpers/dates_helper.rb:31
829 829 #: plugins/display_content/lib/display_content_block.rb:156
... ... @@ -8016,7 +8016,7 @@ msgstr &quot;&quot;
8016 8016  
8017 8017 #: app/views/account/index_anonymous.rhtml:10
8018 8018 msgid "Sign up."
8019   -msgstr ""
  8019 +msgstr "Registro"
8020 8020  
8021 8021 #: app/views/account/index_anonymous.rhtml:11
8022 8022 msgid ""
... ...
test/unit/block_test.rb
... ... @@ -222,4 +222,11 @@ class BlockTest &lt; ActiveSupport::TestCase
222 222 assert block.visible?(2)
223 223 assert !block.visible?(3)
224 224 end
  225 +
  226 + should 'accept user as parameter on cache_key without change its value' do
  227 + person = fast_create(Person)
  228 + block = Block.new
  229 + assert_equal block.cache_key('en'), block.cache_key('en', person)
  230 + end
  231 +
225 232 end
... ...
test/unit/members_block_test.rb
... ... @@ -35,4 +35,28 @@ class MembersBlockTest &lt; ActiveSupport::TestCase
35 35 assert_same list, block.profiles
36 36 end
37 37  
  38 + should 'use logged-in to compose cache key' do
  39 + person = fast_create(Person)
  40 + community = fast_create(Community)
  41 + block = MembersBlock.create
  42 + block.expects(:owner).returns(community)
  43 +
  44 + assert_match(/-logged-in/,block.cache_key('en', person))
  45 + end
  46 +
  47 + should 'use logged-in and member to compose cache key for members' do
  48 + person = fast_create(Person)
  49 + community = fast_create(Community)
  50 + community.add_member person
  51 + block = MembersBlock.create
  52 + block.expects(:owner).returns(community)
  53 +
  54 + assert_match(/-logged-in-member/,block.cache_key('en', person))
  55 + end
  56 +
  57 + should 'not change block cache key if user is nil' do
  58 + block = MembersBlock.new
  59 + assert_equal block.cache_key('en'), block.cache_key('en', nil)
  60 + end
  61 +
38 62 end
... ...