Show proper error message if the account has since been deleted.

        Patch by kareila. 

diffs (94 lines):

diff -r b2e04d6bf1af -r 2f13841d0588 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat      Sat Aug 08 18:30:02 2009 +0000
+++ b/bin/upgrading/en.dat      Sat Aug 08 18:56:22 2009 +0000
@@ -1989,6 +1989,8 @@ event.xpost.failure.content=Crosspost to
 
 event.xpost.failure.title=Crosspost of <a 
href="[[entryurl]]">[[entrydesc]]</a> to [[accountname]] action failed.
 
+event.xpost.noaccount=Account not found.
+
 event.xpost.nosubject=an entry
 
 event.xpost.success.content=Crosspost to [[accountname]] successful.
diff -r b2e04d6bf1af -r 2f13841d0588 cgi-bin/LJ/Event/XPostFailure.pm
--- a/cgi-bin/LJ/Event/XPostFailure.pm  Sat Aug 08 18:30:02 2009 +0000
+++ b/cgi-bin/LJ/Event/XPostFailure.pm  Sat Aug 08 18:56:22 2009 +0000
@@ -58,11 +58,17 @@ sub always_checked { 1 }
 
 sub content {
     my $self = $_[0];
-    return BML::ml( 'event.xpost.failure.content',
+
+    if ( $self->account ) {
+        return BML::ml( 'event.xpost.failure.content',
             {
                 accountname => $self->account->displayname,
                 errmsg => $self->errmsg,
             } );
+
+    } else {
+        return BML::ml( 'event.xpost.noaccount' );
+    }
 }
 
 # short enough that we can just use this the normal content as the summary
@@ -73,10 +79,19 @@ sub content_summary {
 # the main title for the event
 sub as_html {
     my $self = $_[0];
+    my $subject = $self->entry->subject_html ?  $self->entry->subject_html : 
BML::ml('event.xpost.nosubject');
 
-    my $subject = $self->entry->subject_html ?  $self->entry->subject_html : 
BML::ml('event.xpost.nosubject');
-    return BML::ml('event.xpost.failure.title', { accountname => 
$self->account->displayname, entrydesc => $subject, entryurl => 
$self->entry->url });
+    if ( $self->account ) {
+        return BML::ml( 'event.xpost.failure.title',
+            {
+                accountname => $self->account->displayname,
+                entrydesc => $subject,
+                entryurl => $self->entry->url
+            });
 
+    } else {
+        return BML::ml( 'event.xpost.noaccount' );
+    }
 }
 
 # available for all users.
diff -r b2e04d6bf1af -r 2f13841d0588 cgi-bin/LJ/Event/XPostSuccess.pm
--- a/cgi-bin/LJ/Event/XPostSuccess.pm  Sat Aug 08 18:30:02 2009 +0000
+++ b/cgi-bin/LJ/Event/XPostSuccess.pm  Sat Aug 08 18:56:22 2009 +0000
@@ -37,7 +37,11 @@ sub always_checked { 1 }
 # FIXME make this more useful, like include a link to the crosspost
 sub content {
     my ($self) = @_;
-    return BML::ml('event.xpost.success.content', { accountname => 
$self->account->displayname });
+    if ( $self->account ) {
+        return BML::ml( 'event.xpost.success.content', { accountname => 
$self->account->displayname } );
+    } else {
+        return BML::ml( 'event.xpost.noaccount' );
+    }
 }
 
 # short enough that we can just use this the normal content as the summary
@@ -48,10 +52,19 @@ sub content_summary {
 # the main title for the event
 sub as_html {
     my $self = $_[0];
+    my $subject = $self->entry->subject_html ?  $self->entry->subject_html : 
BML::ml('event.xpost.nosubject');
 
-    my $subject = $self->entry->subject_html ?  $self->entry->subject_html : 
BML::ml('event.xpost.nosubject');
-    return BML::ml('event.xpost.success.title', { accountname => 
$self->account->displayname, entrydesc => $subject, entryurl => 
$self->entry->url });
+    if ( $self->account ) {
+        return BML::ml( 'event.xpost.success.title',
+            {
+                accountname => $self->account->displayname,
+                entrydesc => $subject,
+                entryurl => $self->entry->url
+            } );
 
+    } else {
+        return BML::ml( 'event.xpost.noaccount' );
+    }
 }
 
 # available for all users.
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to