Skip to content
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

Merged
merged 4 commits into from
Jun 25, 2024

Conversation

daproclaima
Copy link
Contributor

@daproclaima daproclaima commented Jun 17, 2024

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 like http://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).

@daproclaima daproclaima linked an issue Jun 17, 2024 that may be closed by this pull request
@daproclaima daproclaima reopened this Jun 17, 2024
@sampaccoud
Copy link
Member

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?

@daproclaima daproclaima force-pushed the 252-cannot-access-mail-domain-with-id branch from 85498b8 to 9447e7b Compare June 18, 2024 14:07
@daproclaima daproclaima changed the title 🚧(app-regie) use mail domain slug for mail-domains/ requests 🚧(app-regie) use mail domain slug for mail-domains navigation and requests Jun 18, 2024
@mjeammet mjeammet assigned mjeammet and unassigned mjeammet Jun 19, 2024
@mjeammet mjeammet force-pushed the 252-cannot-access-mail-domain-with-id branch 2 times, most recently from 88db5f2 to 493b641 Compare June 19, 2024 16:22
@mjeammet
Copy link
Member

mjeammet commented Jun 19, 2024

cannot lint locally, I don't understand why 😢

EDIT : OK, fixed it with a delicate chmod 777. You're free to merge, @daproclaima

@mjeammet mjeammet force-pushed the 252-cannot-access-mail-domain-with-id branch from bc6d427 to dc53ecc Compare June 21, 2024 15:53
@mjeammet mjeammet marked this pull request as ready for review June 21, 2024 15:59
@daproclaima daproclaima self-assigned this Jun 24, 2024
@daproclaima daproclaima requested a review from AntoLC June 24, 2024 09:38
@AntoLC AntoLC added frontend Relative to the frontend backend labels Jun 25, 2024
Copy link
Contributor

@AntoLC AntoLC left a 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.

Comment on lines 38 to 41
def get_slug(self, instance):
"""Return slug from the domain's name."""
return instance.get_slug()

Copy link
Contributor

@AntoLC AntoLC Jun 25, 2024

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

Copy link
Member

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.

@mjeammet mjeammet force-pushed the 252-cannot-access-mail-domain-with-id branch from dc53ecc to c1f5798 Compare June 25, 2024 10:13
daproclaima and others added 4 commits June 25, 2024 12:26
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
@daproclaima daproclaima force-pushed the 252-cannot-access-mail-domain-with-id branch from c1f5798 to b324df5 Compare June 25, 2024 10:27
@daproclaima daproclaima merged commit 19c36ea into main Jun 25, 2024
15 checks passed
@daproclaima daproclaima deleted the 252-cannot-access-mail-domain-with-id branch June 25, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend frontend Relative to the frontend noChangeLog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛Cannot access mail domain with id
5 participants