Notification is created by a job. If the job is evaluated before changes are committed to a database, a notification will have an incorrect URL. Therefore, the job should be lodged in enqueue_jobs method which is triggered after the transaction: ```ruby Topic.transaction do move_posts_to topic end add_allowed_users(participants) if participants.present? && @move_to_pm enqueue_jobs(topic) ``` I improved a little bit specs to ensure that the destination topic_id is set. However, that tests are passing even without code improvements. I couldn't find an easy way to "delay" database transaction. Meta: https://meta.discourse.org/t/bug-with-notifications-for-moved-posts/168937 |
||
|---|---|---|
| .. | ||
| components | ||
| fabricators | ||
| fixtures | ||
| helpers | ||
| import_export | ||
| initializers | ||
| integration | ||
| integrity | ||
| jobs | ||
| lib | ||
| mailers | ||
| models | ||
| multisite | ||
| requests | ||
| script/import_scripts | ||
| serializers | ||
| services | ||
| support | ||
| tasks | ||
| views/omniauth_callbacks | ||
| rails_helper.rb | ||
| swagger_helper.rb | ||