1 package LJ
::Setting
::MinSecurity
;
2 use base
'LJ::Setting';
9 return $u && !$u->is_identity ?
1 : 0;
15 return "minsecurity_full";
21 return $class->ml('setting.minsecurity.label');
25 my ($class, $u, $errs, $args) = @_;
26 my $key = $class->pkgkey;
28 my $minsecurity = $class->get_arg($args, "minsecurity") || $u->prop("newpost_minsecurity");
31 "" => $class->ml('setting.minsecurity.option.select.public'),
32 friends
=> $u->is_community ?
$class->ml('setting.minsecurity.option.select.members') : $class->ml('setting.minsecurity.option.select.friends'),
34 push @options, ( private
=> $class->ml('setting.minsecurity.option.select.private') )
37 my $ret = "<label for='${key}minsecurity'>" . $class->ml('setting.minsecurity.option') . "</label> ";
38 $ret .= LJ
::html_select
({
39 name
=> "${key}minsecurity",
40 id
=> "${key}minsecurity",
41 selected
=> $minsecurity,
48 my ($class, $u, $args) = @_;
50 my $val = $class->get_arg($args, "minsecurity");
51 if ($u->is_community) {
52 $val = "" unless $val =~ /^(friends)$/;
54 $val = "" unless $val =~ /^(friends|private)$/;
57 my $old_value = $u->prop("newpost_minsecurity");
58 $u->set_prop( newpost_minsecurity
=> $val );
60 return 1 if $old_value eq $val;
62 LJ
::User
::UserlogRecord
::ChangeSetting
->create( $u,
63 setting_name
=> 'newpost_minsecurity',
64 new_value
=> $val || 'public',
65 old_value
=> $old_value || 'public',