mirror of
https://github.com/styppo/hamstr.git
synced 2024-10-18 05:23:28 +00:00
Fix posts missing from following feed
This commit is contained in:
parent
c18c4ed988
commit
0d9673ad3f
@ -78,7 +78,11 @@ export default {
|
||||
{subId: `feed:${this.feed.name}`}
|
||||
)
|
||||
this.stream.on('init', notes => {
|
||||
const data = typeof this.feed.data === 'function'
|
||||
? this.feed.data()
|
||||
: this.feed.data || []
|
||||
const items = notes
|
||||
.concat(data)
|
||||
.filter(note => this.filterNote(note, this.feed.hideBots))
|
||||
.map(note => [note]) // TODO Single element thread
|
||||
items.sort(feedOrder)
|
||||
|
@ -37,9 +37,17 @@ import Feed from 'components/Feed/Feed.vue'
|
||||
import {useAppStore} from 'stores/App'
|
||||
import {useNostrStore} from 'src/nostr/NostrStore'
|
||||
import {EventKind} from 'src/nostr/model/Event'
|
||||
import {NoteOrder, useNoteStore} from 'src/nostr/store/NoteStore'
|
||||
|
||||
const ZERO_PUBKEY = '0000000000000000000000000000000000000000000000000000000000000000'
|
||||
|
||||
const myContacts = () => {
|
||||
const app = useAppStore()
|
||||
const nostr = useNostrStore()
|
||||
const contacts = nostr.getContacts(app.myPubkey)
|
||||
return contacts?.map(contact => contact.pubkey)
|
||||
}
|
||||
|
||||
const Feeds = {
|
||||
global: {
|
||||
name: 'global',
|
||||
@ -52,10 +60,7 @@ const Feeds = {
|
||||
following: {
|
||||
name: 'following',
|
||||
filters: () => {
|
||||
const app = useAppStore()
|
||||
const nostr = useNostrStore()
|
||||
const contacts = nostr.getContacts(app.myPubkey)
|
||||
let authors = contacts?.map(contact => contact.pubkey)
|
||||
let authors = myContacts()
|
||||
if (!authors || !authors.length) authors = [ZERO_PUBKEY]
|
||||
return {
|
||||
kinds: [EventKind.NOTE],
|
||||
@ -63,6 +68,16 @@ const Feeds = {
|
||||
limit: 50,
|
||||
}
|
||||
},
|
||||
data: () => {
|
||||
let authors = myContacts()
|
||||
if (!authors || !authors.length) return []
|
||||
let notes = []
|
||||
const store = useNoteStore()
|
||||
for (const author of authors) {
|
||||
notes = notes.concat(store.postsByAuthor(author, NoteOrder.CREATION_DATE_DESC))
|
||||
}
|
||||
return notes
|
||||
},
|
||||
hideBots: false,
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user