π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix social feed and profile empty state
Anand Baburajan897de20a83f4
diff --git a/server/wall/repo/module_test.go b/server/wall/repo/module_test.goindex 781e0cbc35..411d3ea89a 100644--- a/server/wall/repo/module_test.go+++ b/server/wall/repo/module_test.go@@ -758,14 +758,29 @@ func TestListFeedCursorUsesCreatedAtSortOrder(t *testing.T) {module := newWallTestModule(t)aliceID := insertWallUser(t, module, "[email protected]", "alice-public")- wall, err := module.Walls.CreateWall(ctx, aliceID, "alice", "alice-wall-key", "alice-profile")+ bobID := insertWallUser(t, module, "[email protected]", "bob-public")+ charlieID := insertWallUser(t, module, "[email protected]", "charlie-public")+ aliceWall, err := module.Walls.CreateWall(ctx, aliceID, "alice", "alice-wall-key", "alice-profile")require.NoError(t, err)- first, err := module.Posts.CreatePost(ctx, aliceID, wall.WallID, "post-key-1", nil, wall.CurrentVersion, nil)+ bobWall, err := module.Walls.CreateWall(ctx, bobID, "bob", "bob-wall-key", "bob-profile")require.NoError(t, err)- second, err := module.Posts.CreatePost(ctx, aliceID, wall.WallID, "post-key-2", nil, wall.CurrentVersion, nil)+ charlieWall, err := module.Walls.CreateWall(ctx, charlieID, "charlie", "charlie-wall-key", "charlie-profile")require.NoError(t, err)- third, err := module.Posts.CreatePost(ctx, aliceID, wall.WallID, "post-key-3", nil, wall.CurrentVersion, nil)+ err = module.Friends.AddFriend(ctx, aliceID, aliceWall.WallID, bobWall.WallID, "bob-share-key", bobWall.CurrentVersion, "alice-share-key", aliceWall.CurrentVersion)+ require.NoError(t, err)++ ownPost, err := module.Posts.CreatePost(ctx, aliceID, aliceWall.WallID, "own-post-key", nil, aliceWall.CurrentVersion, nil)+ require.NoError(t, err)+ unrelatedPost, err := module.Posts.CreatePost(ctx, charlieID, charlieWall.WallID, "unrelated-post-key", nil, charlieWall.CurrentVersion, nil)+ require.NoError(t, err)+ first, err := module.Posts.CreatePost(ctx, bobID, bobWall.WallID, "post-key-1", nil, bobWall.CurrentVersion, nil)require.NoError(t, err)+ second, err := module.Posts.CreatePost(ctx, bobID, bobWall.WallID, "post-key-2", nil, bobWall.CurrentVersion, nil)+ require.NoError(t, err)+ third, err := module.Posts.CreatePost(ctx, bobID, bobWall.WallID, "post-key-3", nil, bobWall.CurrentVersion, nil)+ require.NoError(t, err)+ setPostCreatedAt(t, module, 5000, ownPost)+ setPostCreatedAt(t, module, 4000, unrelatedPost)setPostCreatedAt(t, module, 3000, first)setPostCreatedAt(t, module, 2000, second)setPostCreatedAt(t, module, 1000, third)@@ -781,6 +796,12 @@ func TestListFeedCursorUsesCreatedAtSortOrder(t *testing.T) {require.Len(t, page, 1)require.Equal(t, second, page[0].PostID)require.Equal(t, "2000:"+strconv.FormatInt(second, 10), nextCursor)++ page, nextCursor, err = module.Posts.ListFeed(ctx, aliceID, nextCursor, 1)+ require.NoError(t, err)+ require.Len(t, page, 1)+ require.Equal(t, third, page[0].PostID)+ require.Empty(t, nextCursor)}func TestNotificationsIncludeWallSocialEvents(t *testing.T) {diff --git a/server/wall/repo/posts.go b/server/wall/repo/posts.goindex d0215eecb6..302955fc6c 100644--- a/server/wall/repo/posts.go+++ b/server/wall/repo/posts.go@@ -150,12 +150,10 @@ func (r *PostsRepository) ListFeed(ctx context.Context, viewerID int64, cursor sJOIN walls owner_wall ON owner_wall.owner_id = p.owner_idJOIN key_attributes owner_ka ON owner_ka.user_id = p.owner_idWHERE p.is_deleted = FALSE- AND (- p.owner_id = $1 OR- EXISTS (- SELECT 1 FROM wall_friend_shares fs- WHERE fs.friend_id = $1 AND fs.wall_id = p.wall_id- )+ AND p.owner_id <> $1+ AND EXISTS (+ SELECT 1 FROM wall_friend_shares fs+ WHERE fs.friend_id = $1 AND fs.wall_id = p.wall_id)`if cursorCreatedAt, cursorPostID, ok := parsePostCursor(cursor); ok {args = append(args, cursorCreatedAt, cursorPostID)diff --git a/web/apps/social/src/pages/app/index.tsx b/web/apps/social/src/pages/app/index.tsxindex 479c76f29f..5ec95b1387 100644--- a/web/apps/social/src/pages/app/index.tsx+++ b/web/apps/social/src/pages/app/index.tsx@@ -107,7 +107,6 @@ const Page: React.FC = () => {width: image.width,});if (!post) throw new Error("Couldn't create post.");- setFeedItems((currentItems) => [post, ...currentItems]);return socialPostToViewerPhoto(post);}}onOpenFriend={(friendID) =>diff --git a/web/apps/social/src/screens/ProfileScreen.tsx b/web/apps/social/src/screens/ProfileScreen.tsxindex 0d6731868c..2e0e04c10e 100644--- a/web/apps/social/src/screens/ProfileScreen.tsx+++ b/web/apps/social/src/screens/ProfileScreen.tsx@@ -39,6 +39,7 @@ const profileAvatarTopOffset = 54;const profileAvatarSize = 120;const profileCoverHeight =profileHeaderHeight + profileAvatarTopOffset + profileAvatarSize / 2;+const ownerEmptyStateGap = "18px";const photoMasonryGap = "3px";const photoMasonryRadius = "12px";interface ProfilePhotoDimensions {@@ -1129,7 +1130,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({sx={{display: "block",height: "auto",- mt: "28px",+ mt: ownerEmptyStateGap,width: 160,}}/>@@ -1144,7 +1145,9 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({fontWeight: 500,lineHeight: "20px",m: 0,- mt: isOwnerProfile ? "30px" : 0,+ mt: isOwnerProfile+ ? ownerEmptyStateGap+ : 0,maxWidth: isOwnerProfile? 230: 250,@@ -1173,7 +1176,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({height: 32,justifyContent: "center",lineHeight: 0,- mt: "26px",+ mt: ownerEmptyStateGap,p: 0,pointerEvents: "auto",placeSelf: "center",