Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
Fix Description Error and clean up a little
Browse files Browse the repository at this point in the history
  • Loading branch information
Nahlam4 committed Jun 10, 2024
1 parent 0a0b245 commit d899701
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 8 additions & 2 deletions src/main/web/src/scenes/Home/components/post/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ export const Post: React.FC<PostModel> = (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 => {
Expand Down Expand Up @@ -203,7 +208,8 @@ export const Post: React.FC<PostModel> = (props: PostModel) => {
src={process.env.PUBLIC_URL + '/assets/menu-dots.svg'}/>
<div className="post-infos" style={{marginLeft: marginLeft}}>
<Link to={`/post/?id=${id}`} className="post-button">
<p className="post-title">{shortenDescription(title, 50)}</p>
<p className="post-title">
{title ? shortenDescription(title, 50): title }</p>
</Link>
<div className="post-tags" style={{marginTop: marginTop}}>
{tags && tags.slice(0, 3).map((tag: string, index: number) => (
Expand Down
2 changes: 1 addition & 1 deletion src/main/web/src/scenes/Search/components/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const User: React.FC<UserModel> = (props: UserModel) => {
{picture && picture.imageData ? (
<img className="user-image" alt={username} src={picture.imageData} loading="lazy"/>
) : (
<img className="custom-image" alt={"random-image"} src={getDefaultOrRandomPicture(false)}/>
<img className="custom-image" alt={"random"} src={getDefaultOrRandomPicture(false)}/>
)}
<div className="user-name">{truncatedUsername}</div>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/main/web/src/scenes/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Search = () => {
const handleFindByChange = (option: string): void => {
setFindOption(option);
};
if (findOption == "user"){
if (findOption === "user"){
return(
<div className="page">
{adBlockDetected && <AdBlockOverlay/>}
Expand Down
4 changes: 2 additions & 2 deletions src/main/web/src/services/UserPageService.tsx
Original file line number Diff line number Diff line change
@@ -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());
};

0 comments on commit d899701

Please sign in to comment.