diff --git a/src/main/java/de/tinf22b6/dhbwhub/security/WebSecurityConfig.java b/src/main/java/de/tinf22b6/dhbwhub/security/WebSecurityConfig.java index 474a4d28..8c6abe21 100644 --- a/src/main/java/de/tinf22b6/dhbwhub/security/WebSecurityConfig.java +++ b/src/main/java/de/tinf22b6/dhbwhub/security/WebSecurityConfig.java @@ -46,12 +46,12 @@ public class WebSecurityConfig { "/event/event-thread/{id:\\d+}", "/event/event-comments/{id:\\d+}", - "user/{id:\\d+}", + "/user/{id:\\d+}", "/user-image", "/user/user-by-keyword/*", "/user/user-information/*", - "/account/get-user-id/{id:\\d+}", + "/account/get-user-id/*", }; public WebSecurityConfig(UserDetailsServiceImpl userDetailsService, AuthEntryPointJwt unauthorizedHandler) { diff --git a/src/main/web/src/scenes/Home/components/post/Post.tsx b/src/main/web/src/scenes/Home/components/post/Post.tsx index 1d963adb..880e9a65 100644 --- a/src/main/web/src/scenes/Home/components/post/Post.tsx +++ b/src/main/web/src/scenes/Home/components/post/Post.tsx @@ -74,7 +74,12 @@ export const Post: React.FC = (props: PostModel) => { }, [location, id]); useEffect((): void => { - setShortDescription(shortenDescription(description, postImage ? 190 : matches ? 190 : 280)); + if (description){ + setShortDescription(shortenDescription(description, postImage ? 190 : matches ? 190 : 280)); + } + else { + setShortDescription(description); + } }, [description, postImage, matches]); const handleMenuClick = (): void => { @@ -203,7 +208,8 @@ export const Post: React.FC = (props: PostModel) => { src={process.env.PUBLIC_URL + '/assets/menu-dots.svg'}/>
-

{shortenDescription(title, 50)}

+

+ {title ? shortenDescription(title, 50): title }

{tags && tags.slice(0, 3).map((tag: string, index: number) => ( diff --git a/src/main/web/src/scenes/Search/components/User.tsx b/src/main/web/src/scenes/Search/components/User.tsx index 0230e8af..36dde59d 100644 --- a/src/main/web/src/scenes/Search/components/User.tsx +++ b/src/main/web/src/scenes/Search/components/User.tsx @@ -19,7 +19,7 @@ export const User: React.FC = (props: UserModel) => { {picture && picture.imageData ? ( {username} ) : ( - {"random-image"} + {"random"} )}
{truncatedUsername}
diff --git a/src/main/web/src/scenes/Search/index.tsx b/src/main/web/src/scenes/Search/index.tsx index 89cc5d4e..4e988da2 100644 --- a/src/main/web/src/scenes/Search/index.tsx +++ b/src/main/web/src/scenes/Search/index.tsx @@ -34,7 +34,7 @@ export const Search = () => { const handleFindByChange = (option: string): void => { setFindOption(option); }; - if (findOption == "user"){ + if (findOption === "user"){ return(
{adBlockDetected && } diff --git a/src/main/web/src/services/UserPageService.tsx b/src/main/web/src/services/UserPageService.tsx index 0f1de3ad..96288afb 100644 --- a/src/main/web/src/services/UserPageService.tsx +++ b/src/main/web/src/services/UserPageService.tsx @@ -1,9 +1,9 @@ import config from "../config/config"; -export const getUserIdByAccountId = async (accountId: number) => { +export const getUserIdByAccountId = async (accountId:number) => { const response = await fetch(config.apiUrl +`account/get-user-id/${accountId}`); - return await response.json(); + return (response.json()); };