Skip to content

Fix absolute urls on 'managed user error' event#9550

Merged
ahukkanen merged 8 commits intodevelopfrom
fix/verification-conflict-mail-url
Jul 20, 2022
Merged

Fix absolute urls on 'managed user error' event#9550
ahukkanen merged 8 commits intodevelopfrom
fix/verification-conflict-mail-url

Conversation

@andreslucena
Copy link
Copy Markdown
Member

🎩 What? Why?

Sometime ago, we detected that we were using relative URLs (aka paths) on some mailers (see #9146). I had one pending:

I've also detected another one at decidim-verifications' managed_user_error_event.rb - it's easier to see in managed_user_error_event_spec.rb, but I think there's some missing piece in the rspec configuration regarding the absolute URLs in tests, as I have the classic

  Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true

I'll try to work with that, and I'll send the PR when I have the fix for that, but I don't want to block these others for that.

I found what was the missing piece, basically I had to explicitly pass the host on the URL method:

conflicts_url: conflicts_url(host: managed_user.organization.host),

I thought this was handled automatically 😄

In the process, I've removed some unnecessary requires that I found. That's already done here:

require "decidim/core/test/shared_examples/simple_event"

I've also fixed a bug on the factory where, on a verification conflict, a managed_user and a user could be from two different organizations. This doesn't make much sense.

📌 Related Issues

Testing

  1. Generate a verification conflict that generates this email
  2. See the generated email.

♥️ Thank you!

@andreslucena andreslucena changed the title Remove unecessary requires for simple_event examples Fix absolute urls on 'managed user error' event Jul 7, 2022
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall great, I've just noticed one potential issue and also left one suggestion regarding the string.

@andreslucena andreslucena requested a review from ahukkanen July 13, 2022 14:55
@andreslucena
Copy link
Copy Markdown
Member Author

This is ready to be reviewed again @ahukkanen

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andreslucena !

I noticed one more issue but as mentioned below, we can also handle that in another PR if you prefer to leave it outside of this PR (since it's not related to the issue this PR is fixing).

Just let me know which way you prefer!

@ahukkanen
Copy link
Copy Markdown
Contributor

Since you are unavailable now, I'll just go ahead and merge this as-is and leave the remaining issue unresolved.

I will handle the remaining issue in another PR myself shortly.

@ahukkanen ahukkanen merged commit ec44fcc into develop Jul 20, 2022
@ahukkanen ahukkanen deleted the fix/verification-conflict-mail-url branch July 20, 2022 11:52
@ahukkanen ahukkanen added type: fix PRs that implement a fix for a bug and removed type: bug labels Aug 15, 2022
eliegaboriau pushed a commit to eliegaboriau/decidim that referenced this pull request Oct 25, 2022
* Remove unecessary requires for simple_event examples

* Fix bug on factory where two users could be on different organizations

* Fix absolute urls on 'managed user error' event

* Using EngineRouter for generating the conflict_url

* Changing the event to other participant

* Wrap only the EngineRouter for URLs

* Change 'other participant' string in email subject too

* Update specs with latest changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: verifications type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants