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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,38 +64,43 @@ class FeedScreenTest {
// Mock posts
val testPosts =
listOf(
Post(
Post( // Post created by the logged-in user
uid = "1",
uri = "http://example.com/1.jpg",
username = testUserProfile.email, // Post created by the logged-in user
username = testUserProfile.email,
userMail = testUserProfile.email,
latitude = 37.7749, // San Francisco
longitude = -122.4194,
description = "This is a test description"),
Post(
uid = "2",
uri = "http://example.com/2.jpg",
username = "User2", // Post created by another user
userMail = "User2",
latitude = 34.0522, // Los Angeles
longitude = -118.2437,
description = "This is another test description"),
Post(
uid = "3",
uri = "http://example.com/3.jpg",
username = "User3", // Another user's post
username = "User3",
userMail = "User3", // Another user's post
latitude = 36.7783, // Fresno (closer to SF)
longitude = -119.4179,
description = "This is yet another test description"),
Post(
uid = "4",
uri = "User4",
username = "user4@example.com", // Another user's post
userMail = "User4",
latitude = 40.7128, // New York City (farther from SF than LA or Fresno)
longitude = -74.0060,
description = "This is a test description"),
Post(
uid = "5",
uri = "User5",
username = "user5@example.com", // Another user's post
userMail = "User5",
latitude = -33.8688, // Sydney, Australia (farthest from SF)
longitude = 151.2093,
description = "This is a test description"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fun FeedScreen(
val unfilteredPosts by
(initialNearbyPosts?.let { mutableStateOf(it) }
?: proximityAndTimePostFetcher.nearbyPosts.collectAsState())
val nearbyPosts = unfilteredPosts.filter { it.username != userEmail }
val nearbyPosts = unfilteredPosts.filter { it.userMail != userEmail }

val postRatings = remember { mutableStateMapOf<String, List<Boolean>>() }

Expand Down
Loading