[Git][noosfero/noosfero][master] 2 commits: Copy privacy fields of template when create user

Rodrigo Souto gitlab at mg.gitlab.com
Fri Aug 3 17:43:45 BRT 2018


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
96e022d2 by Iasmin Mendes at 2018-07-25T12:08:55Z
Copy privacy fields of template when create user

- - - - -
8934f657 by Rodrigo Souto at 2018-08-03T20:43:41Z
Merge branch 'privacy-fields-template' into 'master'

Copy privacy fields of template when create profile

See merge request noosfero/noosfero!1576
- - - - -


2 changed files:

- app/models/profile.rb
- test/unit/profile_test.rb


Changes:

=====================================
app/models/profile.rb
=====================================
@@ -627,6 +627,7 @@ class Profile < ApplicationRecord
     self.custom_footer = template[:custom_footer]
     self.custom_header = template[:custom_header]
     self.access = template.access
+    self.fields_privacy = template.fields_privacy
     self.image = template.image
     # flush
     self.save(:validate => false)


=====================================
test/unit/profile_test.rb
=====================================
@@ -1081,6 +1081,16 @@ class ProfileTest < ActiveSupport::TestCase
     assert_equal 'Profile address', p.custom_footer_expanded
   end
 
+  should 'copy privacy fields when applying template' do
+    template = create(Profile, :data => { :fields_privacy => { :email => "public" }},
+                       :is_template => true)
+
+    profile = create(Profile)
+    profile.apply_template(template)
+
+    assert_equal template.fields_privacy, profile.fields_privacy
+  end
+
   should 'ignore failing validation when applying template' do
     template = create(Profile, :layout_template => 'leftbar', :custom_footer => 'my custom footer', :custom_header => 'my custom header', :is_template => true)
 



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/57fc986e14528bdb5cd8bc4555fbfe3d3f47c928...8934f6571226a163c8b2bc3431aa4fd3a4197c6f

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/57fc986e14528bdb5cd8bc4555fbfe3d3f47c928...8934f6571226a163c8b2bc3431aa4fd3a4197c6f
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180803/d2aa9870/attachment-0001.html>


More information about the Noosfero-dev mailing list