Fix non-selfhosted users export and import

This commit is contained in:
Eugene Burmakin
2025-07-23 20:17:07 +02:00
parent 2e46069fcc
commit bf199de2a0
3 changed files with 5 additions and 5 deletions

View File

@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Fixed
- Distance on the stats page is now rounded. #1548
- Non-selfhosted users can now export and import their account data.
# [0.30.2] - 2025-07-22

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
class Settings::UsersController < ApplicationController
before_action :authenticate_self_hosted!
before_action :authenticate_self_hosted!, only: [:export, :import]
before_action :authenticate_admin!, except: [:export, :import]
before_action :authenticate_user!, only: [:export, :import]

View File

@@ -57,12 +57,12 @@ class Tracks::Generator
tracks_created = 0
segments.each do |segment_data|
track = create_track_from_segment(segment_data)
segments.each do |segment|
track = create_track_from_segment(segment)
tracks_created += 1 if track
end
Rails.logger.info "Generated #{tracks_created} tracks for user #{user.id} in optimized #{mode} mode"
Rails.logger.info "Generated #{tracks_created} tracks for user #{user.id} in #{mode} mode"
tracks_created
end
@@ -188,7 +188,6 @@ class Tracks::Generator
if start_at && end_at
[start_at.to_i, end_at.to_i]
else
# Get full range for user
first_point = user.tracked_points.order(:timestamp).first
last_point = user.tracked_points.order(:timestamp).last