mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Remove sample points
This commit is contained in:
parent
7dcd4f95ab
commit
37c95d966e
7 changed files with 18 additions and 55 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -68,5 +68,7 @@
|
||||||
|
|
||||||
/config/credentials/production.key
|
/config/credentials/production.key
|
||||||
/config/credentials/production.yml.enc
|
/config/credentials/production.yml.enc
|
||||||
|
/config/credentials/staging.key
|
||||||
|
/config/credentials/staging.yml.enc
|
||||||
|
|
||||||
Makefile
|
Makefile
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
|
# 0.25.9 - UNRELEASED
|
||||||
|
|
||||||
|
## Removed
|
||||||
|
|
||||||
|
- Sample points are no longer being imported automatically for new users.
|
||||||
|
|
||||||
# 0.25.8 - 2025-04-24
|
# 0.25.8 - 2025-04-24
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ class User < ApplicationRecord
|
||||||
has_many :trips, dependent: :destroy
|
has_many :trips, dependent: :destroy
|
||||||
|
|
||||||
after_create :create_api_key
|
after_create :create_api_key
|
||||||
after_create :import_sample_points
|
|
||||||
after_commit :activate, on: :create, if: -> { DawarichSettings.self_hosted? }
|
after_commit :activate, on: :create, if: -> { DawarichSettings.self_hosted? }
|
||||||
before_save :sanitize_input
|
before_save :sanitize_input
|
||||||
|
|
||||||
|
|
@ -134,23 +133,4 @@ class User < ApplicationRecord
|
||||||
settings['photoprism_url']&.gsub!(%r{/+\z}, '')
|
settings['photoprism_url']&.gsub!(%r{/+\z}, '')
|
||||||
settings.try(:[], 'maps')&.try(:[], 'url')&.strip!
|
settings.try(:[], 'maps')&.try(:[], 'url')&.strip!
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
|
||||||
def import_sample_points
|
|
||||||
return unless Rails.env.development? ||
|
|
||||||
Rails.env.production? ||
|
|
||||||
(Rails.env.test? && ENV['IMPORT_SAMPLE_POINTS'])
|
|
||||||
|
|
||||||
import = imports.create(
|
|
||||||
name: 'DELETE_ME_this_is_a_demo_import_DELETE_ME',
|
|
||||||
source: 'gpx'
|
|
||||||
)
|
|
||||||
|
|
||||||
import.file.attach(
|
|
||||||
Rack::Test::UploadedFile.new(
|
|
||||||
Rails.root.join('lib/assets/sample_points.gpx'), 'application/xml'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
# rubocop:enable Metrics/MethodLength
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,21 +4,15 @@
|
||||||
<p class='py-2'>
|
<p class='py-2'>
|
||||||
<p>Docs: <%= link_to "API documentation", '/api-docs', class: 'underline hover:no-underline' %></p>
|
<p>Docs: <%= link_to "API documentation", '/api-docs', class: 'underline hover:no-underline' %></p>
|
||||||
|
|
||||||
Usage example:
|
<h3 class='text-xl font-bold mt-4'>Usage examples</h3>
|
||||||
|
|
||||||
<div role="tablist" class="tabs tabs-boxed">
|
<h3 class='text-lg font-bold mt-4'>OwnTracks</h3>
|
||||||
<input type="radio" name="my_tabs_2" role="tab" class="tab" aria-label="OwnTracks" checked />
|
<p><code><%= api_v1_owntracks_points_url(api_key: current_user.api_key) %></code></p>
|
||||||
<div role="tabpanel" class="tab-content bg-base-100 border-base-300 rounded-box p-6">
|
|
||||||
<p><code><%= api_v1_owntracks_points_url(api_key: current_user.api_key) %></code></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="radio" name="my_tabs_2" role="tab" class="tab" aria-label="Overland" />
|
<h3 class='text-lg font-bold mt-4'>Overland</h3>
|
||||||
<div role="tabpanel" class="tab-content bg-base-100 border-base-300 rounded-box p-6">
|
<p><code><%= api_v1_overland_batches_url(api_key: current_user.api_key) %></code></p>
|
||||||
<p><code><%= api_v1_overland_batches_url(api_key: current_user.api_key) %></code></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</p>
|
</p>
|
||||||
<p class='py-2'>
|
<p class='py-2'>
|
||||||
<%= link_to "Generate new API key", generate_api_key_path, data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?", turbo_method: :post }, class: 'btn btn-primary' %>
|
<%= link_to "Generate new API key", generate_api_key_path, data: { confirm: "Are you sure? This will invalidate the current API key.", turbo_confirm: "Are you sure?", turbo_method: :post }, class: 'btn btn-primary' %>
|
||||||
</p>
|
</p>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,4 @@
|
||||||
<%= link_to 'Background Jobs', settings_background_jobs_path, role: 'tab', class: "tab #{active_tab?(settings_background_jobs_path)}" %>
|
<%= link_to 'Background Jobs', settings_background_jobs_path, role: 'tab', class: "tab #{active_tab?(settings_background_jobs_path)}" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to 'Map', settings_maps_path, role: 'tab', class: "tab #{active_tab?(settings_maps_path)}" %>
|
<%= link_to 'Map', settings_maps_path, role: 'tab', class: "tab #{active_tab?(settings_maps_path)}" %>
|
||||||
<% if !DawarichSettings.self_hosted? %>
|
|
||||||
<%= link_to 'Subscriptions', "#{MANAGER_URL}/auth/dawarich?token=#{current_user.generate_subscription_token}", role: 'tab', class: "tab" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,10 @@
|
||||||
<ul class="p-2 bg-base-100 rounded-t-none z-10">
|
<ul class="p-2 bg-base-100 rounded-t-none z-10">
|
||||||
<li><%= link_to 'Account', edit_user_registration_path %></li>
|
<li><%= link_to 'Account', edit_user_registration_path %></li>
|
||||||
<li><%= link_to 'Settings', settings_path %></li>
|
<li><%= link_to 'Settings', settings_path %></li>
|
||||||
|
<% if !DawarichSettings.self_hosted? %>
|
||||||
|
<li><%= link_to 'Subscription', "#{MANAGER_URL}/auth/dawarich?token=#{current_user.generate_subscription_token}" %></li>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<li><%= link_to 'Logout', destroy_user_session_path, method: :delete, data: { turbo_method: :delete } %></li>
|
<li><%= link_to 'Logout', destroy_user_session_path, method: :delete, data: { turbo_method: :delete } %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
|
|
|
||||||
|
|
@ -56,26 +56,6 @@ RSpec.describe User, type: :model do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#import_sample_points' do
|
|
||||||
before do
|
|
||||||
ENV['IMPORT_SAMPLE_POINTS'] = 'true'
|
|
||||||
end
|
|
||||||
|
|
||||||
after do
|
|
||||||
ENV['IMPORT_SAMPLE_POINTS'] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'creates a sample import and enqueues an import job' do
|
|
||||||
user = create(:user)
|
|
||||||
|
|
||||||
expect(user.imports.count).to eq(1)
|
|
||||||
expect(user.imports.first.name).to eq('DELETE_ME_this_is_a_demo_import_DELETE_ME')
|
|
||||||
expect(user.imports.first.source).to eq('gpx')
|
|
||||||
|
|
||||||
expect(Import::ProcessJob).to have_been_enqueued.with(user.imports.first.id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'methods' do
|
describe 'methods' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue