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

in user profiles, restrict visibility of links for new users #1501

Merged
merged 3 commits into from
Jan 3, 2025

Conversation

cellio
Copy link
Member

@cellio cellio commented Dec 30, 2024

Fixes #1500.

sanitize only accepts an allow list, so I couldn't express "allow anything we normally do, except a". I instead blocked all attributes, so the href doesn't work and thus the a doesn't render. There might be a more elegant way to do this; writing a custom sanitizer seemed like overkill and I didn't figure out anything else from Rails doc.

This strips links if the viewer is not logged in and the profile user does not have "participate everywhere". Note for testing: in a new dev environment users come in with that ability by default, so remember to suspend it for your test user.

Screenshots:

  1. Logged-out view of account in good standing:

Screenshot

  1. Logged-out view of restricted account:

Screenshot

  1. Logged-in view of restricted account (account in good standing is unchanged):

Screenshot

@cellio cellio requested a review from a team December 30, 2024 17:48
@cellio
Copy link
Member Author

cellio commented Jan 1, 2025

I think this is ready now. After the initial commit, I applied the same criteria to the web site link (if present) -- we just don't show the field at all in this case, rather than trying to do something to indicate that it's there but hidden. I also added a not-very-pretty notice to the edit page, and would welcome improvements from people who grok CSS better than I do.

Copy link
Member

@ArtOfCode- ArtOfCode- left a comment

Choose a reason for hiding this comment

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

This is a really smart way of doing this. Admittedly I haven't sat for hours thinking about this, but when the topic has come up before now I haven't come up with an easy way to go about it - this is ideal! Thanks!

@ArtOfCode- ArtOfCode- merged commit 152a552 into develop Jan 3, 2025
7 checks passed
@ArtOfCode- ArtOfCode- deleted the cellio/1500-strip-new-user-profile-links branch January 3, 2025 02:33
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.

Don't render links in profile until a user earns Participate Everywhere
2 participants