Committer: vtroitsky
LJSUP-10937: Self promo for journals and communities, journals promo + language variablesU trunk/bin/upgrading/en_LJ.dat U trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm
Modified: trunk/bin/upgrading/en_LJ.dat =================================================================== --- trunk/bin/upgrading/en_LJ.dat 2012-02-07 13:35:52 UTC (rev 11425) +++ trunk/bin/upgrading/en_LJ.dat 2012-02-07 14:30:40 UTC (rev 11426) @@ -7098,7 +7098,7 @@ selfpromo.entry.notification.deactivate.ineligible.journal_adult_content.subject=Entry promotion discontinued -selfpromo.notification.deactivate.ineligible.journal_invisible.body<< +selfpromo.entry.notification.deactivate.ineligible.journal_invisible.body<< Dear [[poster]], Promotion of your entry at [[object_url]] has been discontinued because that journal has failed to remain visible (i. e. it was deleted or suspended). @@ -7163,6 +7163,34 @@ selfpromo.entry.notification.deactivate.withdraw.subject=Entry promotion withdrawn +selfpromo.journal.notification.deactivate.withdraw.body<< +Dear [[poster]], + +You have successfully withdrawn promotion of your journal [[object_url]], so it is no longer promoted. + +Thank you for using the service! + +Best regards, +LiveJournal Team +http://www.livejournal.com +. + +selfpromo.journal.notification.deactivate.withdraw.subject=Journal promotion withdrawn + +selfpromo.community.notification.deactivate.withdraw.body<< +Dear [[poster]], + +You have successfully withdrawn promotion of your community [[object_url]], so it is no longer promoted. + +Thank you for using the service! + +Best regards, +LiveJournal Team +http://www.livejournal.com +. + +selfpromo.community.notification.deactivate.withdraw.subject=Community promotion withdrawn + selfpromo.entry.shop_item.name=Promotion of the <a href="[[object_url]]">entry</a> selfpromo.journal.shop_item.name=Promotion of the <a href="[[object_url]]">journal</a> selfpromo.community.shop_item.name=Promotion of the <a href="[[object_url]]">community</a> Modified: trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm =================================================================== --- trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm 2012-02-07 13:35:52 UTC (rev 11425) +++ trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm 2012-02-07 14:30:40 UTC (rev 11426) @@ -169,10 +169,12 @@ $object_url = 'http://' . $object_url; } + my $remote = LJ::get_remote(); + # TODO Refactoring: move logic inside PromoObject constructor !!! # my $promo_object = LJ::SelfPromo::Promo->create_from_url(url => $object_url, type => $type); - my $object = ($type eq 'entry' ? LJ::Entry->new_from_url($object_url) : LJ::load_user($object_url)); + my $object = ($type eq 'entry' ? LJ::Entry->new_from_url($object_url) : ($type eq 'journal' ? $remote : LJ::load_user($object_url))); # unless ($promo_object) { unless ($object) { @@ -187,7 +189,6 @@ $object_url = ($type eq 'entry' ? $object->url : $object->journal_base ); - my $remote = LJ::get_remote(); my $ineligible_reason; # TODO (refactoring): incapsulate that logic into PromoObject + SelfPromo facade # my $object_eligible = $promo_object->is_eligible($remote, \$ineligible_reason); @@ -236,13 +237,14 @@ sub process_promote_request { my ($self, $type, $class) = @_; + my $remote = LJ::get_remote(); my $object_url = LJ::Request->post_param('object_link'); unless ( $object_url =~ m{^https?://} || $type ne 'entry') { $object_url = 'http://' . $object_url; } # TODO Refactoring: move logic inside PromoObject constructor !!! - my $object = ($type eq 'entry' ? LJ::Entry->new_from_url($object_url) : LJ::load_user($object_url)); + my $object = ($type eq 'entry' ? LJ::Entry->new_from_url($object_url) : ($type eq 'journal' ? $remote : LJ::load_user($object_url))); unless ($object) { $self->ml_error( @@ -252,7 +254,6 @@ # TODO (refactoring): move that logic into PromoObject abstraction $object_url = ($type eq 'entry' ? $object->url : $object->journal_base ); - my $remote = LJ::get_remote(); my $ineligible_reason; my $object_eligible = $class->is_object_eligible( $object, $remote,