Move to config, do some checks, return a friendl(ier) error message.

        Patch by kareila. 

diffs (37 lines):

diff -r e215e60f5f44 -r 2645a9fb632f etc/config-local.pl
--- a/etc/config-local.pl       Thu Oct 28 11:30:14 2010 +0800
+++ b/etc/config-local.pl       Fri Oct 29 14:44:56 2010 +0800
@@ -82,6 +82,10 @@
         paidaccountinfo => 
"http://www.dreamwidth.org/support/faqbrowse.bml?faqid=4";,
     );
 
+    # Configuration for suggestions community & adminbot
+    $SUGGESTIONS_COMM = "dw_suggestions";
+    $SUGGESTIONS_USER = "suggestions_bot";
+
     # 404 page
     # Uncomment if you don't want the (dw-free) default, 404-error.bml
     # (Note: you need to provide your own 404-error-local.bml)
diff -r e215e60f5f44 -r 2645a9fb632f htdocs/site/suggest.bml
--- a/htdocs/site/suggest.bml   Thu Oct 28 11:30:14 2010 +0800
+++ b/htdocs/site/suggest.bml   Fri Oct 29 14:44:56 2010 +0800
@@ -38,11 +38,17 @@ body<=
     my $emailselected = 1;
 
     # the community to post to:
-    my $destination = LJ::load_user( 'dw_suggestions' );
+    my $destination = LJ::load_user( $LJ::SUGGESTIONS_COMM );
 
     # the user (which should also be an admin of the community)
     # to post the maintainer-only address as:
-    my $suggestions_bot = LJ::load_user( 'suggestions_bot' );
+    my $suggestions_bot = LJ::load_user( $LJ::SUGGESTIONS_USER );
+
+    # verify proper configuration
+    return "<?errorbar This feature has not been configured for your site. 
errorbar?>"
+        unless $destination && $suggestions_bot &&
+               $destination->is_community &&
+               $suggestions_bot->can_manage_other( $destination );
 
     # handle the results of a POST request:
 
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to