mirror of
https://github.com/Freika/dawarich.git
synced 2025-12-30 09:49:40 -06:00
Small fixes
This commit is contained in:
32
AGENTS.md
32
AGENTS.md
@@ -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.
|
||||
@@ -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
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user