fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-10-13 04:33 am

[dw-free] Preview style links for openid accounts should go to /read page

[commit: http://hg.dwscoalition.org/dw-free/rev/f563bbd8c481]

http://bugs.dwscoalition.org/show_bug.cgi?id=3071

Make the preview link actually useful for openid journals.

Patch by [staff profile] denise.

Files modified:
  • cgi-bin/LJ/User.pm
  • htdocs/customize/preview_redirect.bml
--------------------------------------------------------------------------------
diff -r e3bd0ee13d78 -r f563bbd8c481 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Wed Oct 13 12:21:07 2010 +0800
+++ b/cgi-bin/LJ/User.pm	Wed Oct 13 12:33:46 2010 +0800
@@ -5226,6 +5226,11 @@ sub load_identity_user {
     return $u;
 }
 
+# journal_base replacement for OpenID accounts. since they don't have
+# a journal, redirect to /read.
+sub openid_journal_base {
+    return $_[0]->journal_base . "/read";
+}
 
 # returns a URL if account is an OpenID identity.  undef otherwise.
 sub openid_identity {
diff -r e3bd0ee13d78 -r f563bbd8c481 htdocs/customize/preview_redirect.bml
--- a/htdocs/customize/preview_redirect.bml	Wed Oct 13 12:21:07 2010 +0800
+++ b/htdocs/customize/preview_redirect.bml	Wed Oct 13 12:33:46 2010 +0800
@@ -38,7 +38,12 @@ body<=
     my $styleid = $theme->get_preview_styleid($u);
 
     return $ML{'.error.preview'} unless $styleid;
-    return BML::redirect($u->journal_base . "/?s2id=$styleid");
+
+    if ( $u->is_identity ) {
+        return BML::redirect( $u->openid_journal_base .  "/?s2id=$styleid" );
+    } else {
+        return BML::redirect( $u->journal_base . "/?s2id=$styleid" );
+    }
 }
 _code?>
 <=body
--------------------------------------------------------------------------------