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

Protect Routes #292

Merged
merged 45 commits into from
Jul 28, 2023
Merged

Protect Routes #292

merged 45 commits into from
Jul 28, 2023

Conversation

MarioRodrigues10
Copy link
Member

@MarioRodrigues10 MarioRodrigues10 commented Jul 23, 2023

This PR belongs to @joaodiaslobo , in order to merge this quicker i fixed some tests and open it because @joaodiaslobo will be out of town for a week and we can't delay this feature much more.

|> assign(:page_title, gettext("Edit Activity"))
|> assign(:activity, activity)}
else
raise AtomicWeb.MismatchError
Copy link
Member

Choose a reason for hiding this comment

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

Why are you raising an exception on an handle_params function?

Copy link
Member

Choose a reason for hiding this comment

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

I think what he is doing is raising an exception making the current request fail with 404 status, which automatically shows the 404 page. Smart

Copy link
Member

@ruilopesm ruilopesm Jul 25, 2023

Choose a reason for hiding this comment

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

Hmm, I see. Why not wrap this logic inside a function and call it on a Plug implemented at the route level? That way, we could also use that function when deciding to display (or not) the "Edit" button on the show of an activity. Agreed? 🙏

Edit: This was supposed to be a reply to the already created thread 😅

Copy link
Member

Choose a reason for hiding this comment

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

I think that is a good idea. Will clean up the code quite a bit

Copy link
Member

@ruioliveira02 ruioliveira02 left a comment

Choose a reason for hiding this comment

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

image

lib/atomic/activities/speaker.ex Outdated Show resolved Hide resolved
|> assign(:page_title, gettext("Edit Activity"))
|> assign(:activity, activity)}
else
raise AtomicWeb.MismatchError
Copy link
Member

Choose a reason for hiding this comment

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

I think what he is doing is raising an exception making the current request fail with 404 status, which automatically shows the 404 page. Smart

lib/atomic/activities.ex Outdated Show resolved Hide resolved
lib/atomic_web/controllers/user_auth.ex Outdated Show resolved Hide resolved
lib/atomic_web/live/activity_live/edit.ex Outdated Show resolved Hide resolved
|> assign(:page_title, gettext("Edit Activity"))
|> assign(:activity, activity)}
else
raise AtomicWeb.MismatchError
Copy link
Member

@ruilopesm ruilopesm Jul 25, 2023

Choose a reason for hiding this comment

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

Hmm, I see. Why not wrap this logic inside a function and call it on a Plug implemented at the route level? That way, we could also use that function when deciding to display (or not) the "Edit" button on the show of an activity. Agreed? 🙏

Edit: This was supposed to be a reply to the already created thread 😅

lib/atomic/activities.ex Outdated Show resolved Hide resolved
lib/atomic/activities.ex Outdated Show resolved Hide resolved
lib/atomic/organizations.ex Outdated Show resolved Hide resolved
Copy link
Member

@ruioliveira02 ruioliveira02 left a comment

Choose a reason for hiding this comment

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

image
image

There are two ways to go about this. We can fix this right now, or merge this and make it a problem for the person implementing that page

Copy link
Member

@ruioliveira02 ruioliveira02 left a comment

Choose a reason for hiding this comment

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

🚀

@MarioRodrigues10 MarioRodrigues10 merged commit 8e5780c into develop Jul 28, 2023
2 checks passed
@MarioRodrigues10 MarioRodrigues10 deleted the jl/protect-routes branch July 28, 2023 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants