From: Tom Hughes Date: Wed, 30 Oct 2019 19:20:30 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/2412' X-Git-Tag: live~3039 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/90e2a144dca37f910eb70107158773a8c23ea469?hp=15865b5a8dcd48514b3eb00019502c28b0648caf Merge remote-tracking branch 'upstream/pull/2412' --- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5a2ed5ab7..439e2e95f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,6 +62,15 @@ only submit changes to the `en.yml` file. The other files are updated via [Translatewiki](https://translatewiki.net/wiki/Translating:OpenStreetMap) and should not be included in your pull request. +### Nominatim prefixes + +I18n keys under the `geocoder.search_osm_nominatim` keyspace are managed by the +Nominatim maintainers. From time to time they run stats over the Nominatim +database, and update the list of available keys manually. + +Adding or removing keys to this list is therefore discouraged, but contributions +to the descriptive texts are welcome. + ## Code Documentation To generate the HTML documentation of the API/rails code, run the command diff --git a/Gemfile.lock b/Gemfile.lock index 97473d9ac..ebc633ff3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -61,17 +61,17 @@ GEM autoprefixer-rails (8.6.5) execjs aws-eventstream (1.0.3) - aws-partitions (1.226.0) - aws-sdk-core (3.69.1) + aws-partitions (1.230.0) + aws-sdk-core (3.72.0) aws-eventstream (~> 1.0, >= 1.0.2) - aws-partitions (~> 1.0) + aws-partitions (~> 1, >= 1.228.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.24.0) - aws-sdk-core (~> 3, >= 3.61.1) + aws-sdk-kms (1.25.0) + aws-sdk-core (~> 3, >= 3.71.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.50.0) - aws-sdk-core (~> 3, >= 3.61.1) + aws-sdk-s3 (1.52.0) + aws-sdk-core (~> 3, >= 3.71.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) aws-sigv4 (1.1.0) @@ -220,7 +220,7 @@ GEM sprockets image_size (2.0.2) in_threads (1.5.3) - jaro_winkler (1.5.3) + jaro_winkler (1.5.4) jmespath (1.4.0) jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) @@ -244,7 +244,7 @@ GEM activesupport (>= 4.0) logstash-event (~> 1.2.0) request_store - loofah (2.3.0) + loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -256,7 +256,7 @@ GEM mini_magick (4.9.5) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.12.2) + minitest (5.13.0) msgpack (1.3.1) multi_json (1.14.1) multi_xml (0.6.0) @@ -371,7 +371,7 @@ GEM rinku (2.0.6) rotp (5.1.0) addressable (~> 2.5) - rubocop (0.75.1) + rubocop (0.76.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) @@ -412,14 +412,14 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - strong_migrations (0.4.1) + strong_migrations (0.4.2) activerecord (>= 5) term-ansicolor (1.7.1) tins (~> 1.0) thor (0.20.3) thread_safe (0.3.6) tilt (2.0.10) - tins (1.21.1) + tins (1.22.0) tzinfo (1.2.5) thread_safe (~> 0.1) uglifier (4.2.0) diff --git a/INSTALL.md b/INSTALL.md index 4c2c7c6c8..e414a12e4 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -21,7 +21,7 @@ of packages required before you can get the various gems installed. * Ruby 2.5+ * PostgreSQL 9.1+ * ImageMagick -* Bundler +* Bundler (see note below about [developer Ruby setup](#rbenv)) * Javascript Runtime These can be installed on Ubuntu 18.04 or later with: @@ -71,6 +71,7 @@ For MacOSX, you will need XCode installed from the Mac App Store; OS X 10.7 (Lio Installing PostgreSQL: * Install Postgres.app from https://postgresapp.com/ +* Make sure that you've initialized and started Postgresql from the app (there should be a little elephant icon in your systray). * Add PostgreSQL to your path, by editing your profile: `nano ~/.profile` @@ -79,14 +80,37 @@ and adding: `export PATH=/Applications/Postgres.app/Contents/MacOS/bin:$PATH` +After this, you may need to start a new shell window, or source the profile again by running `. ~/.profile`. + Installing other dependencies: * Install Homebrew from https://brew.sh/ * Install the latest version of Ruby: `brew install ruby` * Install ImageMagick: `brew install imagemagick` -* Install libxml2: `brew install libxml2 --with-xml2-config` -* If you want to run the tests, you need `phantomjs` as well: `brew install phantomjs` -* Install Bundler: `gem install bundler` +* Install libxml2: `brew install libxml2` +* Install libgd: `brew install gd` +* Install Yarn: `brew install yarn` +* Install pngcrush: `brew install pngcrush` +* Install optipng: `brew install optipng` +* Install pngquant: `brew install pngquant` +* Install jhead: `brew install jhead` +* Install jpegoptim: `brew install jpegoptim` +* Install gifsicle: `brew install gifsicle` +* Install svgo: `brew install svgo` +* Install Bundler: `gem install bundler` (you might need to `sudo gem install bundler` if you get an error about permissions - or see note below about [developer Ruby setup](#rbenv)) + +You will need to tell `bundler` that `libxml2` is installed in a Homebrew location. If it uses the system-installed one then you will get errors installing the `libxml-ruby` gem later on. + +``` +bundle config build.libxml-ruby --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config +``` + +If you want to run the tests, you need `phantomjs` as well: + +``` +brew tap homebrew/cask +brew cask install phantomjs +``` Note that OS X does not have a /home directory by default, so if you are using the GPX functions, you will need to change the directories specified in config/application.yml. @@ -264,3 +288,27 @@ psql -d openstreetmap -c "CREATE FUNCTION maptile_for_point(int8, int8, int4) RE psql -d openstreetmap -c "CREATE FUNCTION tile_for_point(int4, int4) RETURNS int8 AS '`pwd`/db/functions/libpgosm', 'tile_for_point' LANGUAGE C STRICT" psql -d openstreetmap -c "CREATE FUNCTION xid_to_int4(xid) RETURNS int4 AS '`pwd`/db/functions/libpgosm', 'xid_to_int4' LANGUAGE C STRICT" ``` + +# Ruby development install and versions (optional) + +For simplicity, this document explains how to install all the website dependencies as "system" dependencies. While this is simpler, and usually faster, you might want more control over the process or the ability to install multiple different versions of software alongside eachother. For many developers, [`rbenv`](https://github.com/rbenv/rbenv) is the easiest way to manage multiple different Ruby versions on the same computer - with the added advantage that the installs are all in your home directory, so you don't need administrator permissions. + +If you choose to install Ruby and Bundler via `rbenv`, then you do not need to install the system libraries for Ruby: + +* For Ubuntu, you do not need to install the following packages: `ruby2.5 libruby2.5 ruby2.5-dev bundler`, +* For Fedora, you do not need to install the following packages: `ruby ruby-devel rubygem-rdoc rubygem-bundler rubygems` +* For MacOSX, you do not need to `brew install ruby` - but make sure you've installed a version of Ruby using `rbenv` before running `gem install bundler`! + +After installing a version of Ruby with `rbenv` (the latest stable version is a good place to start), you will need to make that the default. From inside the `openstreetmap-website` directory, run: + +``` +rbenv local $VERSION +``` + +Where `$VERSION` is the version you installed. Then install bundler: + +``` +gem install bundler +``` + +You should now be able to proceed with the rest of the installation. If you're on MacOSX, make sure you set up the [config override for the libxml2 location])(#macosx-bundle-config) _after_ installing bundler. diff --git a/app/controllers/diary_entries_controller.rb b/app/controllers/diary_entries_controller.rb index ba2a2976e..5f53e81b6 100644 --- a/app/controllers/diary_entries_controller.rb +++ b/app/controllers/diary_entries_controller.rb @@ -158,7 +158,7 @@ class DiaryEntriesController < ApplicationController @page = (params[:page] || 1).to_i @page_size = 20 - @entries = @entries.visible unless current_user&.administrator? + @entries = @entries.visible unless can? :unhide, DiaryEntry @entries = @entries.order("created_at DESC") @entries = @entries.offset((@page - 1) * @page_size) @entries = @entries.limit(@page_size) @@ -203,7 +203,7 @@ class DiaryEntriesController < ApplicationController @entry = @user.diary_entries.visible.where(:id => params[:id]).first if @entry @title = t "diary_entries.show.title", :user => params[:display_name], :title => @entry.title - @comments = current_user&.administrator? ? @entry.comments : @entry.visible_comments + @comments = can?(:unhidecomment, DiaryEntry) ? @entry.comments : @entry.visible_comments else @title = t "diary_entries.no_such_entry.title", :id => params[:id] render :action => "no_such_entry", :status => :not_found @@ -237,7 +237,7 @@ class DiaryEntriesController < ApplicationController def comments conditions = { :user_id => @user } - conditions[:visible] = true unless current_user&.administrator? + conditions[:visible] = true unless can? :unhidecomment, DiaryEntry @comment_pages, @comments = paginate(:diary_comments, :conditions => conditions, diff --git a/app/controllers/traces_controller.rb b/app/controllers/traces_controller.rb index 3497e92d5..a0852d2ce 100644 --- a/app/controllers/traces_controller.rb +++ b/app/controllers/traces_controller.rb @@ -65,19 +65,9 @@ class TracesController < ApplicationController @traces = @traces.limit(@page_size) @traces = @traces.includes(:user, :tags) - # put together SET of tags across traces, for related links - tagset = {} - @traces.each do |trace| - trace.tags.reload if params[:tag] # if searched by tag, ActiveRecord won't bring back other tags, so do explicitly here - trace.tags.each do |tag| - tagset[tag.tag] = tag.tag - end - end - # final helper vars for view @target_user = target_user @display_name = target_user.display_name if target_user - @all_tags = tagset.values end def mine diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 725000a13..c95cc4a75 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -40,7 +40,7 @@