Merge remote-tracking branch 'upstream/pull/5403'

This commit is contained in:
Tom Hughes 2025-02-10 18:54:14 +00:00
commit 2cfc030bba
7 changed files with 51 additions and 27 deletions

View file

@ -259,12 +259,7 @@ class ApplicationController < ActionController::Base
request.content_security_policy = policy
case Settings.status
when "database_offline", "api_offline"
flash.now[:warning] = t("layouts.osm_offline")
when "database_readonly", "api_readonly"
flash.now[:warning] = t("layouts.osm_read_only")
end
flash.now[:warning] = { :partial => "layouts/offline_flash" } unless api_status == "online"
request.xhr? ? "xhr" : "map"
end

View file

@ -107,6 +107,14 @@ class SiteController < ApplicationController
rescue ActiveRecord::RecordNotFound
# don't try and derive a location from a missing/deleted object
end
if api_status != "online"
flash.now[:warning] = { :partial => "layouts/offline_flash" }
elsif current_user && !current_user.data_public?
flash.now[:warning] = { :partial => "not_public_flash" }
else
@enable_editor = true
end
end
def copyright
@ -129,11 +137,7 @@ class SiteController < ApplicationController
def export; end
def offline
flash.now[:warning] = if Settings.status == "database_offline"
t("layouts.osm_offline")
else
t("layouts.osm_read_only")
end
flash.now[:warning] = { :partial => "layouts/offline_flash" }
render :html => nil, :layout => true
end

View file

@ -0,0 +1,26 @@
<div class="d-flex flex-column gap-2">
<% if %w[database_offline api_offline].include? Settings.status %>
<p class="mb-0">
<%= t(".osm_offline") %>
</p>
<% elsif %w[database_readonly api_readonly].include? Settings.status %>
<p class="mb-0">
<%= t(".osm_read_only") %>
</p>
<% end %>
<% if Settings.status_expected_restore_date %>
<% expected_restore_time = Time.parse(Settings.status_expected_restore_date).utc %>
<% if expected_restore_time > Time.now.utc %>
<p class="mb-0">
<%= t ".expected_restore_html", :time => friendly_date(expected_restore_time) %>
</p>
<% end %>
<% end %>
<% if Settings.status_announcement_url %>
<p class="mb-0">
<%= link_to t(".announcement"), Settings.status_announcement_url %>
</p>
<% end %>
</div>

View file

@ -0,0 +1,3 @@
<p><%= t ".not_public" %></p>
<p><%= t ".not_public_description_html", :user_page => (link_to t(".user_page_link"), edit_account_path(:anchor => "public")) %></p>
<p><%= t ".anon_edits_html", :link => link_to(t(".anon_edits_link_text"), t(".anon_edits_link")) %></p>

View file

@ -1,17 +1,5 @@
<% content_for :content do %>
<% if Settings.status == "database_offline" or Settings.status == "api_offline" %>
<div class="alert alert-warning text-center">
<p class="my-2"><%= t "layouts.osm_offline" %></p>
</div>
<% elsif Settings.status == "database_readonly" or Settings.status == "api_readonly" %>
<div class="alert alert-warning text-center">
<p class="my-2"><%= t "layouts.osm_read_only" %></p>
</div>
<% elsif !current_user.data_public? %>
<p><%= t ".not_public" %></p>
<p><%= t ".not_public_description_html", :user_page => (link_to t(".user_page_link"), edit_account_path(:anchor => "public")) %></p>
<p><%= t ".anon_edits_html", :link => link_to(t(".anon_edits_link_text"), t(".anon_edits_link")) %></p>
<% else %>
<% if @enable_editor %>
<%= render :partial => preferred_editor %>
<% end %>
<% end %>

View file

@ -1624,8 +1624,6 @@ en:
partners_corpmembers: "OSMF corporate members"
partners_partners: "partners"
tou: "Terms of Use"
osm_offline: "The OpenStreetMap database is currently offline while essential database maintenance work is carried out."
osm_read_only: "The OpenStreetMap database is currently in read-only mode while essential database maintenance work is carried out."
nothing_to_preview: "Nothing to preview."
help: Help
about: About
@ -1633,6 +1631,11 @@ en:
communities: Communities
learn_more: "Learn More"
more: More
offline_flash:
osm_offline: "The OpenStreetMap database is currently offline while essential maintenance work is carried out."
osm_read_only: "The OpenStreetMap database is currently in read-only mode while essential maintenance work is carried out."
expected_restore_html: "Services are expected to be restored in %{time}."
announcement: "You can read the announcement here."
user_mailer:
diary_comment_notification:
description: "OpenStreetMap Diary Entry #%{id}"
@ -2249,13 +2252,14 @@ en:
license_url: "https://openstreetmap.org/copyright"
project_url: "https://openstreetmap.org"
remote_failed: "Editing failed - make sure JOSM or Merkaartor is loaded and the remote control option is enabled"
edit:
not_public_flash:
not_public: "You have not set your edits to be public."
not_public_description_html: "You can no longer edit the map unless you do so. You can set your edits as public from your %{user_page}."
user_page_link: user page
anon_edits_html: "(%{link})"
anon_edits_link: "https://wiki.openstreetmap.org/wiki/Disabling_anonymous_edits"
anon_edits_link_text: "Find out why this is the case."
edit:
id_not_configured: "iD has not been configured"
export:
title: "Export"

View file

@ -23,6 +23,10 @@ api_version: "0.6"
# database_offline - database offline with site in emergency mode
# gpx_offline - gpx storage offline
status: "online"
# Expected services restoration date added to offline flash messages
#status_expected_restore_date: "2024-12-18 12:00:00Z"
# Application status announcement url added to offline flash messages
#status_announcement_url: "https://en.osm.town/@osm_tech"
# The maximum area you're allowed to request, in square degrees
max_request_area: 0.25
# Number of GPS trace/trackpoints returned per-page