Skip to content

add link to main application in error messages for private spaces - #1371

Open
valentinRyckaert wants to merge 2 commits into
ElixirTeSS:masterfrom
valentinRyckaert:add-link-to-private-space-rejection
Open

add link to main application in error messages for private spaces#1371
valentinRyckaert wants to merge 2 commits into
ElixirTeSS:masterfrom
valentinRyckaert:add-link-to-private-space-rejection

Conversation

@valentinRyckaert

Copy link
Copy Markdown
Contributor

Summary of changes

  • add a link to the main instance when you have an error while accessing a private space

Motivation and context

If a user try to access directly a private space without sign in or without enough rights, they get an error and need to change the URL by hand to go to the main application.

Checklist

  • I have read and followed the CONTRIBUTING guide.
  • I confirm that I have the authority necessary to make this contribution on behalf of its copyright owner and agree to license it to the TeSS codebase under the BSD license.

unless policy(Space.current_space).shown?
if current_user
flash[:alert] = t('private_space.no_authorized')
flash[:alert] = t('private_space.no_authorized', base_url: TeSS::Config.base_url).html_safe

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just pass the actual link rather than the base_url, e.g. root_path here.

raise Pundit::NotAuthorizedError
else
flash[:alert] = t('private_space.needs_sign_in')
flash[:alert] = t('private_space.needs_sign_in', base_url: TeSS::Config.base_url).html_safe

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

and new_user_session_path here

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.

2 participants