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

Add Field for the Directory Intro Paragraph #749

Open
wants to merge 39 commits into
base: main
Choose a base branch
from

Conversation

glenn-sorrentino
Copy link
Member

@glenn-sorrentino glenn-sorrentino commented Nov 10, 2024

This PR adds a new feature that allows administrators to set a customizable introductory description for the user directory. This introductory text appears at the top of the directory page, providing context or guidelines to visitors and enhancing user engagement.

Key Changes:

  • Introduced a DIRECTORY_INTRO setting in OrganizationSetting to store the introductory text for the user directory.
  • Added a form in the admin settings page that allows administrators to update the DIRECTORY_INTRO text.
  • Implemented a new route update_directory_intro_text in the settings module to handle updates to the introductory text by admins.
  • Modified the directory template to display the DIRECTORY_INTRO text at the top of the directory page for all users.
  • Added unit tests to verify that the introductory text can be updated successfully and is displayed correctly on the directory page.

hushline/routes.py Outdated Show resolved Hide resolved
hushline/settings/__init__.py Outdated Show resolved Hide resolved
hushline/model.py Show resolved Hide resolved
hushline/templates/directory.html Outdated Show resolved Hide resolved
hushline/templates/settings/branding.html Outdated Show resolved Hide resolved
tests/test_settings.py Outdated Show resolved Hide resolved
hushline/routes.py Outdated Show resolved Hide resolved
tests/test_settings.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@brassy-endomorph brassy-endomorph left a comment

Choose a reason for hiding this comment

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

A few nits but mostly a note about preventing XSS. Data needs to be escaped at display time always unless we can guaranteed it is safe. We usually can't. A rule of thumb is "user input is lava" and we want to handle it very very carefully. We don't even mark ints or UUIDs as safe when we display them even though we can assume quite strongly that they're always going to be safe. HTML that users input is never going be that, so when we pull from the DB it always needs to be cleaned/sanitized and then marked with a safe type.

hushline/settings/__init__.py Show resolved Hide resolved
hushline/settings/__init__.py Outdated Show resolved Hide resolved
hushline/templates/directory.html Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
hushline/templates/directory.html Outdated Show resolved Hide resolved
hushline/routes.py Show resolved Hide resolved
Copy link
Collaborator

@brassy-endomorph brassy-endomorph left a comment

Choose a reason for hiding this comment

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

Sorry, still some changes, one of them being my fault for pointing you a little in the wrong direction :/

hushline/routes.py Outdated Show resolved Hide resolved
poetry.lock Show resolved Hide resolved
hushline/settings/__init__.py Outdated Show resolved Hide resolved
tests/test_settings.py Outdated Show resolved Hide resolved
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