[ljcom] r11192: LJSUP-10420: S1 Comments ?\226?\128?\148...
Committer: anazarov
LJSUP-10420: S1 Comments ?\226?\128?\148?\194?\160v.2 (update from trunk)U branches/commenting-form/bin/upgrading/en_LJ.dat U branches/commenting-form/bin/upgrading/s2layers/flexiblesquares/layout.s2 U branches/commenting-form/cgi-bin/LJ/Client/Twitter.pm U branches/commenting-form/cgi-bin/LJ/Console/Command/SelfPromo.pm U branches/commenting-form/cgi-bin/LJ/Hooks/ESN.pm U branches/commenting-form/cgi-bin/LJ/Hooks/Homepage.pm U branches/commenting-form/cgi-bin/LJ/Worker/Repost/CommentToTwitter.pm U branches/commenting-form/cgi-bin/LJ/Worker/Repost/EntryToTwitter.pm U branches/commenting-form/htdocs/error-page.bml
Modified: branches/commenting-form/bin/upgrading/en_LJ.dat
===================================================================
--- branches/commenting-form/bin/upgrading/en_LJ.dat 2011-11-17 10:04:05 UTC (rev 11191)
+++ branches/commenting-form/bin/upgrading/en_LJ.dat 2011-11-17 10:35:54 UTC (rev 11192)
@@ -13132,9 +13132,9 @@
widget.marqueefeatures.title=Feature Showcase
widget.marqueefeatures.also=Also check out
-widget.majornotes.title=LiveJournal Major Notes
+widget.majornotes.title=LiveJournal says…
widget.majornotes.also=More in
-widget.featureshowcase.title=Feature showcase
+widget.featureshowcase.title=LiveJournal tips
widget.featureshowcase.also=Also check out
widget.msmessengerregister.msn_accept|staleness=1
Modified: branches/commenting-form/bin/upgrading/s2layers/flexiblesquares/layout.s2
===================================================================
--- branches/commenting-form/bin/upgrading/s2layers/flexiblesquares/layout.s2 2011-11-17 10:04:05 UTC (rev 11191)
+++ branches/commenting-form/bin/upgrading/s2layers/flexiblesquares/layout.s2 2011-11-17 10:35:54 UTC (rev 11192)
@@ -927,6 +927,7 @@
/* maincontent */
.subcontent {
+ overflow: hidden;
}
.entry {
@@ -941,12 +942,12 @@
border-color: $*entrytitle_bgcolor;
border-style: solid;
}
- .entry_text {
- overflow: hidden;
- }
.entry_text .ljtags {
clear: both;
}
+ .entry_text IMG {
+ max-width: 100%;
+ }
.entry ul li
{
Modified: branches/commenting-form/cgi-bin/LJ/Client/Twitter.pm
===================================================================
--- branches/commenting-form/cgi-bin/LJ/Client/Twitter.pm 2011-11-17 10:04:05 UTC (rev 11191)
+++ branches/commenting-form/cgi-bin/LJ/Client/Twitter.pm 2011-11-17 10:35:54 UTC (rev 11192)
@@ -189,6 +189,19 @@
return $token;
}
+sub get_user_access_token {
+ my ( $class, $u ) = @_;
+
+ my $token = {
+ 'public' => $u->prop('twitter_access_token') || undef,
+ 'secret' => $u->prop('twitter_access_token_secret') || undef,
+ };
+
+ return unless $token->{'public'};
+
+ return $token;
+}
+
sub call {
my ($class, %opts) = @_;
@@ -200,18 +213,14 @@
my $u = $opts{user};
if ($u) {
- $opts{'access_token'} = {
- 'public' => $u->prop('twitter_access_token') || undef,
- 'secret' => $u->prop('twitter_access_token_secret') || undef,
- };
+ $opts{'access_token'} = $class->get_user_access_token($u);
}
my $access_token = $opts{'access_token'};
die 'access token not provided' unless $access_token;
- unless ($access_token->{'public'}) {
- warn "User " . $u->username . " has no twitter access token\n";
- return undef;
+ unless ($access_token) {
+ die "User " . $u->username . " has no twitter access token\n";
}
my $http_method = $opts{'http_method'} || 'GET';
@@ -301,6 +310,14 @@
subject => LJ::Lang::get_text($lang, 'twitter.disconnect_letter.subject', undef),
body => LJ::Lang::get_text($lang, 'twitter.disconnect_letter.body', undef, { user => $u->username }),
} ) or warn "Unable to send_mail";
+ return;
+ } elsif ( $res->code >= 500 && $res->code < 600 ) {
+ # 50x codes (which indicate a server error) only get
+ # printed if we have an environment flag on
+ if ( $ENV{'LJ_DEBUG_TWITTER_CONNECTIVITY'} ) {
+ die "twitter connectivity error: " . $res->status_line;
+ }
+ return;
} else {
die "twitter connectivity error: " . $res->status_line;
}
@@ -431,6 +448,11 @@
sub user_last_tweets {
my ($class, $u) = @_;
+ unless ( LJ::Client::Twitter->get_user_access_token($u) ) {
+ # if they don't have a token, return an empty result
+ return [];
+ }
+
my $res = LJ::Client::Twitter->call(
'api_method' => 'statuses/user_timeline',
'user' => $u,
@@ -447,10 +469,20 @@
sub get_userinfo {
my ($class, %opts) = @_;
+ my $token = $opts{'access_token'};
+ my $u = $opts{'user'};
+
+ if ($u) {
+ unless ( LJ::Client::Twitter->get_user_access_token($u) ) {
+ # if they don't have a token, return undef for no info
+ return;
+ }
+ }
+
my $userdata = $class->call(
'api_method' => 'account/verify_credentials',
- 'access_token' => $opts{'access_token'},
- 'user' => $opts{'user'},
+ 'access_token' => $token,
+ 'user' => $u,
);
my $twu = LJ::Client::Twitter::User->from_hash($userdata);
Modified: branches/commenting-form/cgi-bin/LJ/Console/Command/SelfPromo.pm
===================================================================
--- branches/commenting-form/cgi-bin/LJ/Console/Command/SelfPromo.pm 2011-11-17 10:04:05 UTC (rev 11191)
+++ branches/commenting-form/cgi-bin/LJ/Console/Command/SelfPromo.pm 2011-11-17 10:35:54 UTC (rev 11192)
@@ -184,7 +184,7 @@
if ( $cmd eq 'unban' ) {
if ( $object->isa('LJ::User') ) {
$object->clear_prop('selfpromo_banned');
- LJ::statushistory_add( $object, $admin, 'selfpromo', 'admin banned user. Reason: '. $reason );
+ LJ::statushistory_add( $object, $admin, 'selfpromo', 'admin unbanned user. Reason: '. $reason );
$self->info( $object->display_name . ' unbanned successfully.');
return 1;
}
Modified: branches/commenting-form/cgi-bin/LJ/Hooks/ESN.pm
===================================================================
--- branches/commenting-form/cgi-bin/LJ/Hooks/ESN.pm 2011-11-17 10:04:05 UTC (rev 11191)
+++ branches/commenting-form/cgi-bin/LJ/Hooks/ESN.pm 2011-11-17 10:35:54 UTC (rev 11192)
@@ -46,31 +46,23 @@
%{$opts->{_debug_headers} || {}}
);
- if ( $u->{opt_htmlemail} eq 'N' ) {
- LJ::send_mail({
- to => $ev->as_email_to($u),
- from => $ev->as_email_from(),
- fromname => scalar($ev->as_email_from_name($u)),
- wrap => 1,
- charset => $u->mailencoding || 'utf-8',
- subject => $email_subject,
- headers => \%headers,
- body => $plain_body,
- }) or die "unable to send notification email";
- } else {
- LJ::send_mail({
- to => $ev->as_email_to($u),
- from => $ev->as_email_from(),
- fromname => scalar($ev->as_email_from_name($u)),
- wrap => 1,
- charset => $u->mailencoding || 'utf-8',
- subject => $email_subject,
- headers => \%headers,
- body => $plain_body,
- html => $html_body,
- }) or die "unable to send notification email";
+ my $mail_param = {
+ to => $ev->as_email_to($u),
+ from => $ev->as_email_from(),
+ fromname => scalar($ev->as_email_from_name($u)),
+ wrap => 1,
+ charset => $u->mailencoding || 'utf-8',
+ subject => $email_subject,
+ headers => \%headers,
+ body => $plain_body,
+ };
+
+ unless ( $u->{opt_htmlemail} eq 'N' ) {
+ $mail_param->{'html'} = $html_body;
}
+ LJ::send_mail($mail_param) or die "unable to send notification email";
+
return 1;
});
Modified: branches/commenting-form/cgi-bin/LJ/Hooks/Homepage.pm
===================================================================
--- branches/commenting-form/cgi-bin/LJ/Hooks/Homepage.pm 2011-11-17 10:04:05 UTC (rev 11191)
+++ branches/commenting-form/cgi-bin/LJ/Hooks/Homepage.pm 2011-11-17 10:35:54 UTC (rev 11192)
@@ -59,9 +59,9 @@
## only Cyr users
return unless LJ::SUP->is_remote_sup;
- ## from 2011-09-22 00:00 MSK till 2011-09-29 23:59 MSK
+ ## from 2011-11-17 00:00:00 MSK till 2011-11-30 23:59:00 MSK
my $time = time();
- return if ($time < 1316635200 || $time > 1317326340); ## uncomment this line before commit!
+ return if ($time < 1321473600 || $time > 1322683140); ## uncomment this line before commit!
return 1;
}
@@ -71,7 +71,13 @@
if (LJ::_is_branding_active()) {
my $rnd = int(rand(1_000_000));
- return '<a href="http://ad.adriver.ru/cgi-bin/click.cgi?sid=1&bt=21&ad=300226&pid=683257&bid=1351890&bn=1351890&rnd=197384386" target="_blank" class="brandinglove-link"> </a><img src="http://sup.adfox.ru/7386/getCode?p1=bdptx&p2=v&pe=b&pfc=jere&pfb=xyai&puid1=&puid2=&puid3=&puid4=&puid5=&pr=' . $rnd . '" width="1" height="1" border="0" class="brandinglove-pixel" /><img src="http://ad.adriver.ru/cgi-bin/rle.cgi?sid=1&bt=21&ad=300226&pid=683257&bid=1351890&bn=1351890&rnd=197384386" width="1" height="1" border="0" class="brandinglove-pixel" />'
+ return
+ '<a href="http://sup.adfox.ru/7386/goLink?p1=bdxbj&p2=v&p5=zazi&pr=' .
+ $rnd .
+ '&puid1=&puid2=&puid3=&puid4=&puid5=" target="_blank" class="brandingomg-link"> </a>' .
+ '<img src="http://sup.adfox.ru/7386/getCode?p1=bdxbj&p2=v&pe=b&pfc=jnev&pfb=zazi&puid1=&puid2=&puid3=&puid4=&puid5=&pr=' .
+ $rnd .
+ '" width="1" height="1" border="0" class="brandingomg-pixel" />';
}
});
@@ -79,7 +85,7 @@
my $params = shift || {};
if (LJ::_is_branding_active()) {
- LJ::need_res('stc/reskining/2011/september/love/homepage.css');
+ LJ::need_res("stc/reskining/2011/november/omg/homepage.css");
return '';
}
##
@@ -113,20 +119,6 @@
my $is_sup = LJ::SUP->is_remote_sup();
my $time = time();
- ## LJSUP-9541: Desert header
- ## enable it for sup users right now
- ## Non sup - start at '01.09.2011 00:00 GMT'
- ## End date - Oct 1, 2011 MSK
- if ($time < 1317412800) {
- if ($is_sup){
- LJ::need_res("stc/reskining/2011/desert/header.css");
- return;
- } elsif ($time >= 1314835200){
- LJ::need_res("stc/reskining/2011/desert/header.css");
- return;
- }
- }
-
##
## The commented code below is left as an example
##
Modified: branches/commenting-form/cgi-bin/LJ/Worker/Repost/CommentToTwitter.pm
===================================================================
--- branches/commenting-form/cgi-bin/LJ/Worker/Repost/CommentToTwitter.pm 2011-11-17 10:04:05 UTC (rev 11191)
+++ branches/commenting-form/cgi-bin/LJ/Worker/Repost/CommentToTwitter.pm 2011-11-17 10:35:54 UTC (rev 11192)
@@ -16,6 +16,12 @@
my $journal = LJ::load_userid($arg->{'journalid'});
my $comment = LJ::Comment->new($journal, 'jtalkid' => $arg->{'jtalkid'});
+ unless ( LJ::Client::Twitter->get_user_access_token($poster) ) {
+ # if they don't have a token, pretend we reposted that without
+ # actually doing it
+ return $job->completed;
+ }
+
# if it has somehow disappeared in the meantime, pretend everything
# is fine and don't even attempt to repost
return $job->completed unless $comment->valid;
Modified: branches/commenting-form/cgi-bin/LJ/Worker/Repost/EntryToTwitter.pm
===================================================================
--- branches/commenting-form/cgi-bin/LJ/Worker/Repost/EntryToTwitter.pm 2011-11-17 10:04:05 UTC (rev 11191)
+++ branches/commenting-form/cgi-bin/LJ/Worker/Repost/EntryToTwitter.pm 2011-11-17 10:35:54 UTC (rev 11192)
@@ -14,6 +14,12 @@
my $journal = LJ::load_userid($arg->{'journalid'});
my $entry = LJ::Entry->new($journal, 'jitemid' => $arg->{'jitemid'});
+ unless ( LJ::Client::Twitter->get_user_access_token($poster) ) {
+ # if they don't have a token, pretend we reposted that without
+ # actually doing it
+ return $job->completed;
+ }
+
# if it has somehow disappeared in the meantime, pretend everything
# is fine and don't even attempt to repost
return $job->completed unless $entry->valid;
Modified: branches/commenting-form/htdocs/error-page.bml
===================================================================
--- branches/commenting-form/htdocs/error-page.bml 2011-11-17 10:04:05 UTC (rev 11191)
+++ branches/commenting-form/htdocs/error-page.bml 2011-11-17 10:35:54 UTC (rev 11192)
@@ -44,7 +44,7 @@
my $loggedin = $BML::COOKIE{'ljloggedin'};
if ($loggedin) {
my @us = split /:/, $loggedin;
- ($remoteid) = $us[0] =~ m#u(\d+)#;
+ ($remoteid) = $us[1] =~ m#u(\d+)#;
}
$remote = $remoteid ? LJ::load_userid($remoteid) : undef;
}
