afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2010-01-02 03:19 am

[dw-free] Non-existent FAQ throws error

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

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

Better error message when met with an unknown FAQ.

Patch by [personal profile] foxfirefey.

Files modified:
  • htdocs/support/faqbrowse.bml
  • htdocs/support/faqbrowse.bml.text
--------------------------------------------------------------------------------
diff -r 7391417900df -r e40ce51049ae htdocs/support/faqbrowse.bml
--- a/htdocs/support/faqbrowse.bml	Thu Dec 24 17:25:15 2009 +0000
+++ b/htdocs/support/faqbrowse.bml	Sat Jan 02 03:17:33 2010 +0000
@@ -76,6 +76,11 @@ body<=
     if ( $faqidarg ) {
         # loading single faqid
         @faqs = ( LJ::Faq->load( $faqidarg, lang => $lang ) );
+        unless ( $faqs[0] ) {
+            $$title = BML::ml( '.error.title_nofaq', { faqid => $faqidarg } );
+            $$body = BML::ml( '.error.nofaq' );
+            return $_[1]->{'body'};
+        }
         $faqs[0]->render_in_place( { user => $user, url => $user_url } );
         $$title = $faqs[0]->question_html;
     } elsif ( $faqcatarg ) {
diff -r 7391417900df -r e40ce51049ae htdocs/support/faqbrowse.bml.text
--- a/htdocs/support/faqbrowse.bml.text	Thu Dec 24 17:25:15 2009 +0000
+++ b/htdocs/support/faqbrowse.bml.text	Sat Jan 02 03:17:33 2010 +0000
@@ -17,6 +17,8 @@
 
 .error.nofaq=The specified FAQ does not exist.
 
+.error.title_nofaq=Error retrieving FAQ [[faqid]]
+
 .lastupdated=Last Updated:
 
 .more=Read More
--------------------------------------------------------------------------------