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

Fix: Prevent Feed from Displaying Logged-In User's Own Posts #284

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

raniabbrk
Copy link
Contributor

Description

This PR addresses issue #240 to prevent the logged-in user's own posts from appearing in the feed.

Changes Implemented

  1. Test Refactoring in FeedScreenTest.kt:

    • Refactored tests to align with the new filtering logic.
    • Added the userMail parameter field in each post of the testPosts.
    • Updated the tests to simulate the logged-in user's email by setting the first post's email to match the logged-in user's email.
    • Ensured that all tests pass after these adjustments.
  2. Bug Fix in Filtering Logic:

    • Changed the filtering condition for initialNearbyPosts:
      • Previously, posts were filtered by comparing the logged-in user's username.
      • Now, posts are filtered using the logged-in user's email (userMail), ensuring more reliable matching and filtering.

Testing

  • Verified that all unit tests in FeedScreenTest.kt pass.
  • Manually tested the feed to confirm that posts authored by the logged-in user are no longer displayed.

Checklist

  • Tests have been updated to reflect changes.
  • All existing tests pass after changes.
  • Verified functionality manually.

Related Issue

Fixes #240

-Changed the filtering condition on initialNearbyposts: the user's email is now being checked instead of the username.
… filtering logic.

-Added the userMail parameter field in each post of the testPosts.
-Ensured that the tests pass by making the first post's email the logged-in user's.
@raniabbrk raniabbrk self-assigned this Dec 16, 2024
@raniabbrk raniabbrk added the bug Something isn't working label Dec 16, 2024
Copy link
Contributor

@Ismaillat Ismaillat left a comment

Choose a reason for hiding this comment

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

Great changes! The feed will now only display posts from other users. The code could still be optimized, for example, by filtering the posts directly in the ProximityFetcher. This can be addressed later. Approved for merge.

@raniabbrk raniabbrk merged commit c25a644 into main Dec 18, 2024
3 checks passed
@rihabbelmekki rihabbelmekki deleted the bugfix/hide-own-posts branch December 20, 2024 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix see our own posts in feed
2 participants