Commit 40a27d7446bb035b98dbf46230bf969d2af9b308

Authored by Victor Costa
2 parents 89ca98f6 9db0c7d6
Exists in staging and in 1 other branch production

Merge branch 'master' into staging

app/api/entities.rb
... ... @@ -97,7 +97,7 @@ module Api
97 97 root 'boxes', 'box'
98 98 expose :id, :position
99 99 expose :blocks, :using => Block do |box, options|
100   - box.blocks.select {|block| block.visible_to_user?(options[:current_person]) }
  100 + box.blocks.select {|block| block.visible_to_user?(options[:current_person]) || block.allow_edit?(options[:current_person]) }
101 101 end
102 102 end
103 103  
... ...
app/api/v1/blocks.rb
... ... @@ -5,7 +5,7 @@ module Api
5 5 resource :blocks do
6 6 get ':id' do
7 7 block = Block.find(params["id"])
8   - return forbidden! unless block.visible_to_user?(current_person)
  8 + return forbidden! unless block.visible_to_user?(current_person) || block.allow_edit?(current_person)
9 9 present block, :with => Entities::Block, display_api_content: true, current_person: current_person
10 10 end
11 11  
... ...
app/views/profile/send_mail.html.erb
... ... @@ -15,8 +15,8 @@
15 15 <div class="template-selection">
16 16 <% if @email_templates.present? %>
17 17 <%= labelled_form_field(_('Select a template:'), select_tag(:template, options_from_collection_for_select(@email_templates, :id, :name), :include_blank => true, 'data-url' => url_for(:controller => 'email_templates', :action => 'show_parsed'))) %>
18   - </div>
19   -<% end %>
  18 + <% end %>
  19 +</div>
20 20  
21 21 <%= form_for :mailing, :url => {:action => 'send_mail'}, :html => {:id => 'mailing-form'} do |f| %>
22 22  
... ...
po/es/noosfero.po
... ... @@ -7,7 +7,7 @@ msgid &quot;&quot;
7 7 msgstr ""
8 8 "Project-Id-Version: 1.3~rc2-8-g01ea9f7\n"
9 9 "POT-Creation-Date: 2015-11-04 12:36-0300\n"
10   -"PO-Revision-Date: 2016-06-15 13:11+0000\n"
  10 +"PO-Revision-Date: 2016-06-15 13:24+0000\n"
11 11 "Last-Translator: Becca Cook <b.cook28@gmail.com>\n"
12 12 "Language-Team: Spanish "
13 13 "<https://hosted.weblate.org/projects/noosfero/noosfero/es/>\n"
... ... @@ -7508,22 +7508,21 @@ msgstr &quot;Administrar campos mostrados para perfiles&quot;
7508 7508 #: app/views/features/manage_fields.html.erb:6
7509 7509 #, fuzzy
7510 7510 msgid "Person's fields"
7511   -msgstr "Manejar los campos de personas"
  7511 +msgstr "Los campos de personas"
7512 7512  
7513 7513 #: app/views/features/manage_fields.html.erb:8
7514 7514 #, fuzzy
7515 7515 msgid "Community's fields"
7516   -msgstr "Perfil de la comunidad"
  7516 +msgstr "Campos de la comunidad"
7517 7517  
7518 7518 #: app/views/features/manage_fields.html.erb:11
7519 7519 #, fuzzy
7520 7520 msgid "Enterprise's fields"
7521   -msgstr "Perfil de empresas"
  7521 +msgstr "Campos de empresas"
7522 7522  
7523 7523 #: app/views/file_presenter/_generic.html.erb:5
7524   -#, fuzzy
7525 7524 msgid "Download"
7526   -msgstr "Abajo"
  7525 +msgstr "Descargar"
7527 7526  
7528 7527 #: app/views/file_presenter/_image.html.erb:7
7529 7528 #: app/views/file_presenter/_image.html.erb:9
... ... @@ -7552,9 +7551,8 @@ msgstr &quot;Contenido etiquetado con \&quot;%s\&quot;&quot;
7552 7551  
7553 7552 #: app/views/friends/connections.html.erb:4
7554 7553 #: app/views/friends/suggest.html.erb:4
7555   -#, fuzzy
7556 7554 msgid "Go to friends list"
7557   -msgstr "No tienes nuevos amigos aun."
  7555 +msgstr "Ir a la lista de amigos"
7558 7556  
7559 7557 #: app/views/friends/index.html.erb:3 app/views/profile/friends.html.erb:3
7560 7558 msgid "%s's friends"
... ... @@ -7577,12 +7575,11 @@ msgstr &quot;Encontrar gente&quot;
7577 7575 #: app/views/profile/friends.html.erb:21
7578 7576 #, fuzzy
7579 7577 msgid "Invite people"
7580   -msgstr "Invitar miembros"
  7578 +msgstr "Invitar gente"
7581 7579  
7582 7580 #: app/views/friends/index.html.erb:31
7583   -#, fuzzy
7584 7581 msgid "Friends suggestions"
7585   -msgstr "Sugerencia de artículos"
  7582 +msgstr "Sugerencias de amigos"
7586 7583  
7587 7584 #: app/views/friends/remove.html.erb:3
7588 7585 msgid "Removing friend: %s"
... ... @@ -7601,14 +7598,12 @@ msgstr &quot;&quot;
7601 7598 "también quiera eliminarte de su lista de amigos."
7602 7599  
7603 7600 #: app/views/friends/remove_suggestion.html.erb:2
7604   -#, fuzzy
7605 7601 msgid "Removing suggestion for friend: %s"
7606   -msgstr "Eliminando amigo: %s"
  7602 +msgstr "Eliminando sugerencia de amigo: %s"
7607 7603  
7608 7604 #: app/views/friends/suggest.html.erb:1
7609   -#, fuzzy
7610 7605 msgid "Friends suggestions for %s"
7611   -msgstr "Ajustes de perfil para %s"
  7606 +msgstr "Sugerencias de amigos para %s"
7612 7607  
7613 7608 #: app/views/home/index.html.erb:2
7614 7609 msgid "News"
... ... @@ -7661,15 +7656,18 @@ msgid &quot;user&quot;
7661 7656 msgstr "usuario"
7662 7657  
7663 7658 #: app/views/home/welcome.html.erb:15
  7659 +#, fuzzy
7664 7660 msgid "Wait for admin approvement!"
7665   -msgstr ""
  7661 +msgstr "¡Espera que la admin lo apruebe!"
7666 7662  
7667 7663 #: app/views/home/welcome.html.erb:16
  7664 +#, fuzzy
7668 7665 msgid "The administrators will evaluate your signup request for approvement."
7669 7666 msgstr ""
  7667 +"Los administradores van a evaluar tu solicitud de inscripción para "
  7668 +"aprobación."
7670 7669  
7671 7670 #: app/views/home/welcome.html.erb:17
7672   -#, fuzzy
7673 7671 msgid "You won't appear as %s until your account is approved."
7674 7672 msgstr "No aparecerás como %s hasta que tu cuenta sea confirmada."
7675 7673  
... ... @@ -7678,14 +7676,18 @@ msgid &quot;What to do next?&quot;
7678 7676 msgstr "¿Qué hacer después?"
7679 7677  
7680 7678 #: app/views/home/welcome.html.erb:20
  7679 +#, fuzzy
7681 7680 msgid "Access your %s and see your face on the network!"
7682   -msgstr ""
  7681 +msgstr "¡Acceder tu %s y ver tu cara en la red!"
7683 7682  
7684 7683 #: app/views/home/welcome.html.erb:22
  7684 +#, fuzzy
7685 7685 msgid ""
7686 7686 "You can also explore your %s to customize your profile. Here are some %s on "
7687 7687 "what you can do there."
7688 7688 msgstr ""
  7689 +"También puedes explorar tu %s para personalizar tu perfil. Aquí están "
  7690 +"algunos %s de qué puedes hacer allí."
7689 7691  
7690 7692 #: app/views/home/welcome.html.erb:23
7691 7693 #: app/views/profile_editor/index.html.erb:6
... ... @@ -7694,7 +7696,7 @@ msgstr &quot;Panel de control&quot;
7694 7696  
7695 7697 #: app/views/home/welcome.html.erb:24
7696 7698 msgid "tips"
7697   -msgstr ""
  7699 +msgstr "consejos"
7698 7700  
7699 7701 #: app/views/home/welcome.html.erb:25
7700 7702 msgid "Invite and find"
... ... @@ -7721,7 +7723,7 @@ msgstr &quot;¡Comienza explorando y diviértete!&quot;
7721 7723  
7722 7724 #: app/views/home/welcome.html.erb:29
7723 7725 msgid "What can I do as a %s?"
7724   -msgstr ""
  7726 +msgstr "¿Qué puedo hacer como un %s?"
7725 7727  
7726 7728 #: app/views/invite/_dialog_wait_loading.html.erb:8
7727 7729 msgid "Please, wait..."
... ... @@ -7792,7 +7794,7 @@ msgstr &quot;&quot;
7792 7794 #: app/views/invite/invite_friends.html.erb:2
7793 7795 #, fuzzy
7794 7796 msgid "Ask for friendship"
7795   -msgstr "%s amigos"
  7797 +msgstr "Pedir la amistad"
7796 7798  
7797 7799 #: app/views/invite/invite_friends.html.erb:3
7798 7800 msgid "You can search for user profiles and ask them to become your friends."
... ...
test/api/blocks_test.rb
... ... @@ -53,6 +53,16 @@ class BlocksTest &lt; ActiveSupport::TestCase
53 53 assert_equal 403, last_response.status
54 54 end
55 55  
  56 + should 'get an invisible profile block for an user with permission' do
  57 + profile = fast_create(Profile, public_profile: false)
  58 + profile.add_admin(person)
  59 + box = fast_create(Box, :owner_id => profile.id, :owner_type => Profile.name)
  60 + block = fast_create(Block, box_id: box.id)
  61 + get "/api/v1/blocks/#{block.id}?#{params.to_query}"
  62 + json = JSON.parse(last_response.body)
  63 + assert_equal block.id, json["block"]["id"]
  64 + end
  65 +
56 66 should 'get a block for an user with permission in a private profile' do
57 67 profile = fast_create(Profile, public_profile: false)
58 68 profile.add_admin(person)
... ...
test/api/boxes_test.rb
... ... @@ -81,6 +81,18 @@ class BoxesTest &lt; ActiveSupport::TestCase
81 81 assert_equal [block.id], json["boxes"].first["blocks"].map {|b| b['id']}
82 82 end
83 83  
  84 + should 'list a block with not logged in display_user for an admin user' do
  85 + profile = fast_create(Profile)
  86 + profile.add_admin(person)
  87 + box = fast_create(Box, :owner_id => profile.id, :owner_type => Profile.name)
  88 + block = fast_create(Block, box_id: box.id)
  89 + block.display_user = 'not_logged'
  90 + block.save!
  91 + get "/api/v1/profiles/#{profile.id}/boxes?#{params.to_query}"
  92 + json = JSON.parse(last_response.body)
  93 + assert_equal [block.id], json["boxes"].first["blocks"].map {|b| b['id']}
  94 + end
  95 +
84 96 should 'not list boxes for user without permission' do
85 97 profile = fast_create(Profile, public_profile: false)
86 98 box = fast_create(Box, :owner_id => profile.id, :owner_type => Profile.name)
... ...