From: Tom Hughes Date: Wed, 6 Jun 2018 13:51:30 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/1892' X-Git-Tag: live~2963 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/ba9a00b10cc8a075a5a4090a1601e3d3b72b2ec1?hp=57d3b3af55a0bb37eb964aa75a9f1549df9a771c Merge remote-tracking branch 'upstream/pull/1892' --- diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2f6ea0087..362cfcb32 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -67,7 +67,7 @@ Metrics/AbcSize: # Offense count: 41 # Configuration parameters: CountComments, ExcludedMethods. Metrics/BlockLength: - Max: 241 + Max: 247 # Offense count: 12 # Configuration parameters: CountBlocks. diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index eb7cbf845..cef2efbb2 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -1889,14 +1889,14 @@ tr.turn:hover { 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; } diff --git a/app/controllers/diary_entry_controller.rb b/app/controllers/diary_entry_controller.rb index c0b974c5e..f2c11fc74 100644 --- a/app/controllers/diary_entry_controller.rb +++ b/app/controllers/diary_entry_controller.rb @@ -155,8 +155,8 @@ class DiaryEntryController < ApplicationController if user @entries = user.diary_entries - @title = I18n.t("diary_entry.feed.user.title", :user => user.display_name) - @description = I18n.t("diary_entry.feed.user.description", :user => user.display_name) + @title = t("diary_entry.feed.user.title", :user => user.display_name) + @description = t("diary_entry.feed.user.description", :user => user.display_name) @link = url_for :controller => "diary_entry", :action => "list", :display_name => user.display_name, :host => SERVER_URL, :protocol => SERVER_PROTOCOL else head :not_found @@ -167,12 +167,12 @@ class DiaryEntryController < ApplicationController if params[:language] @entries = @entries.where(:language_code => params[:language]) - @title = I18n.t("diary_entry.feed.language.title", :language_name => Language.find(params[:language]).english_name) - @description = I18n.t("diary_entry.feed.language.description", :language_name => Language.find(params[:language]).english_name) + @title = t("diary_entry.feed.language.title", :language_name => Language.find(params[:language]).english_name) + @description = t("diary_entry.feed.language.description", :language_name => Language.find(params[:language]).english_name) @link = url_for :controller => "diary_entry", :action => "list", :language => params[:language], :host => SERVER_URL, :protocol => SERVER_PROTOCOL else - @title = I18n.t("diary_entry.feed.all.title") - @description = I18n.t("diary_entry.feed.all.description") + @title = t("diary_entry.feed.all.title") + @description = t("diary_entry.feed.all.description") @link = url_for :controller => "diary_entry", :action => "list", :host => SERVER_URL, :protocol => SERVER_PROTOCOL end end diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 99884295b..d14605692 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -26,7 +26,7 @@ class MessagesController < ApplicationController if @message.save flash[:notice] = t ".message_sent" Notifier.message_notification(@message).deliver_now - redirect_to :action => "inbox", :display_name => current_user.display_name + redirect_to :action => :inbox end end end @@ -56,14 +56,14 @@ class MessagesController < ApplicationController redirect_to :controller => "user", :action => "login", :referer => request.fullpath end rescue ActiveRecord::RecordNotFound - @title = t "message.no_such_message.title" + @title = t "messages.no_such_message.title" render :action => "no_such_message", :status => :not_found end # Show a message def show @title = t ".title" - @message = Message.find(params[:message_id]) + @message = Message.find(params[:id]) if @message.recipient == current_user || @message.sender == current_user @message.message_read = true if @message.recipient == current_user @@ -73,26 +73,18 @@ class MessagesController < ApplicationController redirect_to :controller => "user", :action => "login", :referer => request.fullpath end rescue ActiveRecord::RecordNotFound - @title = t "message.no_such_message.title" + @title = t "messages.no_such_message.title" render :action => "no_such_message", :status => :not_found end # Display the list of messages that have been sent to the user. def inbox @title = t ".title" - if current_user && params[:display_name] == current_user.display_name - else - redirect_to :action => "inbox", :display_name => current_user.display_name - end end # Display the list of messages that the user has sent to other users. def outbox @title = t ".title" - if current_user && params[:display_name] == current_user.display_name - else - redirect_to :action => "outbox", :display_name => current_user.display_name - end end # Set the message as being read or unread. @@ -108,10 +100,10 @@ class MessagesController < ApplicationController @message.message_read = message_read if @message.save && !request.xhr? flash[:notice] = notice - redirect_to :action => "inbox", :display_name => current_user.display_name + redirect_to :action => :inbox end rescue ActiveRecord::RecordNotFound - @title = t "message.no_such_message.title" + @title = t "messages.no_such_message.title" render :action => "no_such_message", :status => :not_found end @@ -126,11 +118,11 @@ class MessagesController < ApplicationController if params[:referer] redirect_to params[:referer] else - redirect_to :action => "inbox", :display_name => current_user.display_name + redirect_to :action => :inbox end end rescue ActiveRecord::RecordNotFound - @title = t "message.no_such_message.title" + @title = t "messages.no_such_message.title" render :action => "no_such_message", :status => :not_found end diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index d21092881..6cbe302d6 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -120,7 +120,7 @@ class SiteController < ApplicationController append_content_security_policy_directives( :connect_src => %w[*], :img_src => %w[* blob:], - :script_src => %w[dev.virtualearth.net *.wikipedia.org www.wikidata.org 'unsafe-eval'], + :script_src => %w[dev.virtualearth.net *.wikipedia.org www.wikidata.org services.arcgisonline.com serviceslab.arcgisonline.com 'unsafe-eval'], :style_src => %w['unsafe-inline'] ) diff --git a/app/views/browse/not_found.html.erb b/app/views/browse/not_found.html.erb index 5fe22a68a..3c4e8a4c8 100644 --- a/app/views/browse/not_found.html.erb +++ b/app/views/browse/not_found.html.erb @@ -1,12 +1,4 @@ -<% - browse_not_found_type = { - 'node' => I18n.t('.type.node'), - 'way' => I18n.t('.type.way'), - 'relation' => I18n.t('.type.relation'), - 'changeset' => I18n.t('.type.changeset'), - }; -%> -

- - <%= t '.sorry', :type=> browse_not_found_type[@type] , :id => params[:id] %>

+ + <%= t ".sorry", :type => t(".type.#{@type}"), :id => params[:id] %> + diff --git a/app/views/browse/timeout.html.erb b/app/views/browse/timeout.html.erb index de102e60f..e6dd7b68d 100644 --- a/app/views/browse/timeout.html.erb +++ b/app/views/browse/timeout.html.erb @@ -1,12 +1,4 @@ -<% - browse_timeout_type = { - 'node' => I18n.t('.type.node'), - 'way' => I18n.t('.type.way'), - 'relation' => I18n.t('.type.relation'), - 'changeset' => I18n.t('.type.changeset'), - }; -%>
- <%= t '.sorry', :type=> browse_timeout_type[@type] , :id => params[:id] %> + <%= t '.sorry', :type => t(".type.#{@type}"), :id => params[:id] %>
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index a5ab460ce..8411fefdb 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -64,7 +64,7 @@