mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix to feeds view in profiles (#1171)

* Fix load of feeds tab

* Add e2e test for profile feeds

authored by

Paul Frazee and committed by
GitHub
f4891a47 a3af2a2b

+46 -17
+4
__e2e__/mock-server.ts
··· 53 53 await server.mocker.users[user].agent.post({text: 'Post'}) 54 54 } 55 55 } 56 + if ('feeds' in url.query) { 57 + console.log('Generating mock feed') 58 + await server.mocker.createFeed('alice') 59 + } 56 60 if ('thread' in url.query) { 57 61 console.log('Generating mock posts') 58 62 const res = await server.mocker.users.bob.agent.post({
+7 -1
__e2e__/tests/profile-screen.test.ts
··· 5 5 describe('Profile screen', () => { 6 6 let service: string 7 7 beforeAll(async () => { 8 - service = await createServer('?users&posts') 8 + service = await createServer('?users&posts&feeds') 9 9 await openApp({ 10 10 permissions: {notifications: 'YES', medialibrary: 'YES', photos: 'YES'}, 11 11 }) ··· 15 15 await expect(element(by.id('signInButton'))).toBeVisible() 16 16 await login(service, 'alice', 'hunter2') 17 17 await element(by.id('bottomBarProfileBtn')).tap() 18 + }) 19 + 20 + it('Can see feeds', async () => { 21 + await element(by.id('selector-3')).tap() 22 + await expect(element(by.id('feed-alices feed'))).toBeVisible() 23 + await element(by.id('selector-0')).tap() 18 24 }) 19 25 20 26 it('Open and close edit profile modal', async () => {
+26 -1
jest/test-pds.ts
··· 2 2 import path from 'path' 3 3 import fs from 'fs' 4 4 import {TestPds as DevEnvTestPDS, TestNetworkNoAppView} from '@atproto/dev-env' 5 - import {BskyAgent} from '@atproto/api' 5 + import {AtUri, BskyAgent} from '@atproto/api' 6 6 7 7 export interface TestUser { 8 8 email: string ··· 210 210 throw new Error(`Not a user: ${user}`) 211 211 } 212 212 return await agent.like(uri, cid) 213 + } 214 + 215 + async createFeed(user: string) { 216 + const agent = this.users[user]?.agent 217 + if (!agent) { 218 + throw new Error(`Not a user: ${user}`) 219 + } 220 + const fg1Uri = AtUri.make( 221 + this.users[user].did, 222 + 'app.bsky.feed.generator', 223 + 'alice-favs', 224 + ) 225 + const avatarRes = await agent.api.com.atproto.repo.uploadBlob(this.pic, { 226 + encoding: 'image/png', 227 + }) 228 + return await agent.api.app.bsky.feed.generator.create( 229 + {repo: this.users[user].did, rkey: fg1Uri.rkey}, 230 + { 231 + did: 'did:web:fake.com', 232 + displayName: 'alices feed', 233 + description: 'all my fav stuff', 234 + avatar: avatarRes.data.blob, 235 + createdAt: new Date().toISOString(), 236 + }, 237 + ) 213 238 } 214 239 215 240 async createInvite(forAccount: string) {
+8 -15
src/state/models/ui/profile.ts
··· 114 114 }, 115 115 ]) 116 116 } else { 117 - // not loading, no error, show content 118 117 if ( 119 118 this.selectedView === Sections.PostsNoReplies || 120 119 this.selectedView === Sections.PostsWithReplies || 121 - this.selectedView === Sections.PostsWithMedia || 122 - this.selectedView === Sections.CustomAlgorithms 120 + this.selectedView === Sections.PostsWithMedia 123 121 ) { 124 122 if (this.feed.hasContent) { 125 - if (this.selectedView === Sections.CustomAlgorithms) { 126 - arr = this.algos.feeds 127 - } else if ( 128 - this.selectedView === Sections.PostsNoReplies || 129 - this.selectedView === Sections.PostsWithReplies || 130 - this.selectedView === Sections.PostsWithMedia 131 - ) { 132 - arr = this.feed.slices.slice() 133 - } else { 134 - // posts with replies is also default 135 - arr = this.feed.slices.slice() 136 - } 123 + arr = this.feed.slices.slice() 137 124 if (!this.feed.hasMore) { 138 125 arr = arr.concat([ProfileUiModel.END_ITEM]) 139 126 } 140 127 } else if (this.feed.isEmpty) { 128 + arr = arr.concat([ProfileUiModel.EMPTY_ITEM]) 129 + } 130 + } else if (this.selectedView === Sections.CustomAlgorithms) { 131 + if (this.algos.hasContent) { 132 + arr = this.algos.feeds 133 + } else if (this.algos.isEmpty) { 141 134 arr = arr.concat([ProfileUiModel.EMPTY_ITEM]) 142 135 } 143 136 } else if (this.selectedView === Sections.Lists) {
+1
src/view/com/feeds/CustomFeed.tsx
··· 69 69 70 70 return ( 71 71 <TouchableOpacity 72 + testID={`feed-${item.displayName}`} 72 73 accessibilityRole="button" 73 74 style={[styles.container, pal.border, style]} 74 75 onPress={() => {