fix(profiles): make public profiles accessible without authentication and unify 404 behavior

Backend changes:
- Removed authentication requirement from GET /api/users/:username endpoint
- Removed authentication requirement from GET /api/users/:username/ratings endpoint
- These are public profile endpoints and should be accessible to all users

Frontend changes:
- PublicProfilePage now shows NotFoundPage component when user doesn't exist
- Unified 404 behavior: both invalid URLs and non-existent users show the same 404 page
- NotFoundPage "Requested URL" box now only shows in dev mode (import.meta.env.DEV)
- Removed unused AlertCircle icon import from PublicProfilePage
This commit is contained in:
Radosław Gierwiało
2025-12-05 16:54:38 +01:00
parent 948c694ed6
commit f90945aa47
3 changed files with 15 additions and 30 deletions

View File

@@ -82,7 +82,7 @@ router.patch('/me', authenticate, updateProfileValidation, updateProfile);
router.patch('/me/password', authenticate, changePasswordValidation, changePassword);
// GET /api/users/:username - Get public user profile by username
router.get('/:username', authenticate, async (req, res, next) => {
router.get('/:username', async (req, res, next) => {
try {
const { username } = req.params;
@@ -149,7 +149,7 @@ router.get('/:username', authenticate, async (req, res, next) => {
});
// GET /api/users/:username/ratings - Get ratings for a user
router.get('/:username/ratings', authenticate, async (req, res, next) => {
router.get('/:username/ratings', async (req, res, next) => {
try {
const { username } = req.params;