-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚧(app-regie) use mail domain slug for mail-domains navigation and requests #253
Conversation
What's the idea behing this change? Can you provide more details in the description of the pull request with our usual format : Purpose / Proposal? |
85498b8
to
9447e7b
Compare
88db5f2
to
493b641
Compare
cannot lint locally, I don't understand why 😢 EDIT : OK, fixed it with a delicate chmod 777. You're free to merge, @daproclaima |
bc6d427
to
dc53ecc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All seems good ^^
Just a question for @mjeammet.
def get_slug(self, instance): | ||
"""Return slug from the domain's name.""" | ||
return instance.get_slug() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mjeammet Why do you need to override slug
?
When you save your slug, you already use slugify I can see.
https://github.com/numerique-gouv/people/blob/dc53ecc3bc2ca5d11451ecff8af035fdf3f85230/src/backend/mailbox_manager/models.py#L32-L33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually you're right, I don't think we need that. I removed it.
dc53ecc
to
c1f5798
Compare
Stop using mailDomain.id in frontend navigation and mail-domains/ requests. Instead, uses mailDomain slug.
add missing field to MailDomain serializer after commit b4bafb6
Updates tests to use mail domain slug instead of id.
- slug readonly on admin - fix test to expect slug in payload, when retrieving a domain
c1f5798
to
b324df5
Compare
Stop using mailDomain.id in frontend navigation and requests to the backend. Instead, use mailDomain.url as a slug.
A meaningful URL, easy to memorize for the user consulting a specific mail domain view.
With this change, instead of providing a UUID in the frontend application URL, we use the slug of a mail domain.
As a result, a URL that used to have the format
http://localhost:3000/mail-domains/6bbd8081-563a-4c5a-ae02-2785d18f2480
will look likehttp://localhost:3000/mail-domains/domainfr
.Changes in the code
Each navigation button supposed to redirect to the view of a specific mail domain will embed the slug of the mail domain instead of its id. Also, every http request sent to the django API on the api/mail-domains/ path related to a specific domain and its mailboxes will use the mail domain slug instead of its id (as introduced in commit b4bafb6).