Committer: nnikulochkina
LJSUP-14157: Add 'limit social capital' param to paid repost settingsU trunk/bin/upgrading/en_LJ.dat U trunk/bin/upgrading/proplists-local.dat U trunk/cgi-bin/LJ/CleanHtml/Like.pm
Modified: trunk/bin/upgrading/en_LJ.dat =================================================================== --- trunk/bin/upgrading/en_LJ.dat 2012-11-01 14:34:56 UTC (rev 12862) +++ trunk/bin/upgrading/en_LJ.dat 2012-11-01 14:44:24 UTC (rev 12863) @@ -7146,6 +7146,11 @@ pay.repost.user_not_person|staleness=1 pay.repost.user_not_person=User is not a person +pay.repost.notnumeric_budget=Repost budget is not numeic +pay.repost.incorrect_budget=Budget cannot be negative +pay.repost.notnumeric_min_social_cap=Social capital limit is not numeric +pay.repost.incorrect_min_social_cap=Social capital limit must be greather than 20 + pay.size.3xlarge=3X-Large pay.size.4xlarge=4X-Large @@ -13378,6 +13383,8 @@ talk.post.sticky.replace=sticky (will replace existing sticky post) +talk.post.paidrepost.limit_sc=Minimum social capital: + talk.replycount=[[count]] [[?count|comment|comments]] talk.replytothis=Reply Modified: trunk/bin/upgrading/proplists-local.dat =================================================================== --- trunk/bin/upgrading/proplists-local.dat 2012-11-01 14:34:56 UTC (rev 12862) +++ trunk/bin/upgrading/proplists-local.dat 2012-11-01 14:44:24 UTC (rev 12863) @@ -1084,6 +1084,12 @@ prettyname: Poster of origin entry sortorder: +logproplist.repost_limit_sc: + datatype: num + des: Minimum social capital for paid repost + prettyname: Repost limit of social capital + sortorder: + logproplist.repost_offer: datatype: num des: id of account, reserved for paid repost offer Modified: trunk/cgi-bin/LJ/CleanHtml/Like.pm =================================================================== --- trunk/cgi-bin/LJ/CleanHtml/Like.pm 2012-11-01 14:34:56 UTC (rev 12862) +++ trunk/cgi-bin/LJ/CleanHtml/Like.pm 2012-11-01 14:44:24 UTC (rev 12863) @@ -63,8 +63,10 @@ my $params = {}; foreach my $button ( split /,\s*/, $buttons_list ) { - if ($button =~ /^(?:re|repost)(?:\?budget=(\d+))?$/i) { - $params->{repost_budget} = $1 if $1; + if ($button =~ /^(?:re|repost)((:?\?\w+=\w+)*)$/i) { + if (my $p = $1) { + $params->{repost_params} = { map {split /=/} (split /\?/, $p) }; + } push @buttons, 'repost'; } elsif ( $button =~ /^(?:fb|facebook)$/i ) { @@ -279,30 +281,30 @@ return { buttons => $buttons, - repost_budget => $params->{repost_budget}, + repost_params => $params->{repost_params}, }; } -sub extract_repost_budget { +sub extract_repost_params { my ($class, $htmlref) = @_; my $tag; if ($$htmlref =~ /(<lj-like\b.+?>)/i) { my $like = $class->like_from_tag($1); - return $like->{repost_budget}; + return $like->{repost_params}; } return undef; } -sub clean_repost_budget { +sub clean_repost_params { my ($class, $htmlref) = @_; - $$htmlref =~ s/(<lj-like\b.+?>)/__clean_repost_budget($1)/ieg; + $$htmlref =~ s/(<lj-like\b.+?>)/__clean_repost_params($1)/ieg; } -sub __clean_repost_budget { +sub __clean_repost_params { my $tag = shift; my $p = HTML::TokeParser->new(\$tag); @@ -314,7 +316,7 @@ my @buttons = split /,/, $attrs->{buttons}; foreach my $button (@buttons) { - $button =~ s/^(re|repost)\?budget=\d+$/$1/i; + $button =~ s/^(re|repost)\?.+$/$1/i; } return '<lj-like buttons="'.(join ',', @buttons).'" />';