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

USER STORY: Exclude logged-in user from Profile List #94

Closed
4 tasks done
blahosyl opened this issue Aug 7, 2024 · 2 comments
Closed
4 tasks done

USER STORY: Exclude logged-in user from Profile List #94

blahosyl opened this issue Aug 7, 2024 · 2 comments
Assignees
Labels
e: ux profiles Epic: UX for Profiles p: should have Priority: High value but not crucial

Comments

@blahosyl
Copy link
Owner

blahosyl commented Aug 7, 2024

As a Logged-in User,

I want to view a list of my teammates withouth my profile in the list,

so that I do not see superfluous information

Acceptance Criteria

  1. List of Profiles does not render the profile of the Logged-in User.

Tasks

  • import { useCurrentUser } from "../../contexts/CurrentUserContext";
  • define constant: const currentUser = useCurrentUser();
  • only render the whole component if a user is logged in
     currentUser && (
       <Container className={appStyles.Content}>
         ...
       <Container/>
     )
    

Caution

Deciding to change this means the conditional inside the map has to be re-written to account for currentUser not existing.

  • only map users that are not the Current user:
    {profileList.results.map(
        (profile) =>
              profile && Number(profile.id) !== Number(currentUser.pk) && (
                    <Profile key={profile.id} profile={profile} />
             )
     )}
    

Important

Since a profile is created each time a user registers, the primary key of these models will be the same for the same user. However, the relevant field is called pk in the User model (Allauth default) and id in the Profile model (custom written model).

@blahosyl blahosyl self-assigned this Aug 7, 2024
@blahosyl blahosyl moved this to In Progress in Task Manager Aug 7, 2024
@blahosyl blahosyl added this to the Sprint 2: Profiles & UX milestone Aug 7, 2024
@blahosyl blahosyl added p: should have Priority: High value but not crucial e: ux profiles Epic: UX for Profiles labels Aug 7, 2024
@blahosyl
Copy link
Owner Author

blahosyl commented Aug 7, 2024

Started development on new branch

@blahosyl
Copy link
Owner Author

blahosyl commented Aug 7, 2024

blahosyl added a commit that referenced this issue Aug 7, 2024
@blahosyl blahosyl closed this as completed Aug 7, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Task Manager Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e: ux profiles Epic: UX for Profiles p: should have Priority: High value but not crucial
Projects
Status: Done/Won't do
Development

No branches or pull requests

1 participant