From: Andy Allan Date: Wed, 2 Aug 2017 11:12:57 +0000 (+0100) Subject: Merge branch 'master' into moderation X-Git-Tag: live~3010^2~109 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/e31376e28da8f656e33508cc899da465b63673c5?hp=-c Merge branch 'master' into moderation --- e31376e28da8f656e33508cc899da465b63673c5 diff --combined Gemfile index 0fd68e4e2,48658f65d..262a11d03 --- a/Gemfile +++ b/Gemfile @@@ -1,7 -1,7 +1,7 @@@ source "https://rubygems.org" # Require rails - gem "rails", "5.0.4" + gem "rails", "5.0.5" # Require things which have moved to gems in ruby 1.9 gem "bigdecimal", "~> 1.1.0", :platforms => :ruby_19 @@@ -70,9 -70,6 +70,9 @@@ gem "omniauth-windowslive # Markdown formatting support gem "redcarpet" +# For status transitions of Issues +gem "aasm" + # Load libxml support for XML parsing and generation gem "libxml-ruby", ">= 2.0.5", :require => "libxml" diff --combined Gemfile.lock index f25e2e7f0,f73d4a5d8..0dcd5bd24 --- a/Gemfile.lock +++ b/Gemfile.lock @@@ -2,42 -2,41 +2,42 @@@ GE remote: https://rubygems.org/ specs: SystemTimer (1.2.3) + aasm (4.1.0) - actioncable (5.0.4) - actionpack (= 5.0.4) + actioncable (5.0.5) + actionpack (= 5.0.5) nio4r (>= 1.2, < 3.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.4) - actionpack (= 5.0.4) - actionview (= 5.0.4) - activejob (= 5.0.4) + actionmailer (5.0.5) + actionpack (= 5.0.5) + actionview (= 5.0.5) + activejob (= 5.0.5) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.4) - actionview (= 5.0.4) - activesupport (= 5.0.4) + actionpack (5.0.5) + actionview (= 5.0.5) + activesupport (= 5.0.5) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) actionpack-page_caching (1.1.0) actionpack (>= 4.0.0, < 6) - actionview (5.0.4) - activesupport (= 5.0.4) + actionview (5.0.5) + activesupport (= 5.0.5) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.0.4) - activesupport (= 5.0.4) + activejob (5.0.5) + activesupport (= 5.0.5) globalid (>= 0.3.6) - activemodel (5.0.4) - activesupport (= 5.0.4) - activerecord (5.0.4) - activemodel (= 5.0.4) - activesupport (= 5.0.4) + activemodel (5.0.5) + activesupport (= 5.0.5) + activerecord (5.0.5) + activemodel (= 5.0.5) + activesupport (= 5.0.5) arel (~> 7.0) - activesupport (5.0.4) + activesupport (5.0.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@@ -46,13 -45,13 +46,13 @@@ public_suffix (~> 2.0, >= 2.0.2) arel (7.1.4) ast (2.3.0) - autoprefixer-rails (7.1.1.2) + autoprefixer-rails (7.1.2.3) execjs bigdecimal (1.1.0) builder (3.2.3) - canonical-rails (0.2.0) + canonical-rails (0.2.1) rails (>= 4.1, < 5.2) - capybara (2.14.3) + capybara (2.14.4) addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) @@@ -88,13 -87,13 +88,13 @@@ dynamic_form (1.1.4) erubis (2.7.0) execjs (2.7.0) - exifr (1.2.5) + exifr (1.3.1) factory_girl (4.8.0) activesupport (>= 3.0.0) factory_girl_rails (4.8.0) factory_girl (~> 4.8.0) railties (>= 3.0.0) - faraday (0.12.1) + faraday (0.12.2) multipart-post (>= 1.2, < 3) ffi (1.9.18) fspath (3.1.0) @@@ -102,20 -101,20 +102,20 @@@ globalid (0.4.0) activesupport (>= 4.2.0) hashdiff (0.3.4) - hashie (3.5.5) + hashie (3.5.6) htmlentities (4.3.4) http_accept_language (2.0.5) - i18n (0.8.4) + i18n (0.8.6) i18n-js (3.0.0) i18n (~> 0.6, >= 0.6.6) - image_optim (0.24.3) + image_optim (0.25.0) exifr (~> 1.2, >= 1.2.2) fspath (~> 3.0) image_size (~> 1.5) in_threads (~> 1.3) progress (~> 3.0, >= 3.0.1) - image_optim_rails (0.4.0) - image_optim (~> 0.24.0) + image_optim_rails (0.4.1) + image_optim (~> 0.24) rails sprockets image_size (1.5.0) @@@ -157,7 -156,7 +157,7 @@@ mime-types-data (3.2016.0521) mimemagic (0.3.0) mini_portile2 (2.2.0) - minitest (5.10.2) + minitest (5.10.3) multi_json (1.12.1) multi_xml (0.6.0) multipart-post (2.0.0) @@@ -186,7 -185,7 +186,7 @@@ omniauth-github (1.3.0) omniauth (~> 1.5) omniauth-oauth2 (>= 1.4.0, < 2.0) - omniauth-google-oauth2 (0.5.0) + omniauth-google-oauth2 (0.5.2) jwt (~> 1.5) multi_json (~> 1.3) omniauth (>= 1.1.1) @@@ -212,7 -211,7 +212,7 @@@ cocaine (~> 0.5.5) mime-types mimemagic (= 0.3.0) - parallel (1.11.2) + parallel (1.12.0) parser (2.4.0.0) ast (~> 2.2) pg (0.21.0) @@@ -224,26 -223,26 +224,26 @@@ progress (3.3.1) psych (2.2.4) public_suffix (2.0.5) - r2 (0.2.6) + r2 (0.2.7) rack (2.0.3) - rack-cors (0.4.1) + rack-cors (1.0.1) rack-openid (1.3.1) rack (>= 1.1.0) ruby-openid (>= 2.1.8) rack-test (0.6.3) rack (>= 1.0) rack-uri_sanitizer (0.0.2) - rails (5.0.4) - actioncable (= 5.0.4) - actionmailer (= 5.0.4) - actionpack (= 5.0.4) - actionview (= 5.0.4) - activejob (= 5.0.4) - activemodel (= 5.0.4) - activerecord (= 5.0.4) - activesupport (= 5.0.4) - bundler (>= 1.3.0, < 2.0) - railties (= 5.0.4) + rails (5.0.5) + actioncable (= 5.0.5) + actionmailer (= 5.0.5) + actionpack (= 5.0.5) + actionview (= 5.0.5) + activejob (= 5.0.5) + activemodel (= 5.0.5) + activerecord (= 5.0.5) + activesupport (= 5.0.5) + bundler (>= 1.3.0) + railties (= 5.0.5) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.2) actionpack (~> 5.x, >= 5.0.1) @@@ -257,16 -256,16 +257,16 @@@ rails-i18n (4.0.2) i18n (~> 0.6) rails (>= 4.0) - railties (5.0.4) - actionpack (= 5.0.4) - activesupport (= 5.0.4) + railties (5.0.5) + actionpack (= 5.0.5) + activesupport (= 5.0.5) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.2.2) rake rake (12.0.0) - rb-fsevent (0.9.8) + rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) record_tag_helper (1.0.0) @@@ -291,14 -290,18 +291,18 @@@ crass (~> 1.0.2) nokogiri (>= 1.4.4) nokogumbo (~> 1.4.1) - sass (3.4.24) + sass (3.5.1) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - secure_headers (3.6.5) + secure_headers (3.6.7) useragent simplecov (0.14.1) docile (~> 1.1.0) @@@ -319,8 -322,8 +323,8 @@@ ref thor (0.19.4) thread_safe (0.3.6) - tilt (2.0.7) - tins (1.14.0) + tilt (2.0.8) + tins (1.15.0) tzinfo (1.2.3) thread_safe (~> 0.1) uglifier (3.2.0) @@@ -345,7 -348,6 +349,7 @@@ PLATFORM DEPENDENCIES SystemTimer (>= 1.1.3) + aasm actionpack-page_caching autoprefixer-rails bigdecimal (~> 1.1.0) @@@ -387,7 -389,7 +391,7 @@@ r2 rack-cors rack-uri_sanitizer - rails (= 5.0.4) + rails (= 5.0.5) rails-controller-testing rails-i18n (~> 4.0.0) record_tag_helper diff --combined app/controllers/diary_entry_controller.rb index 89107ab1a,b3518872c..1b57fa59b --- a/app/controllers/diary_entry_controller.rb +++ b/app/controllers/diary_entry_controller.rb @@@ -14,27 -14,27 +14,27 @@@ class DiaryEntryController < Applicatio if request.post? @diary_entry = DiaryEntry.new(entry_params) - @diary_entry.user = @user + @diary_entry.user = current_user if @diary_entry.save - default_lang = @user.preferences.where(:k => "diary.default_language").first + default_lang = current_user.preferences.where(:k => "diary.default_language").first if default_lang default_lang.v = @diary_entry.language_code default_lang.save! else - @user.preferences.create(:k => "diary.default_language", :v => @diary_entry.language_code) + current_user.preferences.create(:k => "diary.default_language", :v => @diary_entry.language_code) end # Subscribe user to diary comments - @diary_entry.subscriptions.create(:user => @user) + @diary_entry.subscriptions.create(:user => current_user) - redirect_to :action => "list", :display_name => @user.display_name + redirect_to :action => "list", :display_name => current_user.display_name else render :action => "edit" end else - default_lang = @user.preferences.where(:k => "diary.default_language").first - lang_code = default_lang ? default_lang.v : @user.preferred_language + default_lang = current_user.preferences.where(:k => "diary.default_language").first + lang_code = default_lang ? default_lang.v : current_user.preferred_language @diary_entry = DiaryEntry.new(entry_params.merge(:language_code => lang_code)) set_map_location render :action => "edit" @@@ -45,7 -45,7 +45,7 @@@ @title = t "diary_entry.edit.title" @diary_entry = DiaryEntry.find(params[:id]) - if @user != @diary_entry.user + if current_user != @diary_entry.user redirect_to :action => "view", :id => params[:id] elsif params[:diary_entry] && @diary_entry.update_attributes(entry_params) redirect_to :action => "view", :id => params[:id] @@@ -59,18 -59,18 +59,18 @@@ def comment @entry = DiaryEntry.find(params[:id]) @diary_comment = @entry.comments.build(comment_params) - @diary_comment.user = @user + @diary_comment.user = current_user if @diary_comment.save # Notify current subscribers of the new comment @entry.subscribers.visible.each do |user| - if @user != user + if current_user != user Notifier.diary_comment_notification(@diary_comment, user).deliver_now end end # Add the commenter to the subscribers if necessary - @entry.subscriptions.create(:user => @user) unless @entry.subscribers.exists?(@user.id) + @entry.subscriptions.create(:user => current_user) unless @entry.subscribers.exists?(current_user.id) redirect_to :action => "view", :display_name => @entry.user.display_name, :id => @entry.id else @@@ -83,7 -83,7 +83,7 @@@ def subscribe diary_entry = DiaryEntry.find(params[:id]) - diary_entry.subscriptions.create(:user => @user) unless diary_entry.subscribers.exists?(@user.id) + diary_entry.subscriptions.create(:user => current_user) unless diary_entry.subscribers.exists?(current_user.id) redirect_to :action => "view", :display_name => diary_entry.user.display_name, :id => diary_entry.id rescue ActiveRecord::RecordNotFound @@@ -93,7 -93,7 +93,7 @@@ def unsubscribe diary_entry = DiaryEntry.find(params[:id]) - diary_entry.subscriptions.where(:user => @user).delete_all if diary_entry.subscribers.exists?(@user.id) + diary_entry.subscriptions.where(:user => current_user).delete_all if diary_entry.subscribers.exists?(current_user.id) redirect_to :action => "view", :display_name => diary_entry.user.display_name, :id => diary_entry.id rescue ActiveRecord::RecordNotFound @@@ -112,17 -112,17 +112,17 @@@ return end elsif params[:friends] - if @user + if current_user @title = t "diary_entry.list.title_friends" - @entries = DiaryEntry.where(:user_id => @user.friend_users) + @entries = DiaryEntry.where(:user_id => current_user.friend_users) else require_user return end elsif params[:nearby] - if @user + if current_user @title = t "diary_entry.list.title_nearby" - @entries = DiaryEntry.where(:user_id => @user.nearby) + @entries = DiaryEntry.where(:user_id => current_user.nearby) else require_user return @@@ -185,9 -185,6 +185,9 @@@ @entry = @this_user.diary_entries.visible.where(:id => params[:id]).first if @entry @title = t "diary_entry.view.title", :user => params[:display_name], :title => @entry.title + if params[:comment_id] + @reported_comment = DiaryComment.where(:id => params[:comment_id]) + end else @title = t "diary_entry.no_such_entry.title", :id => params[:id] render :action => "no_such_entry", :status => :not_found @@@ -237,7 -234,7 +237,7 @@@ # require that the user is a administrator, or fill out a helpful error message # and return them to the user page. def require_administrator - unless @user.administrator? + unless current_user.administrator? flash[:error] = t("user.filter.not_an_administrator") redirect_to :action => "view" end @@@ -250,13 -247,13 +250,13 @@@ @lon = @diary_entry.longitude @lat = @diary_entry.latitude @zoom = 12 - elsif @user.home_lat.nil? || @user.home_lon.nil? + elsif current_user.home_lat.nil? || current_user.home_lon.nil? @lon = params[:lon] || -0.1 @lat = params[:lat] || 51.5 @zoom = params[:zoom] || 4 else - @lon = @user.home_lon - @lat = @user.home_lat + @lon = current_user.home_lon + @lat = current_user.home_lat @zoom = 12 end end diff --combined app/views/browse/changeset.html.erb index 46d68c5d2,86d190680..be0086863 --- a/app/views/browse/changeset.html.erb +++ b/app/views/browse/changeset.html.erb @@@ -3,11 -3,6 +3,11 @@@

<%= t('browse.changeset.title', :id => @changeset.id) %> + <% if @user and @user.id != @changeset.user.id %> + <%= link_to new_issue_url(reportable_id: @changeset.id, reportable_type: @changeset.class.name, referer: request.fullpath), :title => t('browse.changeset.report') do %> +  ⚐ + <% end %> + <% end %>

@@@ -20,7 -15,7 +20,7 @@@