Skip to content
Open
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
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export async function start ({port, configDir, domain}) {
app.get('/signup', staticFile('static/index.html'))
app.get('/forgot-password', staticFile('static/index.html'))
app.get('/notifications', staticFile('static/index.html'))
app.get('/follow-only', staticFile('static/index.html'))
app.get('/communities', staticFile('static/index.html'))
app.get('/account', staticFile('static/index.html'))
app.get('/profile', staticFile('static/index.html'))
Expand Down
4 changes: 3 additions & 1 deletion static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ class CtznApp extends LitElement {
case '/index':
case '/index.html':
case '/notifications':
case '/follow-only':
case '/search':
gestures.setCurrentNav(['/', '/notifications', '/search'])
gestures.setCurrentNav(['/', '/notifications', '/search', '/follow-only'])
return
case '/communities':
gestures.setCurrentNav([{back: true}, '/communities'])
Expand Down Expand Up @@ -163,6 +164,7 @@ class CtznApp extends LitElement {
case '/index':
case '/index.html':
case '/notifications':
case '/follow-only':
case '/search':
case '/activity':
return html`<app-main-view id="view" current-path=${this.currentPath}></app-main-view>`
Expand Down
13 changes: 8 additions & 5 deletions static/js/ctzn-tags/posts-feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export class PostsFeed extends LitElement {
limit: {type: Number},
results: {type: Array},
hasNewItems: {type: Boolean},
isLoadingMore: {type: Boolean}
isLoadingMore: {type: Boolean},
followOnly: {type: Boolean, attribute: 'follow-only'}
}
}

Expand All @@ -35,6 +36,7 @@ export class PostsFeed extends LitElement {
this.results = undefined
this.hasNewItems = false
this.isLoadingMore = false
this.followOnly = false

// ui state
this.loadMoreObserver = undefined
Expand Down Expand Up @@ -150,9 +152,10 @@ export class PostsFeed extends LitElement {
let results = more ? (this.results || []) : []
let lt = more ? results[results?.length - 1]?.key : undefined
if (this.view === 'ctzn.network/feed-view') {
results = results.concat((await session.ctzn.view(this.view, {limit: 15, reverse: true, lt}))?.feed)
let res = (await session.ctzn.view(this.view, {limit: 15, reverse: true, lt, followOnly: this.followOnly}))
results = results.concat(res?.feed)
} else {
results = results.concat((await session.ctzn.viewByHomeServer(this.userId, this.view, this.userId, {limit: 15, reverse: true, lt}))?.posts)
results = results.concat((await session.ctzn.viewByHomeServer(this.userId, this.view, this.userId, {limit: 15, reverse: true, lt, followOnly: this.followOnly}))?.posts)
}
if (this.limit > 0 && results.length > this.limit) {
results = results.slice(0, this.limit)
Expand Down Expand Up @@ -183,9 +186,9 @@ export class PostsFeed extends LitElement {
}
let results
if (this.view === 'ctzn.network/feed-view') {
results = (await session.ctzn.view(this.view, {limit: 1, reverse: true}))?.feed
results = (await session.ctzn.view(this.view, {limit: 1, reverse: true, followOnly: this.followOnly}))?.feed
} else {
results = (await session.ctzn.viewByHomeServer(this.userId, this.view, this.userId, {limit: 1, reverse: true}))?.posts
results = (await session.ctzn.viewByHomeServer(this.userId, this.view, this.userId, {limit: 1, reverse: true, followOnly: this.followOnly}))?.posts
}
this.hasNewItems = (results[0] && results[0].key !== this.results[0].key)
}
Expand Down
13 changes: 13 additions & 0 deletions static/js/views/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ class CtznMainView extends LitElement {
path: '/search',
mobileOnly: true,
label: 'Search'
},
{
path: '/follow-only',
label: 'Follows'
}
]
return html`
Expand Down Expand Up @@ -221,6 +225,15 @@ class CtznMainView extends LitElement {
</div>
<app-searchable-user-list></app-searchable-user-list>
</div>
` : this.currentView === 'follow-only' ? html`
${this.isEmpty ? this.renderEmptyMessage() : ''}
<ctzn-posts-feed
cleared-at=${this.notificationsClearedAt}
view="ctzn.network/feed-view"
follow-only=true
@load-state-updated=${this.onFeedLoadStateUpdated}
@publish-reply=${this.onPublishReply}
></ctzn-posts-feed>
` : ''}
</div>
${this.renderRightSidebar()}
Expand Down
7 changes: 7 additions & 0 deletions static/vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
"Content-Security-Policy": "script-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self';"
}
},
{
"src": "/follow-only",
"dest": "/index.html",
"headers": {
"Content-Security-Policy": "script-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self';"
}
},
{
"src": "/notifications",
"dest": "/index.html",
Expand Down