From 7ee2cb22ba8f0f99acb0ef138aeea06de62fd493 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Wed, 22 Oct 2025 20:39:02 +0200 Subject: [PATCH] Small fixes --- AGENTS.md | 32 ------------------- CHANGELOG.md | 1 + CONTRIBUTING.md | 2 -- app/channels/family_locations_channel.rb | 8 +---- app/controllers/application_controller.rb | 6 ++-- .../family/memberships_controller.rb | 18 +++++------ app/jobs/users/import_data_job.rb | 1 - 7 files changed, 14 insertions(+), 54 deletions(-) delete mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index 597bf48a..00000000 --- a/AGENTS.md +++ /dev/null @@ -1,32 +0,0 @@ -# Repository Guidelines - -## Project Structure & Module Organization -- `app/` holds the Rails application: controllers and views under feature-oriented folders, `services/` for importers and background workflows, and `policies/` for Pundit authorization. -- `app/javascript/` contains Stimulus controllers (`controllers/`), map widgets (`maps/`), and Tailwind/Turbo setup in `application.js`. -- `lib/` stores reusable support code and rake tasks, while `config/` tracks environment settings, credentials, and initializers. -- `db/` carries schema migrations and data migrations; `spec/` provides RSpec coverage; `e2e/` hosts Playwright scenarios; `docker/` bundles deployment compose files. - -## Build, Test, and Development Commands -- `bundle exec rails db:prepare` initializes or migrates the PostgreSQL database. -- `bundle exec bin/dev` starts the Rails app plus JS bundler via Foreman using `Procfile.dev` (set `PROMETHEUS_EXPORTER_ENABLED=true` to use the Prometheus profile). -- `bundle exec sidekiq` runs background jobs locally alongside the web server. -- `docker compose -f docker/docker-compose.yml up` brings up the containerized stack for end-to-end smoke checks. - -## Coding Style & Naming Conventions -- Follow default Ruby style with two-space indentation and snake_case filenames; run `bin/rubocop` before pushing. -- JavaScript modules in `app/javascript/` use ES modules and Stimulus naming (`*_controller.js`); keep exports camelCase and limit files to a single controller. -- Tailwind classes power the UI; co-locate shared styles under `app/javascript/styles/` rather than inline overrides. - -## Testing Guidelines -- Use `bundle exec rspec` for unit and feature specs; mirror production behavior by tagging jobs or services with factories in `spec/support`. -- End-to-end flows live in `e2e/`; execute `npx playwright test` (set `BASE_URL` if the server runs on a non-default port). -- Commit failing scenarios together with the fix, and prefer descriptive `it "..."` strings that capture user intent. - -## Commit & Pull Request Guidelines -- Write concise, imperative commit titles (e.g., `Add family sharing policy`); group related changes rather than omnibus commits. -- Target pull requests at the `dev` branch, describe the motivation, reference GitHub issues when applicable, and attach screenshots for UI-facing changes. -- Confirm CI, lint, and test status before requesting review; call out migrations or data tasks in the PR checklist. - -## Environment & Configuration Tips -- Copy `.env.example` to `.env` or rely on Docker secrets to supply API keys, map tokens, and mail credentials. -- Regenerate credentials with `bin/rails credentials:edit` when altering secrets, and avoid committing any generated `.env` or `credentials.yml.enc` changes. diff --git a/CHANGELOG.md b/CHANGELOG.md index 548b7c94..3c4ca6bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ In this release we're introducing family features that allow users to create fam - Minor versions of Dawarich are being built for ARM64 architecture as well again. #1840 - Importing process for Google Maps Timeline exports, GeoJSON and geodata from photos is now significantly faster. +- The Map page now features a full-screen map. # [0.33.1] - 2025-10-07 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dc0d96fe..d1470f1e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,5 @@ ## How to contribute to Dawarich -Refer to [Repository Guidelines](AGENTS.md) for structure, tooling, and workflow expectations before submitting changes. - #### **Did you find a bug?** * **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/Freika/dawarich/issues). diff --git a/app/channels/family_locations_channel.rb b/app/channels/family_locations_channel.rb index 4520d3af..d1df714e 100644 --- a/app/channels/family_locations_channel.rb +++ b/app/channels/family_locations_channel.rb @@ -2,7 +2,7 @@ class FamilyLocationsChannel < ApplicationCable::Channel def subscribed - return reject unless family_feature_enabled? + return reject unless DawarichSettings.family_feature_enabled? return reject unless current_user.in_family? stream_for current_user.family @@ -11,10 +11,4 @@ class FamilyLocationsChannel < ApplicationCable::Channel def unsubscribed # Any cleanup needed when channel is unsubscribed end - - private - - def family_feature_enabled? - DawarichSettings.family_feature_enabled? - end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 515aebef..a18d9f5b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -75,8 +75,8 @@ class ApplicationController < ActionController::Base end def user_not_authorized - redirect_to (request.referer || root_path), - alert: 'You are not authorized to perform this action.', - status: :see_other + redirect_back fallback_location: root_path, + alert: 'You are not authorized to perform this action.', + status: :see_other end end diff --git a/app/controllers/family/memberships_controller.rb b/app/controllers/family/memberships_controller.rb index a236ac23..23aaaddf 100644 --- a/app/controllers/family/memberships_controller.rb +++ b/app/controllers/family/memberships_controller.rb @@ -21,17 +21,17 @@ class Family::MembershipsController < ApplicationController redirect_to root_path, alert: service.error_message || 'Unable to accept invitation' end rescue Pundit::NotAuthorizedError - if @invitation.expired? - redirect_to root_path, alert: 'This invitation is no longer valid or has expired' - elsif !@invitation.pending? - redirect_to root_path, alert: 'This invitation has already been processed' - elsif @invitation.email != current_user.email - redirect_to root_path, alert: 'This invitation is not for your email address' - else - redirect_to root_path, alert: 'You are not authorized to accept this invitation' - end + alert = case + when @invitation.expired? then 'This invitation is no longer valid or has expired' + when !@invitation.pending? then 'This invitation has already been processed' + when @invitation.email != current_user.email then 'This invitation is not for your email address' + else 'You are not authorized to accept this invitation' + end + + redirect_to root_path, alert: alert rescue StandardError => e Rails.logger.error "Error accepting family invitation: #{e.message}" + redirect_to root_path, alert: 'An unexpected error occurred. Please try again later' end diff --git a/app/jobs/users/import_data_job.rb b/app/jobs/users/import_data_job.rb index 44361e5a..747b7a67 100644 --- a/app/jobs/users/import_data_job.rb +++ b/app/jobs/users/import_data_job.rb @@ -17,7 +17,6 @@ class Users::ImportDataJob < ApplicationJob import_stats = Users::ImportData.new(user, archive_path).import - # Reset counter caches after import completes User.reset_counters(user.id, :points) Rails.logger.info "Import completed successfully for user #{user.email}: #{import_stats}"