From: Tom Hughes Date: Sun, 10 Jun 2018 16:02:12 +0000 (+0100) Subject: Merge branch 'master' into next X-Git-Tag: live~3053^2~6 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/d3700e6201b4b78a70bbb2941572edc985b63c2c?hp=-c Merge branch 'master' into next --- d3700e6201b4b78a70bbb2941572edc985b63c2c diff --combined .rubocop_todo.yml index 5846de44f,362cfcb32..da801d681 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@@ -33,9 -33,9 +33,9 @@@ Lint/AssignmentInCondition - 'app/controllers/application_controller.rb' - 'app/controllers/geocoder_controller.rb' - 'app/controllers/notes_controller.rb' - - 'app/controllers/trace_controller.rb' + - 'app/controllers/traces_controller.rb' - 'app/controllers/user_controller.rb' - - 'app/controllers/user_preference_controller.rb' + - 'app/controllers/user_preferences_controller.rb' - 'app/helpers/application_helper.rb' - 'app/helpers/browse_helper.rb' - 'app/models/client_application.rb' @@@ -67,7 -67,7 +67,7 @@@ Metrics/AbcSize # Offense count: 41 # Configuration parameters: CountComments, ExcludedMethods. Metrics/BlockLength: - Max: 250 - Max: 247 ++ Max: 257 # Offense count: 12 # Configuration parameters: CountBlocks. diff --combined Gemfile index a9a6cb4b6,7d59cceb1..ef14d06c5 --- a/Gemfile +++ b/Gemfile @@@ -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" @@@ -108,6 -105,8 +108,8 @@@ gem "logstasher # Gems useful for development group :development do gem "annotate" + gem "better_errors" + gem "binding_of_caller" gem "listen" gem "vendorer" end diff --combined Gemfile.lock index d1a9a0dd2,8634f8df8..49f9b5977 --- a/Gemfile.lock +++ b/Gemfile.lock @@@ -2,7 -2,6 +2,7 @@@ GE remote: https://rubygems.org/ specs: SystemTimer (1.2.3) + aasm (4.1.0) actioncable (5.1.5) actionpack (= 5.1.5) nio4r (~> 2.0) @@@ -44,17 -43,23 +44,23 @@@ tzinfo (~> 1.1) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) - annotate (2.7.2) + annotate (2.7.3) activerecord (>= 3.2, < 6.0) rake (>= 10.4, < 13.0) arel (8.0.0) ast (2.4.0) - autoprefixer-rails (8.2.0) + autoprefixer-rails (8.5.1) execjs + better_errors (2.4.0) + coderay (>= 1.0.0) + erubi (>= 1.0.0) + rack (>= 0.9.0) bigdecimal (1.1.0) + binding_of_caller (0.8.0) + debug_inspector (>= 0.0.1) builder (3.2.3) - canonical-rails (0.2.2) - rails (>= 4.1, < 5.2) + canonical-rails (0.2.3) + rails (>= 4.1, < 5.3) capybara (2.18.0) addressable mini_mime (>= 0.1.3) @@@ -64,6 -69,7 +70,7 @@@ xpath (>= 2.0, < 4.0) climate_control (0.2.0) cliver (0.3.2) + coderay (1.1.2) coffee-rails (4.2.2) coffee-script (>= 2.2.0) railties (>= 4.0.0) @@@ -82,17 -88,18 +89,18 @@@ tins (~> 1.6) crack (0.4.3) safe_yaml (~> 1.0.0) - crass (1.0.3) - dalli (2.7.6) + crass (1.0.4) + dalli (2.7.8) + debug_inspector (0.0.3) docile (1.1.5) dynamic_form (1.1.4) erubi (1.7.1) execjs (2.7.0) - exifr (1.3.3) - factory_bot (4.8.2) + exifr (1.3.4) + factory_bot (4.10.0) activesupport (>= 3.0.0) - factory_bot_rails (4.8.2) - factory_bot (~> 4.8.2) + factory_bot_rails (4.10.0) + factory_bot (~> 4.10.0) railties (>= 3.0.0) faraday (0.12.2) multipart-post (>= 1.2, < 3) @@@ -121,7 -128,7 +129,7 @@@ sprockets image_size (1.5.0) in_threads (1.5.0) - jquery-rails (4.3.1) + jquery-rails (4.3.3) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@@ -164,7 -171,7 +172,7 @@@ multi_json (1.13.1) multi_xml (0.6.0) multipart-post (2.0.0) - nio4r (2.3.0) + nio4r (2.3.1) nokogiri (1.8.2) mini_portile2 (~> 2.3.0) nokogumbo (1.5.0) @@@ -184,7 -191,7 +192,7 @@@ omniauth (1.8.1) hashie (>= 3.4.6, < 3.6.0) rack (>= 1.6.2, < 3) - omniauth-facebook (4.0.0) + omniauth-facebook (5.0.0) omniauth-oauth2 (~> 1.2) omniauth-github (1.3.0) omniauth (~> 1.5) @@@ -216,25 -223,25 +224,25 @@@ mimemagic (~> 0.3.0) terrapin (~> 0.6.0) parallel (1.12.1) - parser (2.5.0.5) + parser (2.5.1.0) ast (~> 2.4.0) pg (0.21.0) - poltergeist (1.17.0) - capybara (~> 2.1) + poltergeist (1.18.1) + capybara (>= 2.1, < 4) cliver (~> 0.3.1) websocket-driver (>= 0.2.0) powerpack (0.1.1) progress (3.4.0) psych (3.0.2) public_suffix (3.0.2) - puma (3.11.3) + puma (3.11.4) r2 (0.2.7) - rack (2.0.4) + rack (2.0.5) rack-cors (1.0.2) rack-openid (1.3.1) rack (>= 1.1.0) ruby-openid (>= 2.1.8) - rack-test (0.8.3) + rack-test (1.0.0) rack (>= 1.0, < 3) rack-uri_sanitizer (0.0.2) rails (5.1.5) @@@ -280,7 -287,7 +288,7 @@@ rack (>= 1.4) rinku (2.0.4) rotp (3.3.1) - rubocop (0.54.0) + rubocop (0.56.0) parallel (~> 1.10) parser (>= 2.5) powerpack (~> 0.1) @@@ -291,7 -298,7 +299,7 @@@ ruby-progressbar (1.9.0) ruby_dep (1.5.0) safe_yaml (1.0.4) - sanitize (4.6.4) + sanitize (4.6.5) crass (~> 1.0.2) nokogiri (>= 1.4.4) nokogumbo (~> 1.4) @@@ -306,8 -313,7 +314,7 @@@ sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - secure_headers (5.0.5) - useragent (>= 0.15.0) + secure_headers (6.0.0) simplecov (0.14.1) docile (~> 1.1.0) json (>= 1.8, < 3) @@@ -333,21 -339,20 +340,20 @@@ tins (1.16.3) tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (4.1.8) + uglifier (4.1.10) execjs (>= 0.3.0, < 3) - unicode-display_width (1.3.0) - useragent (0.16.10) + unicode-display_width (1.3.2) validates_email_format_of (1.6.3) i18n vendorer (0.1.16) - webmock (3.3.0) + webmock (3.4.1) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) - xpath (3.0.0) + xpath (3.1.0) nokogiri (~> 1.8) PLATFORMS @@@ -355,11 -360,12 +361,13 @@@ DEPENDENCIES SystemTimer (>= 1.1.3) + aasm actionpack-page_caching annotate autoprefixer-rails + better_errors bigdecimal (~> 1.1.0) + binding_of_caller canonical-rails capybara (~> 2.13) coffee-rails (~> 4.2) @@@ -417,4 -423,4 +425,4 @@@ webmock BUNDLED WITH - 1.15.4 + 1.16.2 diff --combined app/assets/stylesheets/common.scss index 50b38e7a3,cef2efbb2..f9214b24d --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@@ -1028,7 -1028,7 +1028,7 @@@ header .search_forms /* Rules for search sidebar */ - .search_results_entry { + #sidebar .search_results_entry { ul li { border-bottom: $keyline; cursor: pointer; @@@ -1036,12 -1036,9 +1036,9 @@@ &.selected { background: $list-highlight; } } - .search_details { - display: block; - float: right; - text-align: right; - margin-top: 0.2em; - margin-left: 0.5em; + .search_more .loader { + display: none; + width: 100%; } } @@@ -1131,6 -1128,11 +1128,11 @@@ tr.turn:hover .comments-0 { opacity: 0.5; } + + .changeset_more .loader { + display: none; + width: 100%; + } } /* Rules for the browse sidebar */ @@@ -1668,10 -1670,6 +1670,6 @@@ } } - .content-heading .hide_unless_logged_in { // hacky selector, better to just add a new class to this div - display: inline; - } - .pagination { padding-top: $lineheight; } @@@ -1891,14 -1889,14 +1889,14 @@@ display: none; } - .message-read .message-buttons { + .messages-show .message-buttons { margin-top: $lineheight; margin-bottom: $lineheight * 1.5; padding-top: $lineheight; border-top: 1px solid $lightgrey; } - .message-read .buttons .mark-unread-button { + .messages-show .buttons .mark-unread-button { border-radius: 0; } @@@ -2822,59 -2820,3 +2820,59 @@@ input.richtext_title[type="text"] display: none; } } + +.read-reports { + background: #eee; + opacity: 0.7; +} + +.report-related-block { + display:inline-block; +} + +.report-block { + width:475px; + float:left; + margin-right:100px; +} + +.related-reports { + width: 280px; + float: right; + + ul { + padding-left: $lineheight; + margin-bottom: 0; + + li { + list-style: disc; + } + } +} + +.issue-comments { + width:475px; +} + +.issues-list { + td:nth-child(2) { + white-space: nowrap; + } +} + +.report-disclaimer { + background: #fff1f0; + color: #d85030; + border-color: rgba(216, 80, 48, 0.3); + padding: 10px 20px; + margin-bottom: $lineheight; + + ul { + padding-left: $lineheight; + margin-bottom: 0; + + li { + list-style: disc; + } + } +} diff --combined app/models/user.rb index 2a0a5ab45,036f2fdc4..aaa00169f --- a/app/models/user.rb +++ b/app/models/user.rb @@@ -75,11 -75,6 +75,11 @@@ class User < ActiveRecord::Bas has_many :roles, :class_name => "UserRole" + has_many :issues, :class_name => "Issue", :foreign_key => :reported_user_id + has_many :issue_comments + + has_many :reports + scope :visible, -> { where(:status => %w[pending active confirmed]) } scope :active, -> { where(:status => %w[active confirmed]) } scope :identifiable, -> { where(:data_public => true) } @@@ -117,6 -112,7 +117,7 @@@ before_save :encrypt_password before_save :update_tile after_save :spam_check + after_save :reset_preferred_languages def to_param display_name @@@ -197,6 -193,10 +198,10 @@@ @preferred_languages ||= Locale.list(languages) end + def reset_preferred_languages + @preferred_languages = nil + end + def nearby(radius = NEARBY_RADIUS, num = NEARBY_USERS) if home_lon && home_lat gc = OSM::GreatCircle.new(home_lat, home_lon) diff --combined app/views/browse/note.html.erb index fa9e88628,37067c311..53ea0759e --- a/app/views/browse/note.html.erb +++ b/app/views/browse/note.html.erb @@@ -1,12 -1,12 +1,12 @@@ - <% set_title(t('browse.note.title', :id => @note.id)) %> + <% set_title(t('.title', :id => @note.id)) %>

- <%= t "browse.note.#{@note.status}_title", :note_name => @note.id %> + <%= t ".#{@note.status}_title", :note_name => @note.id %>

-

<%= t('browse.note.description') %>

+

<%= t('.description') %>

<%= h(@note_comments.first.body.to_html) %>
@@@ -23,10 -23,6 +23,10 @@@

<%= t "javascripts.notes.show.anonymous_warning" %>

<% end -%> + <% if current_user && current_user != @note.author %> +

<%= report_link(t(".report"), @note) %>

+ <% end %> + <% if @note_comments.length > 1 %>
    @@@ -44,8 -40,12 +44,12 @@@
    - - + <% if current_user and current_user.moderator? -%> + + <% end -%> + <% if current_user -%> + + <% end -%>
    @@@ -53,8 -53,12 +57,12 @@@
    - - + <% if current_user and current_user.moderator? -%> + + <% end -%> + <% if current_user -%> + + <% end -%>
    <% end %> diff --combined app/views/diary_entry/_diary_comment.html.erb index 8e17b0954,8565ecc67..4ac9a0f96 --- a/app/views/diary_entry/_diary_comment.html.erb +++ b/app/views/diary_entry/_diary_comment.html.erb @@@ -1,13 -1,10 +1,15 @@@
    <%= user_thumbnail diary_comment.user %> -

    <%= raw(t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), user_path(diary_comment.user)), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}"))) %> -

    <%= raw(t('.comment_from', :link_user => (link_to h(diary_comment.user.display_name), user_path(diary_comment.user)), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}"))) %>

    ++

    <%= raw(t('.comment_from', :link_user => (link_to h(diary_comment.user.display_name), user_path(diary_comment.user)), :comment_created_at => link_to(l(diary_comment.created_at, :format => :friendly), :anchor => "comment#{diary_comment.id}"))) %> + <% if current_user and diary_comment.user.id != current_user.id %> + | <%= report_link(t(".report"), diary_comment) %> + <% end %> +

    +
    <%= diary_comment.body.to_html %>
    - <%= if_administrator(:span) do %> - <%= link_to t('diary_entry.diary_comment.hide_link'), hide_diary_comment_path(:display_name => diary_comment.diary_entry.user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id), :method => :post, :data=> { :confirm => t('diary_entry.diary_comment.confirm') } %> + <% if current_user && current_user.administrator? %> + + <%= link_to t('.hide_link'), hide_diary_comment_path(:display_name => diary_comment.diary_entry.user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id), :method => :post, :data=> { :confirm => t('.confirm') } %> + <% end %>
    diff --combined app/views/diary_entry/_diary_entry.html.erb index ce311c168,848221a28..930f20e5e --- a/app/views/diary_entry/_diary_entry.html.erb +++ b/app/views/diary_entry/_diary_entry.html.erb @@@ -1,13 -1,13 +1,13 @@@
    - <% if !@this_user %> + <% if !@user %> <%= user_thumbnail diary_entry.user %> <% end %>

    <%= link_to h(diary_entry.title), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id %>

    - <%= raw(t 'diary_entry.diary_entry.posted_by', :link_user => (link_to h(diary_entry.user.display_name), user_path(diary_entry.user)), :created => l(diary_entry.created_at, :format => :blog), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entry', :action => 'list', :display_name => nil, :language => diary_entry.language_code)) %> + <%= raw(t '.posted_by', :link_user => (link_to h(diary_entry.user.display_name), user_path(diary_entry.user)), :created => l(diary_entry.created_at, :format => :blog), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entry', :action => 'list', :display_name => nil, :language => diary_entry.language_code)) %>
    @@@ -22,23 -22,17 +22,25 @@@
      <% if params[:action] == 'list' %> -
    • <%= link_to t('diary_entry.diary_entry.comment_link'), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'newcomment' %>
    • -
    • <%= link_to t('diary_entry.diary_entry.reply_link'), :controller => 'message', :action => 'new', :display_name => diary_entry.user.display_name, :title => "Re: #{diary_entry.title}" %>
    • -
    • <%= link_to t('diary_entry.diary_entry.comment_count', :count => diary_entry.visible_comments.count), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'comments' %>
    • +
    • <%= link_to t('.comment_link'), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'newcomment' %>
    • +
    • <%= link_to t('.reply_link'), new_message_path(diary_entry.user, :message => { :title => "Re: #{diary_entry.title}" }) %>
    • +
    • <%= link_to t('.comment_count', :count => diary_entry.visible_comments.count), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'comments' %>
    • <% end %> - <%= if_user(diary_entry.user, :li) do %> - <%= link_to t('diary_entry.diary_entry.edit_link'), :action => 'edit', :display_name => diary_entry.user.display_name, :id => diary_entry.id %> + <% if current_user && current_user == diary_entry.user %> +
    • <%= link_to t('.edit_link'), :action => 'edit', :display_name => diary_entry.user.display_name, :id => diary_entry.id %>
    • <% end %> + <% if current_user and diary_entry.user != current_user %> +
    • + <%= report_link(t(".report"), diary_entry) %> +
    • + <% end %> + - <%= if_administrator(:li) do %> - <%= link_to t('diary_entry.diary_entry.hide_link'), hide_diary_entry_path(:display_name => diary_entry.user.display_name, :id => diary_entry.id), :method => :post, :data => { :confirm => t('diary_entry.diary_entry.confirm') } %> + <% if current_user && current_user.administrator? %> -
    • <%= link_to t('.hide_link'), hide_diary_entry_path(:display_name => diary_entry.user.display_name, :id => diary_entry.id), :method => :post, :data => { :confirm => t('.confirm') } %>
    • ++
    • ++ <%= link_to t('.hide_link'), hide_diary_entry_path(:display_name => diary_entry.user.display_name, :id => diary_entry.id), :method => :post, :data => { :confirm => t('.confirm') } %> ++
    • <% end %>
    diff --combined app/views/layouts/_header.html.erb index d8e5443b1,8411fefdb..c9107e7a8 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@@ -38,9 -38,6 +38,9 @@@