Merge branch 'rails41'
This commit is contained in:
commit
c53db246f6
29 changed files with 248 additions and 209 deletions
10
Gemfile
10
Gemfile
|
@ -1,7 +1,7 @@
|
|||
source 'http://rubygems.org'
|
||||
source 'https://rubygems.org'
|
||||
|
||||
# Require rails
|
||||
gem 'rails', '4.0.5'
|
||||
gem 'rails', '4.1.4'
|
||||
|
||||
# Require things which have moved to gems in ruby 1.9
|
||||
gem 'bigdecimal', "~> 1.1.0", :platforms => :ruby_19
|
||||
|
@ -16,7 +16,7 @@ gem 'json'
|
|||
gem 'pg'
|
||||
|
||||
# Use SCSS for stylesheets
|
||||
gem 'sass-rails', '~> 4.0.0'
|
||||
gem 'sass-rails', '~> 4.0.3'
|
||||
|
||||
# Use Uglifier as compressor for JavaScript assets
|
||||
gem 'uglifier', '>= 1.3.0'
|
||||
|
@ -41,7 +41,7 @@ gem 'rinku', '>= 1.2.2', :require => 'rails_rinku'
|
|||
gem 'oauth-plugin', '>= 0.5.1'
|
||||
gem 'open_id_authentication', '>= 1.1.0'
|
||||
gem 'validates_email_format_of', '>= 1.5.1'
|
||||
gem 'composite_primary_keys', '>= 6.0.1'
|
||||
gem 'composite_primary_keys', '~> 7.0.3'
|
||||
gem 'http_accept_language', '~> 2.0.0'
|
||||
gem 'paperclip', '~> 4.0'
|
||||
gem 'deadlock_retry', '>= 1.2.0'
|
||||
|
@ -84,7 +84,7 @@ end
|
|||
# Gems needed for running tests
|
||||
group :test do
|
||||
gem 'timecop'
|
||||
gem 'minitest', '~> 4.7.0', :platforms => [:ruby_19, :ruby_20]
|
||||
gem 'minitest', '~> 5.1', :platforms => [:ruby_19, :ruby_20]
|
||||
end
|
||||
|
||||
# Needed in development as well so rake can see konacha tasks
|
||||
|
|
141
Gemfile.lock
141
Gemfile.lock
|
@ -1,37 +1,39 @@
|
|||
GEM
|
||||
remote: http://rubygems.org/
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
SystemTimer (1.2.3)
|
||||
actionmailer (4.0.5)
|
||||
actionpack (= 4.0.5)
|
||||
actionmailer (4.1.4)
|
||||
actionpack (= 4.1.4)
|
||||
actionview (= 4.1.4)
|
||||
mail (~> 2.5.4)
|
||||
actionpack (4.0.5)
|
||||
activesupport (= 4.0.5)
|
||||
builder (~> 3.1.0)
|
||||
erubis (~> 2.7.0)
|
||||
actionpack (4.1.4)
|
||||
actionview (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
rack (~> 1.5.2)
|
||||
rack-test (~> 0.6.2)
|
||||
actionpack-page_caching (1.0.2)
|
||||
actionpack (>= 4.0.0, < 5)
|
||||
activemodel (4.0.5)
|
||||
activesupport (= 4.0.5)
|
||||
builder (~> 3.1.0)
|
||||
activerecord (4.0.5)
|
||||
activemodel (= 4.0.5)
|
||||
activerecord-deprecated_finders (~> 1.0.2)
|
||||
activesupport (= 4.0.5)
|
||||
arel (~> 4.0.0)
|
||||
activerecord-deprecated_finders (1.0.3)
|
||||
activesupport (4.0.5)
|
||||
actionview (4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
activemodel (4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.1.4)
|
||||
activemodel (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
arel (~> 5.0.0)
|
||||
activesupport (4.1.4)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
minitest (~> 4.2)
|
||||
multi_json (~> 1.3)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo (~> 0.3.37)
|
||||
arel (4.0.2)
|
||||
tzinfo (~> 1.1)
|
||||
arel (5.0.1.20140414130214)
|
||||
bigdecimal (1.1.0)
|
||||
builder (3.1.4)
|
||||
capybara (2.2.1)
|
||||
builder (3.2.2)
|
||||
capybara (2.4.1)
|
||||
mime-types (>= 1.16)
|
||||
nokogiri (>= 1.3.3)
|
||||
rack (>= 1.0.0)
|
||||
|
@ -49,23 +51,24 @@ GEM
|
|||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.7.0)
|
||||
colorize (0.7.2)
|
||||
composite_primary_keys (6.0.3)
|
||||
activerecord (>= 4.0.0)
|
||||
dalli (2.7.1)
|
||||
colorize (0.7.3)
|
||||
composite_primary_keys (7.0.3)
|
||||
activerecord (~> 4.1.4)
|
||||
crass (0.2.0)
|
||||
dalli (2.7.2)
|
||||
deadlock_retry (1.2.0)
|
||||
dynamic_form (1.1.4)
|
||||
erubis (2.7.0)
|
||||
execjs (2.0.2)
|
||||
execjs (2.2.1)
|
||||
faraday (0.9.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
hike (1.2.3)
|
||||
htmlentities (4.3.1)
|
||||
htmlentities (4.3.2)
|
||||
http_accept_language (2.0.1)
|
||||
httpclient (2.3.4.1)
|
||||
httpclient (2.4.0)
|
||||
i18n (0.6.9)
|
||||
iconv (0.1)
|
||||
jquery-rails (3.1.0)
|
||||
jquery-rails (3.1.1)
|
||||
railties (>= 3.0, < 5.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (1.8.1)
|
||||
|
@ -74,10 +77,9 @@ GEM
|
|||
jsonify-rails (0.3.2)
|
||||
actionpack
|
||||
jsonify (< 0.4.0)
|
||||
jwt (0.1.13)
|
||||
multi_json (>= 1.5)
|
||||
jwt (1.0.0)
|
||||
kgio (2.9.2)
|
||||
konacha (3.2.2)
|
||||
konacha (3.2.3)
|
||||
actionpack (>= 3.1, < 5)
|
||||
capybara
|
||||
colorize
|
||||
|
@ -88,22 +90,24 @@ GEM
|
|||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.25.1)
|
||||
mini_portile (0.5.3)
|
||||
minitest (4.7.5)
|
||||
multi_json (1.10.0)
|
||||
mini_portile (0.6.0)
|
||||
minitest (5.3.5)
|
||||
multi_json (1.10.1)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
nokogiri (1.6.1)
|
||||
mini_portile (~> 0.5.0)
|
||||
nokogiri (1.6.2.1)
|
||||
mini_portile (= 0.6.0)
|
||||
nokogumbo (1.1.9)
|
||||
nokogiri
|
||||
oauth (0.4.7)
|
||||
oauth-plugin (0.5.1)
|
||||
multi_json
|
||||
oauth (~> 0.4.4)
|
||||
oauth2 (>= 0.5.0)
|
||||
rack
|
||||
oauth2 (0.9.3)
|
||||
oauth2 (0.9.4)
|
||||
faraday (>= 0.8, < 0.10)
|
||||
jwt (~> 0.1.8)
|
||||
jwt (~> 1.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (~> 1.2)
|
||||
|
@ -117,14 +121,14 @@ GEM
|
|||
cocaine (~> 0.5.3)
|
||||
mime-types
|
||||
pg (0.17.1)
|
||||
poltergeist (1.5.0)
|
||||
poltergeist (1.5.1)
|
||||
capybara (~> 2.1)
|
||||
cliver (~> 0.3.1)
|
||||
multi_json (~> 1.0)
|
||||
websocket-driver (>= 0.2.0)
|
||||
polyglot (0.3.4)
|
||||
polyglot (0.3.5)
|
||||
psych (2.0.5)
|
||||
r2 (0.2.3)
|
||||
r2 (0.2.5)
|
||||
rack (1.5.2)
|
||||
rack-cors (0.2.9)
|
||||
rack-openid (1.4.2)
|
||||
|
@ -132,28 +136,32 @@ GEM
|
|||
ruby-openid (>= 2.1.8)
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
rails (4.0.5)
|
||||
actionmailer (= 4.0.5)
|
||||
actionpack (= 4.0.5)
|
||||
activerecord (= 4.0.5)
|
||||
activesupport (= 4.0.5)
|
||||
rails (4.1.4)
|
||||
actionmailer (= 4.1.4)
|
||||
actionpack (= 4.1.4)
|
||||
actionview (= 4.1.4)
|
||||
activemodel (= 4.1.4)
|
||||
activerecord (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.0.5)
|
||||
sprockets-rails (~> 2.0.0)
|
||||
railties (= 4.1.4)
|
||||
sprockets-rails (~> 2.0)
|
||||
rails-i18n (4.0.2)
|
||||
i18n (~> 0.6)
|
||||
rails (>= 4.0)
|
||||
railties (4.0.5)
|
||||
actionpack (= 4.0.5)
|
||||
activesupport (= 4.0.5)
|
||||
railties (4.1.4)
|
||||
actionpack (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (10.3.1)
|
||||
redcarpet (3.1.1)
|
||||
rake (10.3.2)
|
||||
redcarpet (3.1.2)
|
||||
rinku (1.7.3)
|
||||
ruby-openid (2.5.0)
|
||||
sanitize (2.1.0)
|
||||
sanitize (3.0.0)
|
||||
crass (~> 0.2.0)
|
||||
nokogiri (>= 1.4.4)
|
||||
nokogumbo (= 1.1.9)
|
||||
sass (3.2.19)
|
||||
sass-rails (4.0.3)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
|
@ -166,23 +174,24 @@ GEM
|
|||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
sprockets-rails (2.0.1)
|
||||
sprockets-rails (2.1.3)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (~> 2.8)
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.3)
|
||||
thread_safe (0.3.4)
|
||||
tilt (1.4.1)
|
||||
timecop (0.7.1)
|
||||
treetop (1.4.15)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.39)
|
||||
uglifier (2.5.0)
|
||||
tzinfo (1.2.1)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (2.5.1)
|
||||
execjs (>= 0.3.0)
|
||||
json (>= 1.8.0)
|
||||
validates_email_format_of (1.5.3)
|
||||
vendorer (0.1.15)
|
||||
vendorer (0.1.16)
|
||||
websocket-driver (0.3.3)
|
||||
xpath (2.0.0)
|
||||
nokogiri (~> 1.3)
|
||||
|
@ -195,7 +204,7 @@ DEPENDENCIES
|
|||
actionpack-page_caching
|
||||
bigdecimal (~> 1.1.0)
|
||||
coffee-rails (~> 4.0.0)
|
||||
composite_primary_keys (>= 6.0.1)
|
||||
composite_primary_keys (~> 7.0.3)
|
||||
dalli
|
||||
deadlock_retry (>= 1.2.0)
|
||||
dynamic_form
|
||||
|
@ -209,7 +218,7 @@ DEPENDENCIES
|
|||
kgio
|
||||
konacha
|
||||
libxml-ruby (>= 2.0.5)
|
||||
minitest (~> 4.7.0)
|
||||
minitest (~> 5.1)
|
||||
oauth-plugin (>= 0.5.1)
|
||||
open_id_authentication (>= 1.1.0)
|
||||
openstreetmap-i18n-js (>= 3.0.0.rc5.3)
|
||||
|
@ -219,13 +228,13 @@ DEPENDENCIES
|
|||
psych
|
||||
r2
|
||||
rack-cors
|
||||
rails (= 4.0.5)
|
||||
rails (= 4.1.4)
|
||||
rails-i18n (~> 4.0.0)
|
||||
redcarpet
|
||||
rinku (>= 1.2.2)
|
||||
ruby-openid (>= 2.2.0)
|
||||
sanitize
|
||||
sass-rails (~> 4.0.0)
|
||||
sass-rails (~> 4.0.3)
|
||||
soap4r-ruby1.9
|
||||
timecop
|
||||
uglifier (>= 1.3.0)
|
||||
|
|
|
@ -284,7 +284,7 @@ class ChangesetController < ApplicationController
|
|||
elsif params[:bbox]
|
||||
changesets = conditions_bbox(changesets, BoundingBox.from_bbox_params(params))
|
||||
elsif params[:friends] && @user
|
||||
changesets = changesets.where(:user_id => @user.friend_users.public)
|
||||
changesets = changesets.where(:user_id => @user.friend_users.identifiable)
|
||||
elsif params[:nearby] && @user
|
||||
changesets = changesets.where(:user_id => @user.nearby)
|
||||
end
|
||||
|
|
|
@ -49,13 +49,13 @@ class TraceController < ApplicationController
|
|||
if @user
|
||||
@traces = Trace.visible_to(@user) #1
|
||||
else
|
||||
@traces = Trace.public #2
|
||||
@traces = Trace.visible_to_all #2
|
||||
end
|
||||
else
|
||||
if @user and @user == target_user
|
||||
@traces = @user.traces #3 (check vs user id, so no join + can't pick up non-public traces by changing name)
|
||||
else
|
||||
@traces = target_user.traces.public #4
|
||||
@traces = target_user.traces.visible_to_all #4
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -206,7 +206,7 @@ class TraceController < ApplicationController
|
|||
end
|
||||
|
||||
def georss
|
||||
@traces = Trace.public.visible
|
||||
@traces = Trace.visible_to_all.visible
|
||||
|
||||
if params[:display_name]
|
||||
@traces = @traces.joins(:user).where(:users => {:display_name => params[:display_name]})
|
||||
|
|
|
@ -26,7 +26,7 @@ class UserPreferenceController < ApplicationController
|
|||
##
|
||||
# return the value for a single preference
|
||||
def read_one
|
||||
pref = UserPreference.find(@user.id, params[:preference_key])
|
||||
pref = UserPreference.find([@user.id, params[:preference_key]])
|
||||
|
||||
render :text => pref.v.to_s, :content_type => "text/plain"
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ class UserPreferenceController < ApplicationController
|
|||
# update the value of a single preference
|
||||
def update_one
|
||||
begin
|
||||
pref = UserPreference.find(@user.id, params[:preference_key])
|
||||
pref = UserPreference.find([@user.id, params[:preference_key]])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
pref = UserPreference.new
|
||||
pref.user = @user
|
||||
|
@ -85,7 +85,7 @@ class UserPreferenceController < ApplicationController
|
|||
##
|
||||
# delete a single preference
|
||||
def delete_one
|
||||
UserPreference.find(@user.id, params[:preference_key]).delete
|
||||
UserPreference.find([@user.id, params[:preference_key]]).delete
|
||||
|
||||
render :text => "", :content_type => "text/plain"
|
||||
end
|
||||
|
|
|
@ -92,7 +92,7 @@ private
|
|||
]
|
||||
|
||||
def icon_tags(object)
|
||||
object.tags.find_all { |k,v| ICON_TAGS.include? k }
|
||||
object.tags.find_all { |k,v| ICON_TAGS.include? k }.sort
|
||||
end
|
||||
|
||||
def wiki_link(type, lookup)
|
||||
|
|
|
@ -7,7 +7,7 @@ class Trace < ActiveRecord::Base
|
|||
|
||||
scope :visible, -> { where(:visible => true) }
|
||||
scope :visible_to, ->(u) { visible.where("visibility IN ('public', 'identifiable') OR user_id = ?", u) }
|
||||
scope :public, -> { where(:visibility => ["public", "identifiable"]) }
|
||||
scope :visible_to_all, -> { where(:visibility => ["public", "identifiable"]) }
|
||||
scope :tagged, ->(t) { joins(:tags).where(:gpx_file_tags => { :tag => t }) }
|
||||
|
||||
validates_presence_of :user_id, :name, :timestamp
|
||||
|
|
|
@ -26,7 +26,7 @@ class User < ActiveRecord::Base
|
|||
|
||||
scope :visible, -> { where(:status => ["pending", "active", "confirmed"]) }
|
||||
scope :active, -> { where(:status => ["active", "confirmed"]) }
|
||||
scope :public, -> { where(:data_public => true) }
|
||||
scope :identifiable, -> { where(:data_public => true) }
|
||||
|
||||
has_attached_file :image,
|
||||
:default_url => "/assets/:class/:attachment/:style.png",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require ::File.expand_path('../config/environment', __FILE__)
|
||||
run OpenStreetMap::Application
|
||||
run Rails.application
|
||||
|
|
|
@ -14,7 +14,7 @@ end
|
|||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(:default, Rails.env)
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
module OpenStreetMap
|
||||
class Application < Rails::Application
|
||||
|
@ -33,9 +33,6 @@ module OpenStreetMap
|
|||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
config.autoload_paths += %W(#{config.root}/lib)
|
||||
|
||||
# Configure the default encoding used in templates for Ruby 1.9.
|
||||
config.encoding = "utf-8"
|
||||
|
||||
# Use SQL instead of Active Record's schema dumper when creating the database.
|
||||
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
||||
# like if you have constraints or database-specific column types
|
||||
|
@ -43,12 +40,6 @@ module OpenStreetMap
|
|||
config.active_record.schema_format = :sql
|
||||
end
|
||||
|
||||
# Enable the asset pipeline
|
||||
config.assets.enabled = true
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets
|
||||
config.assets.version = '1.0'
|
||||
|
||||
# Don't eager load models when the database is offline
|
||||
if STATUS == :database_offline
|
||||
config.paths["app/models"].skip_eager_load!
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
require 'rubygems'
|
||||
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
|
||||
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
||||
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Load the rails application
|
||||
# Load the Rails application.
|
||||
require File.expand_path('../application', __FILE__)
|
||||
|
||||
# Initialize the rails application
|
||||
OpenStreetMap::Application.initialize!
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
|
|
|
@ -19,11 +19,19 @@ OpenStreetMap::Application.configure do
|
|||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Raise an error on page load if there are pending migrations
|
||||
# Raise an error on page load if there are pending migrations.
|
||||
config.active_record.migration_error = :page_load
|
||||
|
||||
# Debug mode disables concatenation and preprocessing of assets.
|
||||
# This option may cause significant delays in view rendering with a large
|
||||
# number of complex assets.
|
||||
config.assets.debug = true
|
||||
|
||||
# Adds additional error checking when serving assets at runtime.
|
||||
# Checks for improperly declared sprockets dependencies.
|
||||
# Raises helpful error messages.
|
||||
config.assets.raise_runtime_errors = true
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ OpenStreetMap::Application.configure do
|
|||
config.cache_classes = true
|
||||
|
||||
# Eager load code on boot. This eager loads most of Rails and
|
||||
# your application in memory, allowing both thread web servers
|
||||
# your application in memory, allowing both threaded web servers
|
||||
# and those relying on copy on write to perform better.
|
||||
# Rake tasks automatically ignore this option for performance.
|
||||
config.eager_load = true
|
||||
|
@ -32,9 +32,6 @@ OpenStreetMap::Application.configure do
|
|||
# Generate digests for assets URLs.
|
||||
config.assets.digest = true
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
config.assets.version = '1.0'
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||
|
@ -67,24 +64,7 @@ OpenStreetMap::Application.configure do
|
|||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
config.assets.precompile += %w( index.js browse.js welcome.js fixthemap.js )
|
||||
config.assets.precompile += %w( user.js diary_entry.js swfobject.js )
|
||||
config.assets.precompile += %w( large-ltr.css small-ltr.css print-ltr.css )
|
||||
config.assets.precompile += %w( large-rtl.css small-rtl.css print-rtl.css )
|
||||
config.assets.precompile += %w( leaflet-all.css leaflet.ie.css )
|
||||
config.assets.precompile += %w( embed.js embed.css )
|
||||
config.assets.precompile += %w( html5shiv.js )
|
||||
config.assets.precompile += %w( images/marker-*.png img/*-handle.png )
|
||||
config.assets.precompile += %w( potlatch2.swf )
|
||||
config.assets.precompile += %w( potlatch2/assets.zip )
|
||||
config.assets.precompile += %w( potlatch2/FontLibrary.swf )
|
||||
config.assets.precompile += %w( potlatch2/locales/*.swf )
|
||||
config.assets.precompile += %w( help/introduction.* )
|
||||
config.assets.precompile += %w( iD.js iD.css )
|
||||
config.assets.precompile += %w( iD/img/*.svg iD/img/*.png iD/img/*.gif )
|
||||
config.assets.precompile += %w( iD/img/pattern/*.png )
|
||||
# `config.assets.precompile` has moved to config/initializers/assets.rb
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
|
@ -102,4 +82,7 @@ OpenStreetMap::Application.configure do
|
|||
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ OpenStreetMap::Application.configure do
|
|||
|
||||
# Configure static asset server for tests with Cache-Control for performance.
|
||||
config.serve_static_assets = true
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
config.static_cache_control = 'public, max-age=3600'
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
|
@ -33,4 +33,7 @@ OpenStreetMap::Application.configure do
|
|||
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
end
|
||||
|
|
23
config/initializers/assets.rb
Normal file
23
config/initializers/assets.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets.
|
||||
Rails.application.config.assets.version = '1.0'
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
Rails.application.config.assets.precompile += %w( index.js browse.js welcome.js fixthemap.js )
|
||||
Rails.application.config.assets.precompile += %w( user.js diary_entry.js swfobject.js )
|
||||
Rails.application.config.assets.precompile += %w( large-ltr.css small-ltr.css print-ltr.css )
|
||||
Rails.application.config.assets.precompile += %w( large-rtl.css small-rtl.css print-rtl.css )
|
||||
Rails.application.config.assets.precompile += %w( leaflet-all.css leaflet.ie.css )
|
||||
Rails.application.config.assets.precompile += %w( embed.js embed.css )
|
||||
Rails.application.config.assets.precompile += %w( html5shiv.js )
|
||||
Rails.application.config.assets.precompile += %w( images/marker-*.png img/*-handle.png )
|
||||
Rails.application.config.assets.precompile += %w( potlatch2.swf )
|
||||
Rails.application.config.assets.precompile += %w( potlatch2/assets.zip )
|
||||
Rails.application.config.assets.precompile += %w( potlatch2/FontLibrary.swf )
|
||||
Rails.application.config.assets.precompile += %w( potlatch2/locales/*.swf )
|
||||
Rails.application.config.assets.precompile += %w( help/introduction.* )
|
||||
Rails.application.config.assets.precompile += %w( iD.js iD.css )
|
||||
Rails.application.config.assets.precompile += %w( iD/img/*.svg iD/img/*.png iD/img/*.gif )
|
||||
Rails.application.config.assets.precompile += %w( iD/img/pattern/*.png )
|
3
config/initializers/cookies_serializer.rb
Normal file
3
config/initializers/cookies_serializer.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
|
@ -2,7 +2,7 @@ if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
|||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
class PostgreSQLAdapter
|
||||
def initialize_type_map_with_enums
|
||||
def initialize_type_map_with_enums(type_map)
|
||||
OID.alias_type "format_enum", "text"
|
||||
OID.alias_type "gpx_visibility_enum", "text"
|
||||
OID.alias_type "note_status_enum", "text"
|
||||
|
@ -11,7 +11,7 @@ if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
|||
OID.alias_type "user_role_enum", "text"
|
||||
OID.alias_type "user_status_enum", "text"
|
||||
|
||||
initialize_type_map_without_enums
|
||||
initialize_type_map_without_enums(type_map)
|
||||
end
|
||||
|
||||
alias_method_chain :initialize_type_map, :enums
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key is used for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
# You can use `rake secret` to generate a secure secret key.
|
||||
|
||||
# Make sure your secret_key_base is kept private
|
||||
# if you're sharing your code publicly.
|
||||
OpenStreetMap::Application.config.secret_key_base = '8be565e2e25831d88231f4bcfd83dfc3ab33957c4f33bb3cff7a279f7820ec4d0c1111f246bb347c68859c0b46b4e591be9179a53a5a7165a9936000d6d2be41'
|
|
@ -1,7 +1,7 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
if defined?(MEMCACHE_SERVERS)
|
||||
OpenStreetMap::Application.config.session_store :mem_cache_store, :memcache_server => MEMCACHE_SERVERS, :namespace => "rails:session", :key => "_osm_session"
|
||||
Rails.application.config.session_store :mem_cache_store, :memcache_server => MEMCACHE_SERVERS, :namespace => "rails:session", :key => "_osm_session"
|
||||
else
|
||||
OpenStreetMap::Application.config.session_store :cache_store, :key => '_osm_session'
|
||||
Rails.application.config.session_store :cache_store, :key => '_osm_session'
|
||||
end
|
||||
|
|
22
config/secrets.yml
Normal file
22
config/secrets.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key is used for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
# You can use `rake secret` to generate a secure secret key.
|
||||
|
||||
# Make sure the secrets in this file are kept private
|
||||
# if you're sharing your code publicly.
|
||||
|
||||
development:
|
||||
secret_key_base: 1ce5ed17771b4fdc3f755c5b98459d67816f99ec5889ec2fa7bf2bd3cba3ad5cc453693ce3c5d121669be478fb811136f4f483e6f39ac1f0e34ba66e8acab574
|
||||
|
||||
test:
|
||||
secret_key_base: 10d52b1bf88c429e73ffbc5e5f58b037db21f38ea88b8b454e55d52ed8bcc6e7fe3b48a79b2f36eb78a4685224d707767d083f79c51f7d81a9d4a06d1c1e2534
|
||||
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
production:
|
||||
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
|
@ -1,48 +1,50 @@
|
|||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
module SchemaStatements
|
||||
def quote_column_names(column_name)
|
||||
Array(column_name).map { |e| quote_column_name(e) }.join(", ")
|
||||
end
|
||||
|
||||
def add_primary_key(table_name, column_name, options = {})
|
||||
column_names = Array(column_name)
|
||||
quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(", ")
|
||||
execute "ALTER TABLE #{table_name} ADD PRIMARY KEY (#{quoted_column_names})"
|
||||
end
|
||||
|
||||
def remove_primary_key(table_name)
|
||||
execute "ALTER TABLE #{table_name} DROP PRIMARY KEY"
|
||||
end
|
||||
|
||||
def add_foreign_key(table_name, column_name, reftbl, refcol = nil)
|
||||
execute "ALTER TABLE #{table_name} ADD " +
|
||||
"FOREIGN KEY (#{quote_column_names(column_name)}) " +
|
||||
"REFERENCES #{reftbl} (#{quote_column_names(refcol || column_name)})"
|
||||
end
|
||||
|
||||
def remove_foreign_key(table_name, column_name, reftbl, refcol = nil)
|
||||
execute "ALTER TABLE #{table_name} DROP " +
|
||||
"CONSTRAINT #{table_name}_#{column_name[0]}_fkey"
|
||||
end
|
||||
|
||||
alias_method :old_options_include_default?, :options_include_default?
|
||||
|
||||
def options_include_default?(options)
|
||||
return false if options[:options] =~ /AUTO_INCREMENT/i
|
||||
return old_options_include_default?(options)
|
||||
end
|
||||
|
||||
alias_method :old_add_column_options!, :add_column_options!
|
||||
|
||||
def add_column_options!(sql, options)
|
||||
sql << " UNSIGNED" if options[:unsigned]
|
||||
old_add_column_options!(sql, options)
|
||||
sql << " #{options[:options]}"
|
||||
end
|
||||
end
|
||||
|
||||
class PostgreSQLAdapter
|
||||
class SchemaCreation
|
||||
alias_method :old_add_column_options!, :add_column_options!
|
||||
|
||||
def add_column_options!(sql, options)
|
||||
sql << " UNSIGNED" if options[:unsigned]
|
||||
old_add_column_options!(sql, options)
|
||||
sql << " #{options[:options]}"
|
||||
end
|
||||
end
|
||||
|
||||
module SchemaStatements
|
||||
def quote_column_names(column_name)
|
||||
Array(column_name).map { |e| quote_column_name(e) }.join(", ")
|
||||
end
|
||||
|
||||
def add_primary_key(table_name, column_name, options = {})
|
||||
column_names = Array(column_name)
|
||||
quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(", ")
|
||||
execute "ALTER TABLE #{table_name} ADD PRIMARY KEY (#{quoted_column_names})"
|
||||
end
|
||||
|
||||
def remove_primary_key(table_name)
|
||||
execute "ALTER TABLE #{table_name} DROP PRIMARY KEY"
|
||||
end
|
||||
|
||||
def add_foreign_key(table_name, column_name, reftbl, refcol = nil)
|
||||
execute "ALTER TABLE #{table_name} ADD " +
|
||||
"FOREIGN KEY (#{quote_column_names(column_name)}) " +
|
||||
"REFERENCES #{reftbl} (#{quote_column_names(refcol || column_name)})"
|
||||
end
|
||||
|
||||
def remove_foreign_key(table_name, column_name, reftbl, refcol = nil)
|
||||
execute "ALTER TABLE #{table_name} DROP " +
|
||||
"CONSTRAINT #{table_name}_#{column_name[0]}_fkey"
|
||||
end
|
||||
|
||||
# alias_method :old_options_include_default?, :options_include_default?
|
||||
#
|
||||
# def options_include_default?(options)
|
||||
# return false if options[:options] =~ /AUTO_INCREMENT/i
|
||||
# return old_options_include_default?(options)
|
||||
# end
|
||||
end
|
||||
|
||||
alias_method :old_native_database_types, :native_database_types
|
||||
|
||||
def native_database_types
|
||||
|
|
|
@ -163,10 +163,10 @@ class TraceControllerTest < ActionController::TestCase
|
|||
# Check that the list of changesets is displayed
|
||||
def test_list
|
||||
get :list
|
||||
check_trace_list Trace.public
|
||||
check_trace_list Trace.visible_to_all
|
||||
|
||||
get :list, :tag => "London"
|
||||
check_trace_list Trace.tagged("London").public
|
||||
check_trace_list Trace.tagged("London").visible_to_all
|
||||
end
|
||||
|
||||
# Check that I can get mine
|
||||
|
@ -188,15 +188,15 @@ class TraceControllerTest < ActionController::TestCase
|
|||
def test_list_user
|
||||
# Test a user with no traces
|
||||
get :list, :display_name => users(:second_public_user).display_name
|
||||
check_trace_list users(:second_public_user).traces.public
|
||||
check_trace_list users(:second_public_user).traces.visible_to_all
|
||||
|
||||
# Test a user with some traces - should see only public ones
|
||||
get :list, :display_name => users(:public_user).display_name
|
||||
check_trace_list users(:public_user).traces.public
|
||||
check_trace_list users(:public_user).traces.visible_to_all
|
||||
|
||||
# Should still see only public ones when authenticated as another user
|
||||
get :list, {:display_name => users(:public_user).display_name}, {:user => users(:normal_user).id}
|
||||
check_trace_list users(:public_user).traces.public
|
||||
check_trace_list users(:public_user).traces.visible_to_all
|
||||
|
||||
# Should see all traces when authenticated as the target user
|
||||
get :list, {:display_name => users(:public_user).display_name}, {:user => users(:public_user).id}
|
||||
|
@ -210,16 +210,16 @@ class TraceControllerTest < ActionController::TestCase
|
|||
# Check that the rss loads
|
||||
def test_rss
|
||||
get :georss, :format => :rss
|
||||
check_trace_feed Trace.public
|
||||
check_trace_feed Trace.visible_to_all
|
||||
|
||||
get :georss, :tag => "London", :format => :rss
|
||||
check_trace_feed Trace.tagged("London").public
|
||||
check_trace_feed Trace.tagged("London").visible_to_all
|
||||
|
||||
get :georss, :display_name => users(:public_user).display_name, :format => :rss
|
||||
check_trace_feed users(:public_user).traces.public
|
||||
check_trace_feed users(:public_user).traces.visible_to_all
|
||||
|
||||
get :georss, :display_name => users(:public_user).display_name, :tag => "Birmingham", :format => :rss
|
||||
check_trace_feed users(:public_user).traces.tagged("Birmingham").public
|
||||
check_trace_feed users(:public_user).traces.tagged("Birmingham").visible_to_all
|
||||
end
|
||||
|
||||
# Test viewing a trace
|
||||
|
|
|
@ -223,9 +223,10 @@ class UserBlocksControllerTest < ActionController::TestCase
|
|||
:user_block_period => "12",
|
||||
:user_block => { :needs_view => false, :reason => "Vandalism" }
|
||||
end
|
||||
assert_redirected_to user_block_path(:id => 4)
|
||||
id = UserBlock.order(:id).ids.last
|
||||
assert_redirected_to user_block_path(:id => id)
|
||||
assert_equal "Created a block on user #{users(:unblocked_user).display_name}.", flash[:notice]
|
||||
b = UserBlock.find(4)
|
||||
b = UserBlock.find(id)
|
||||
assert_in_delta Time.now, b.created_at, 1
|
||||
assert_in_delta Time.now, b.updated_at, 1
|
||||
assert_in_delta Time.now + 12.hour, b.ends_at, 1
|
||||
|
|
|
@ -92,10 +92,10 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
put :update
|
||||
end
|
||||
assert_response :unauthorized, "should be authenticated"
|
||||
assert_equal "value", UserPreference.find(1, "key").v
|
||||
assert_equal "some_value", UserPreference.find(1, "some_key").v
|
||||
assert_equal "value", UserPreference.find([1, "key"]).v
|
||||
assert_equal "some_value", UserPreference.find([1, "some_key"]).v
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
UserPreference.find(1, "new_key")
|
||||
UserPreference.find([1, "new_key"])
|
||||
end
|
||||
|
||||
# authenticate as a user with preferences
|
||||
|
@ -109,10 +109,10 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
assert_response :success
|
||||
assert_equal "text/plain", @response.content_type
|
||||
assert_equal "", @response.body
|
||||
assert_equal "new_value", UserPreference.find(1, "key").v
|
||||
assert_equal "value", UserPreference.find(1, "new_key").v
|
||||
assert_equal "new_value", UserPreference.find([1, "key"]).v
|
||||
assert_equal "value", UserPreference.find([1, "new_key"]).v
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
UserPreference.find(1, "some_key")
|
||||
UserPreference.find([1, "some_key"])
|
||||
end
|
||||
|
||||
# try a put with duplicate keys
|
||||
|
@ -123,7 +123,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
assert_response :bad_request
|
||||
assert_equal "text/plain", @response.content_type
|
||||
assert_equal "Duplicate preferences with key key", @response.body
|
||||
assert_equal "new_value", UserPreference.find(1, "key").v
|
||||
assert_equal "new_value", UserPreference.find([1, "key"]).v
|
||||
|
||||
# try a put with invalid content
|
||||
assert_no_difference "UserPreference.count" do
|
||||
|
@ -143,7 +143,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
end
|
||||
assert_response :unauthorized, "should be authenticated"
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
UserPreference.find(1, "new_key")
|
||||
UserPreference.find([1, "new_key"])
|
||||
end
|
||||
|
||||
# authenticate as a user with preferences
|
||||
|
@ -157,7 +157,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
assert_response :success
|
||||
assert_equal "text/plain", @response.content_type
|
||||
assert_equal "", @response.body
|
||||
assert_equal "new_value", UserPreference.find(1, "new_key").v
|
||||
assert_equal "new_value", UserPreference.find([1, "new_key"]).v
|
||||
|
||||
# try changing the value of a preference
|
||||
assert_no_difference "UserPreference.count" do
|
||||
|
@ -167,7 +167,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
assert_response :success
|
||||
assert_equal "text/plain", @response.content_type
|
||||
assert_equal "", @response.body
|
||||
assert_equal "newer_value", UserPreference.find(1, "new_key").v
|
||||
assert_equal "newer_value", UserPreference.find([1, "new_key"]).v
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -178,7 +178,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
delete :delete_one, :preference_key => "key"
|
||||
end
|
||||
assert_response :unauthorized, "should be authenticated"
|
||||
assert_equal "value", UserPreference.find(1, "key").v
|
||||
assert_equal "value", UserPreference.find([1, "key"]).v
|
||||
|
||||
# authenticate as a user with preferences
|
||||
basic_authorization("test@openstreetmap.org", "test")
|
||||
|
@ -191,7 +191,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
assert_equal "text/plain", @response.content_type
|
||||
assert_equal "", @response.body
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
UserPreference.find(1, "key")
|
||||
UserPreference.find([1, "key"])
|
||||
end
|
||||
|
||||
# try the delete again for the same key
|
||||
|
@ -200,7 +200,7 @@ class UserPreferenceControllerTest < ActionController::TestCase
|
|||
end
|
||||
assert_response :not_found
|
||||
assert_raises ActiveRecord::RecordNotFound do
|
||||
UserPreference.find(1, "key")
|
||||
UserPreference.find([1, "key"])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,6 +7,10 @@ class ApplicationHelperTest < ActionView::TestCase
|
|||
I18n.locale = "en"
|
||||
end
|
||||
|
||||
def setup
|
||||
I18n.locale = "en"
|
||||
end
|
||||
|
||||
def test_linkify
|
||||
%w(http://example.com/test ftp://example.com/test https://example.com/test).each do |link|
|
||||
text = "Test #{link} is made into a link"
|
||||
|
|
|
@ -12,6 +12,10 @@ class BrowseHelperTest < ActionView::TestCase
|
|||
I18n.locale = "en"
|
||||
end
|
||||
|
||||
def teardown
|
||||
I18n.locale = "en"
|
||||
end
|
||||
|
||||
def test_printable_name
|
||||
assert_equal "17", printable_name(current_nodes(:redacted_node))
|
||||
assert_equal "<bdi>Test Node</bdi> (<bdi>18</bdi>)", printable_name(current_nodes(:node_with_name))
|
||||
|
|
|
@ -27,8 +27,8 @@ class TraceTest < ActiveSupport::TestCase
|
|||
check_query(Trace.visible_to(3), [:public_trace_file, :identifiable_trace_file])
|
||||
end
|
||||
|
||||
def test_public
|
||||
check_query(Trace.public, [:public_trace_file, :identifiable_trace_file, :deleted_trace_file])
|
||||
def test_visible_to_all
|
||||
check_query(Trace.visible_to_all, [:public_trace_file, :identifiable_trace_file, :deleted_trace_file])
|
||||
end
|
||||
|
||||
def test_tagged
|
||||
|
|
|
@ -180,10 +180,10 @@ class UserTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_public
|
||||
assert_equal 16, User.public.count
|
||||
def test_identifiable
|
||||
assert_equal 16, User.identifiable.count
|
||||
assert_raise ActiveRecord::RecordNotFound do
|
||||
User.public.find(users(:normal_user).id)
|
||||
User.identifiable.find(users(:normal_user).id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue