]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'master' into openid
authorTom Hughes <tom@compton.nu>
Sun, 9 May 2010 11:26:40 +0000 (12:26 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 9 May 2010 11:26:40 +0000 (12:26 +0100)
app/controllers/user_controller.rb
config/wiki_pages.yml
script/misc/update-wiki-pages [changed mode: 0644->0755]
script/update-spam-blocks [new file with mode: 0755]

index 41a08363cc5bb1b3bbca51df6ac49a075afc7ff3..923a6cfec0b93adf3197bebbb0962ac9d0c33b49 100644 (file)
@@ -298,7 +298,7 @@ class UserController < ApplicationController
         if params[:user]
           @user.pass_crypt = params[:user][:pass_crypt]
           @user.pass_crypt_confirmation = params[:user][:pass_crypt_confirmation]
-          @user.status = "active"
+          @user.status = "active" if @user.status == "pending"
           @user.email_valid = true
 
           if @user.save
index 37973766b1fed9088ae5d9097ace55f299fd80d4..e4ecca94b00d50475abb59d45ea5c2ce634a3d74 100644 (file)
@@ -10,6 +10,8 @@ cz:
     route=trolleybus: Cz:Tag:route=trolleybus
 da:
   key:
+    fee: Da:Key:fee
+    lit: Da:Key:lit
     maxheight: Da:Key:maxheight
   tag:
     highway=tertiary: Da:Tag:highway=tertiary
@@ -591,6 +593,7 @@ en:
     leisure=sports_centre: Tag:leisure=sports centre
     leisure=track: Tag:leisure=track
     leisure=water_park: Tag:leisure=water park
+    man_made=compass_rose: Tag:man made=compass rose
     man_made=crane: Tag:man made=crane
     man_made=cutline: Tag:man made=cutline
     man_made=dyke: Tag:man made=dyke
@@ -1036,6 +1039,7 @@ ja:
     crossing: Ja:Key:crossing
     cuisine: Ja:Key:cuisine
     cycleway: Ja:Key:cycleway
+    electrified: Ja:Key:electrified
     fixme: Ja:Key:fixme
     foot: Ja:Key:foot
     highway: Ja:Key:highway
@@ -1052,6 +1056,7 @@ ja:
     operator: Ja:Key:operator
     phone: Ja:Key:phone
     power: Ja:Key:power
+    power_source: Ja:Key:power source
     railway: Ja:Key:railway
     ref: Ja:Key:ref
     route: Ja:Key:route
@@ -1063,10 +1068,12 @@ ja:
     tracktype: Ja:Key:tracktype
     waterway: Ja:Key:waterway
     wheelchair: Ja:Key:wheelchair
+    wikipedia: Ja:Key:wikipedia
     wood: Ja:Key:wood
   tag:
     amenity=arts_centre: Ja:Tag:amenity=arts centre
     amenity=baby_hatch: Ja:Tag:amenity=baby hatch
+    amenity=bus_station: Ja:Tag:amenity=bus station
     amenity=cafe: Ja:Tag:amenity=cafe
     amenity=drinking_water: Ja:Tag:amenity=drinking water
     amenity=fast_food: Ja:Tag:amenity=fast food
@@ -1078,6 +1085,7 @@ ja:
     amenity=toilets: Ja:Tag:amenity=toilets
     amenity=vending_machine: Ja:Tag:amenity=vending machine
     amenity=veterinary: Ja:Tag:amenity=veterinary
+    barrier=lift_gate: Ja:Tag:barrier=lift gate
     highway=crossing: Ja:Tag:highway=crossing
     highway=footway: Ja:Tag:highway=footway
     highway=pedestrian: Ja:Tag:highway=pedestrian
@@ -1088,14 +1096,18 @@ ja:
     historic=archaeological_site: Ja:Tag:historic=archaeological site
     landuse=forest: Ja:Tag:landuse=forest
     landuse=wood: Ja:Tag:landuse=wood
+    leisure=dog_park: Ja:Tag:leisure=dog park
     leisure=ice_rink: Ja:Tag:leisure=ice rink
     man_made=lighthouse: Ja:Tag:man made=lighthouse
     natural=coastline: Ja:Tag:natural=coastline
     natural=wood: Ja:Tag:natural=wood
+    power=generator: Ja:Tag:power=generator
     railway=crossing: Ja:Tag:railway=crossing
     railway=level_crossing: Ja:Tag:railway=level crossing
     railway=rail: Ja:Tag:railway=rail
+    railway=station: Ja:Tag:railway=station
     shop=doityourself: Ja:Tag:shop=doityourself
+    shop=motorcycle: Ja:Tag:shop=motorcycle
     shop=outdoor: Ja:Tag:shop=outdoor
     tourism=hotel: Ja:Tag:tourism=hotel
     tourism=information: Ja:Tag:tourism=information
old mode 100644 (file)
new mode 100755 (executable)
index ffb1105..7cd40e5
@@ -42,7 +42,10 @@ Getopt::Long::Parser->new(
 # On --help
 help() if $help;
 
-help() unless $ARGV[0];
+my $out_file = $ARGV[0];
+$out_file //= 'config/wiki_pages.yml';
+
+help() unless -f $out_file;
 
 # Get a API interface
 my $mw = MediaWiki::API->new();
@@ -73,7 +76,7 @@ for my $lang ('', map { "${_}:" } qw[ Pt Fi De It HU Cz Fr RU Pl ]) {
 ok(1, "Got a total of $count{$_} ${_}s") for qw[ key value ];
 
 # Dump to .yml file
-open my $out, ">", $ARGV[0] or die "Can't open file '$ARGV[0]' supplied on the command line";
+open my $out, ">", $out_file or die "Can't open file '$out_file' supplied on the command line";
 say $out "# THIS FILE IS AUTOGENERATED WITH THE script/misc/update-wiki-pages";
 say $out "# PROGRAM DO NOT MANUALLY EDIT IT";
 say $out "";
diff --git a/script/update-spam-blocks b/script/update-spam-blocks
new file mode 100755 (executable)
index 0000000..eaf7d9d
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../config/environment'
+require 'generator'
+
+addresses = User.count(
+  :conditions => {
+    :status => ["suspended", "deleted"],
+    :creation_time => Time.now - 28.days .. Time.now
+  },
+  :group => :creation_ip
+)
+
+addresses.each do |address,count|
+  if count > 2
+    acl = Acl.find(:first, :conditions => {
+      :address => address,
+      :netmask => "255.255.255.255"
+    })
+
+    unless acl
+      Acl.create(
+        :address => address,
+        :netmask => "255.255.255.255",
+        :k => "no_account",
+        :v => "auto_spam_block"
+      )
+
+      puts "Blocked #{address}"
+    end
+  end
+end
+
+acls = Acl.find(:all, :conditions => {
+  :netmask => "255.255.255.255",
+  :k => "no_account_creation",
+  :v => "auto_spam_block"
+})
+
+acls.each do |acl|
+  unless addresses[acl.address]
+    acl.delete
+
+    puts "Unblocked #{acl.address}"
+  end
+end
+
+exit 0