[openstreetmap/openstreetmap-website] Use Noticed for notifications on GPX imports (PR #6939)

Pablo Brasero notifications at github.com
Wed Mar 25 16:04:55 UTC 2026


Following on https://github.com/openstreetmap/openstreetmap-website/pull/6837, and sibling to https://github.com/openstreetmap/openstreetmap-website/pull/6933, this converts some more code to use Noticed instead of using mailers directly.

Of the two converted notifications here, the failure one is a bit trickier. The original code uses `#deliver` to ensure an immediate delivery so that the failed trace can be deleted right after. However that's something we cannot do now.

To work around this, I'm proposing a new cleanup job, to be run periodically along the existing one.

I define "failed" jobs as those that have not been "inserted" and whose "timestamp" is longer than one day. This feels a bit indirect though. Thoughts? Alternatively, we could add a new column `failed` (or similar) to explicitly mark failed jobs... although if something goes wrong that column could be left unmarked when it should be marked.

As for the destruction itself, I'm calling `destroy_all` on the relevant jobs directly, as this will happen inside a job already. Is that ok or should I be using `TraceDestroyerJob`?
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/6939

-- Commit Summary --

  * Use Noticed to deliver notifications on GPX import success
  * Use Noticed to deliver notifications on GPX import failure

-- File Changes --

    M app/jobs/trace_importer_job.rb (10)
    M app/mailers/user_mailer.rb (4)
    M app/models/trace.rb (5)
    A app/notifiers/gpx_import_failure_notifier.rb (12)
    A app/notifiers/gpx_import_success_notifier.rb (12)
    M lib/tasks/cleanup.rake (5)
    M test/jobs/trace_importer_job_test.rb (20)
    M test/mailers/previews/user_mailer_preview.rb (4)
    M test/mailers/user_mailer_test.rb (8)
    M test/models/trace_test.rb (18)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/6939.patchhttps://github.com/openstreetmap/openstreetmap-website/pull/6939.diff
-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6939
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6939 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260325/469036f3/attachment.htm>


More information about the rails-dev mailing list