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

[dw-free] Remove JournalFen as an import/crosspost source.

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

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

Allow us to disable external sites via the config.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/DW/External/Site.pm
  • cgi-bin/LJ/Widget/ImportChooseSource.pm
--------------------------------------------------------------------------------
diff -r 61e82aece0c1 -r 69f3d5ce5d9d cgi-bin/DW/External/Site.pm
--- a/cgi-bin/DW/External/Site.pm	Tue May 03 11:18:42 2011 +0800
+++ b/cgi-bin/DW/External/Site.pm	Tue May 03 18:02:18 2011 +0800
@@ -86,7 +86,7 @@ sub get_sites { return values %domaintos
 # returns a list of all supported sites for crossposting
 sub get_xpost_sites {
     my %protocols = DW::External::XPostProtocol->get_all_protocols;
-    return grep { exists $protocols{ $_->{servicetype} } }
+    return grep { exists $protocols{ $_->{servicetype} } && LJ::is_enabled( "external_sites", $_ ) }
            values %domaintosite;
 }
 
diff -r 61e82aece0c1 -r 69f3d5ce5d9d cgi-bin/LJ/Widget/ImportChooseSource.pm
--- a/cgi-bin/LJ/Widget/ImportChooseSource.pm	Tue May 03 11:18:42 2011 +0800
+++ b/cgi-bin/LJ/Widget/ImportChooseSource.pm	Tue May 03 18:02:18 2011 +0800
@@ -33,7 +33,9 @@ sub render_body {
     return $class->ml( 'widget.importchoosesource.disabled' )
         unless LJ::is_enabled('importing');
 
-    my @services = (
+    my @services;
+
+    for my $service ( (
         {
             name => 'livejournal',
             url => 'livejournal.com',
@@ -49,7 +51,10 @@ sub render_body {
             url => 'journalfen.net',
             display_name => 'JournalFen',
         },
-    );
+    ) ){
+        push @services, $service
+            if LJ::is_enabled( "external_sites", { sitename => $service->{display_name}, domain => $service->{url} } );
+    }
 
     my $ret;
 
--------------------------------------------------------------------------------