If a user does not have privacy data for a field, check back with the field for the privacy default. Fixes bug #11951. Added ProfileField cleanup code.
This commit is contained in:
parent
9e714fa09a
commit
897c2e0248
4 changed files with 22 additions and 5 deletions
|
|
@ -2,6 +2,7 @@
|
|||
- fixed #11950: Username set to 0 when edit user
|
||||
- fixed #11946: Double time zone correction when addding an event
|
||||
- fixed #11952: Navigation template help error
|
||||
- fixed #11951: Privacy setting of new profile field
|
||||
|
||||
7.10.4
|
||||
- Added WebGUI::Fork api
|
||||
|
|
|
|||
|
|
@ -779,7 +779,7 @@ Field to get privacy setting for.
|
|||
sub getProfileFieldPrivacySetting {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $field = shift;
|
||||
my $fieldId = shift;
|
||||
|
||||
unless ($self->{_privacySettings}) {
|
||||
#Look it up manually because we want to cache this separately.
|
||||
|
|
@ -791,12 +791,16 @@ sub getProfileFieldPrivacySetting {
|
|||
$self->{_privacySettings} = JSON->new->decode($privacySettings);
|
||||
}
|
||||
|
||||
return $self->{_privacySettings} unless ($field);
|
||||
return $self->{_privacySettings} unless ($fieldId);
|
||||
|
||||
#No privacy settings returned the privacy setting field
|
||||
return "none" if($field eq "wg_privacySettings");
|
||||
return "none" if($fieldId eq "wg_privacySettings");
|
||||
|
||||
return $self->{_privacySettings}->{$field};
|
||||
if (exists $self->{_privacySettings}->{$fieldId}) {
|
||||
return $self->{_privacySettings}->{$fieldId};
|
||||
}
|
||||
my $field = WebGUI::ProfileField->new($session, $fieldId);
|
||||
return $field && $field->get('defaultPrivacySetting');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
11
t/User.t
11
t/User.t
|
|
@ -22,7 +22,7 @@ use WebGUI::User;
|
|||
use WebGUI::ProfileField;
|
||||
use WebGUI::Shop::AddressBook;
|
||||
|
||||
use Test::More tests => 225; # increment this value for each test you create
|
||||
use Test::More tests => 226; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
use Data::Dumper;
|
||||
|
||||
|
|
@ -942,6 +942,15 @@ is($neighbor->getProfileFieldPrivacySetting('email'), 'none', '...set will not s
|
|||
is($admin->getProfileFieldPrivacySetting('publicEmail'), 'all', '...get on a user with existing settings');
|
||||
is($neighbor->getProfileFieldPrivacySetting('wg_privacySettings'), 'none', '...the privacy field always returns "none"');
|
||||
|
||||
my $recentProfileField = WebGUI::ProfileField->create($session, 'recentField', {
|
||||
fieldName => 'recentField',
|
||||
defaultPrivacySetting => 'all',
|
||||
visible => 1,
|
||||
label => 'recentField',
|
||||
});
|
||||
WebGUI::Test->addToCleanup($recentProfileField);
|
||||
is($neighbor->getProfileFieldPrivacySetting('recentField'), 'all', '...if a field is added and the user does not have privacy data for it, check the original field');
|
||||
|
||||
################################################################
|
||||
#
|
||||
# updateProfileFields
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ sub _initSession {
|
|||
'Payment Drivers' => 'paymentGateway',
|
||||
'Database Links' => 'databaseLink',
|
||||
'LDAP Links' => 'ldapLink',
|
||||
'Profile Fields' => 'userProfileField',
|
||||
);
|
||||
my %initCounts;
|
||||
for ( my $i = 0; $i < @checkCount; $i += 2) {
|
||||
|
|
@ -750,6 +751,7 @@ were passed in. Currently able to destroy:
|
|||
WebGUI::DatabaseLink
|
||||
WebGUI::LDAPLink
|
||||
WebGUI::Inbox::Message
|
||||
WebGUI::ProfileField
|
||||
|
||||
Example call:
|
||||
|
||||
|
|
@ -853,6 +855,7 @@ Example call:
|
|||
'WebGUI::Inbox::Message' => 'purge',
|
||||
'WebGUI::AdSpace' => 'delete',
|
||||
'WebGUI::FilePump::Bundle' => 'delete',
|
||||
'WebGUI::ProfileField' => 'delete',
|
||||
'WebGUI::Shop::Cart' => sub {
|
||||
my $cart = shift;
|
||||
my $addressBook = eval { $cart->getAddressBook(); };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue