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}`}
|
{subId: `feed:${this.feed.name}`}
|
||||||
)
|
)
|
||||||
this.stream.on('init', notes => {
|
this.stream.on('init', notes => {
|
||||||
|
const data = typeof this.feed.data === 'function'
|
||||||
|
? this.feed.data()
|
||||||
|
: this.feed.data || []
|
||||||
const items = notes
|
const items = notes
|
||||||
|
.concat(data)
|
||||||
.filter(note => this.filterNote(note, this.feed.hideBots))
|
.filter(note => this.filterNote(note, this.feed.hideBots))
|
||||||
.map(note => [note]) // TODO Single element thread
|
.map(note => [note]) // TODO Single element thread
|
||||||
items.sort(feedOrder)
|
items.sort(feedOrder)
|
||||||
|
@ -37,9 +37,17 @@ import Feed from 'components/Feed/Feed.vue'
|
|||||||
import {useAppStore} from 'stores/App'
|
import {useAppStore} from 'stores/App'
|
||||||
import {useNostrStore} from 'src/nostr/NostrStore'
|
import {useNostrStore} from 'src/nostr/NostrStore'
|
||||||
import {EventKind} from 'src/nostr/model/Event'
|
import {EventKind} from 'src/nostr/model/Event'
|
||||||
|
import {NoteOrder, useNoteStore} from 'src/nostr/store/NoteStore'
|
||||||
|
|
||||||
const ZERO_PUBKEY = '0000000000000000000000000000000000000000000000000000000000000000'
|
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 = {
|
const Feeds = {
|
||||||
global: {
|
global: {
|
||||||
name: 'global',
|
name: 'global',
|
||||||
@ -52,10 +60,7 @@ const Feeds = {
|
|||||||
following: {
|
following: {
|
||||||
name: 'following',
|
name: 'following',
|
||||||
filters: () => {
|
filters: () => {
|
||||||
const app = useAppStore()
|
let authors = myContacts()
|
||||||
const nostr = useNostrStore()
|
|
||||||
const contacts = nostr.getContacts(app.myPubkey)
|
|
||||||
let authors = contacts?.map(contact => contact.pubkey)
|
|
||||||
if (!authors || !authors.length) authors = [ZERO_PUBKEY]
|
if (!authors || !authors.length) authors = [ZERO_PUBKEY]
|
||||||
return {
|
return {
|
||||||
kinds: [EventKind.NOTE],
|
kinds: [EventKind.NOTE],
|
||||||
@ -63,6 +68,16 @@ const Feeds = {
|
|||||||
limit: 50,
|
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,
|
hideBots: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user