[dw-nonfree] site/suggest needs a graceful exit if no suggestions user is configured
[commit: http://hg.dwscoalition.org/dw-nonfree/rev/2645a9fb632f]
http://bugs.dwscoalition.org/show_bug.cgi?id=3160
Move to config, do some checks, return a friendl(ier) error message.
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3160
Move to config, do some checks, return a friendl(ier) error message.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- etc/config-local.pl
- htdocs/site/suggest.bml
-------------------------------------------------------------------------------- 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: --------------------------------------------------------------------------------