<li><%= rss_link_to :action => "rss", :language => params[:language] %></li>
<% end -%>
- <% if @user %>
- <% if @user == current_user %>
- <li><%= link_to image_tag("new.png", :class => "small_icon") + t(".new"), new_diary_entry_path, :title => t(".new_title") %></li>
- <% end %>
- <% else %>
- <% if current_user %>
- <li><%= link_to image_tag("new.png", :class => "small_icon") + t(".new"), new_diary_entry_path, :title => t(".new_title") %></li>
- <% end %>
+ <% if @user && @user == current_user || !@user && current_user %>
+ <li><%= link_to image_tag("new.png", :class => "small_icon") + t(".new"), new_diary_entry_path, :title => t(".new_title") %></li>
+ <% end %>
+
+ <% if !@user && current_user %>
+ <li><%= link_to t(".my_diary"), :controller => "diary_entries", :action => "index", :display_name => current_user.display_name %></li>
<% end %>
</ul>
</div>
module OpenStreetMap
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
- config.load_defaults 5.2
+ config.load_defaults 6.0
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W[#{config.root}/lib]
+ # Continue to use the classic autoloader for now
+ config.autoloader = :classic
+
+ # Force requests from old versions of IE (<= IE8) to be UTF-8 encoded.
+ # This has defaulted to false since rails 6.0
+ config.action_view.default_enforce_utf8 = true
+
# This defaults to true from rails 5.0 but our code doesn't comply
# with it at all so we turn it off
config.active_record.belongs_to_required_by_default = false unless Settings.status == "database_offline"
+++ /dev/null
-# Be sure to restart your server when you modify this file.
-#
-# This file contains migration options to ease your Rails 5.2 upgrade.
-#
-# Once upgraded flip defaults one by one to migrate to the new default.
-#
-# Read the Guide for Upgrading Ruby on Rails for more info on each option.
-
-# Make Active Record use stable #cache_key alongside new #cache_version method.
-# This is needed for recyclable cache keys.
-# Rails.application.config.active_record.cache_versioning = true
-
-# Use AES-256-GCM authenticated encryption for encrypted cookies.
-# Also, embed cookie expiry in signed or encrypted cookies for increased security.
-#
-# This option is not backwards compatible with earlier Rails versions.
-# It's best enabled when your entire app is migrated and stable on 5.2.
-#
-# Existing cookies will be converted on read then written with the new scheme.
-# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true
-
-# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages
-# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true.
-# Rails.application.config.active_support.use_authenticated_message_encryption = true
-
-# Add default protection from forgery to ActionController::Base instead of in
-# ApplicationController.
-# Rails.application.config.action_controller.default_protect_from_forgery = true
-
-# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and
-# 'f' after migrating old data.
-# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
-
-# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header.
-# Rails.application.config.active_support.use_sha1_digests = true
-
-# Make `form_with` generate id attributes for any generated HTML tags.
-# Rails.application.config.action_view.form_with_generates_ids = true
+++ /dev/null
-# Be sure to restart your server when you modify this file.
-#
-# This file contains migration options to ease your Rails 6.0 upgrade.
-#
-# Once upgraded flip defaults one by one to migrate to the new default.
-#
-# Read the Guide for Upgrading Ruby on Rails for more info on each option.
-
-# Don't force requests from old versions of IE to be UTF-8 encoded.
-# Rails.application.config.action_view.default_enforce_utf8 = false
-
-# Embed purpose and expiry metadata inside signed and encrypted
-# cookies for increased security.
-#
-# This option is not backwards compatible with earlier Rails versions.
-# It's best enabled when your entire app is migrated and stable on 6.0.
-# Rails.application.config.action_dispatch.use_cookies_with_metadata = true
-
-# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
-# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
-
-# Return false instead of self when enqueuing is aborted from a callback.
-# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
-
-# Send Active Storage analysis and purge jobs to dedicated queues.
-# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
-# Rails.application.config.active_storage.queues.purge = :active_storage_purge
-
-# When assigning to a collection of attachments declared via `has_many_attached`, replace existing
-# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
-# Rails.application.config.active_storage.replace_on_assign_to_many = true
-
-# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
-#
-# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
-# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.
-# If you send mail in the background, job workers need to have a copy of
-# MailDeliveryJob to ensure all delivery jobs are processed properly.
-# Make sure your entire app is migrated and stable on 6.0 before using this setting.
-# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
-
-# Enable the same cache key to be reused when the object being cached of type
-# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
-# of the relation's cache key into the cache version to support recycling cache key.
-# Rails.application.config.active_record.collection_cache_versioning = true
+++ /dev/null
-Rails.configuration.middleware.delete ActiveRecord::QueryCache
in_language_title: "Diary Entries in %{language}"
new: New Diary Entry
new_title: Compose a new entry in my user diary
+ my_diary: My Diary
no_entries: No diary entries
recent_entries: "Recent diary entries"
older_entries: Older Entries
+++ /dev/null
-namespace "db" do
- desc "Adds a version number to the nodes table"
- task :node_version => :environment do
- require File.dirname(__FILE__) + "/../../config/environment"
-
- increment = 1000
- offset = 0
- id_max = OldNode.find(:first, :order => "id desc").id
-
- while offset < (id_max + increment)
- hash = {}
-
- # should be offsetting not selecting
- OldNode.find(:all, :limit => increment, :offset => offset, :order => "timestamp").each do |node|
- hash[node.id] ||= []
- hash[node.id] << node
- end
-
- hash.each_value do |node_array|
- n = 1
- node_array.each do |node|
- temp_old_node = TempOldNode.new
- temp_old_node.id = node.id
- temp_old_node.latitude = node.latitude
- temp_old_node.longitude = node.longitude
- temp_old_node.user_id = node.user_id
- temp_old_node.visible = node.visible
- temp_old_node.timestamp = node.timestamp
- temp_old_node.tile = node.tile
- temp_old_node.version = n
- temp_old_node.save! || raise
- n += 1
- end
- end
- offset += increment
- end
- end
-end
+++ /dev/null
-#!/usr/bin/env ruby
-Dir[File.dirname(__FILE__) + "/../lib/daemons/*_ctl"].each { |f| `#{f} #{ARGV.first}` }
+++ /dev/null
-#!/usr/bin/env ruby
-
-# require File.dirname(__FILE__) + "/../config/environment"
-
-start = 0
-User.where("image_use_gravatar AND id >=" + start.to_s).order("id").find_each do |user|
- p "checked up to id " + user.id.to_s if (user.id % 1000).zero? # just give a rough indication where we are for restarting
- next if user.avatar.attached?
-
- hash = Digest::MD5.hexdigest(user.email.downcase)
- url = "https://www.gravatar.com/avatar/#{hash}?d=404" # without d=404 we will always get an image back
- response = OSM.http_client.get(URI.parse(url))
- user.image_use_gravatar = response.success?
- user.save
- sleep(1)
-end
-
-exit 0