kopia lustrzana https://github.com/cloudflare/wildebeest
Dedup Note in timelines by ObjectId
rodzic
6b76674dbb
commit
3215097c5c
|
@ -62,6 +62,7 @@ WHERE
|
|||
AND outbox_objects.actor_id IN (SELECT value FROM json_each(?2))
|
||||
AND json_extract(objects.properties, '$.inReplyTo') IS NULL
|
||||
AND (outbox_objects.target = '${PUBLIC_GROUP}' OR outbox_objects.target IN (SELECT value FROM json_each(?3)))
|
||||
GROUP BY objects.id
|
||||
ORDER by outbox_objects.published_date DESC
|
||||
LIMIT ?4
|
||||
`
|
||||
|
@ -129,6 +130,7 @@ WHERE objects.type='Note'
|
|||
AND ${localPreferenceQuery(localPreference)}
|
||||
AND json_extract(objects.properties, '$.inReplyTo') IS NULL
|
||||
AND outbox_objects.target = '${PUBLIC_GROUP}'
|
||||
GROUP BY objects.id
|
||||
ORDER by outbox_objects.published_date DESC
|
||||
LIMIT ?1 OFFSET ?2
|
||||
`
|
||||
|
|
|
@ -280,6 +280,9 @@ describe('ActivityPub', () => {
|
|||
|
||||
const queue = {
|
||||
async send() {},
|
||||
async sendBatch() {
|
||||
throw new Error('unimplemented')
|
||||
},
|
||||
}
|
||||
|
||||
const activity: any = {}
|
||||
|
@ -297,6 +300,9 @@ describe('ActivityPub', () => {
|
|||
async send(v: any) {
|
||||
msg = v
|
||||
},
|
||||
async sendBatch() {
|
||||
throw new Error('unimplemented')
|
||||
},
|
||||
}
|
||||
|
||||
const activity: any = {
|
||||
|
|
|
@ -10,7 +10,7 @@ import * as timelines_home from 'wildebeest/functions/api/v1/timelines/home'
|
|||
import * as timelines_public from 'wildebeest/functions/api/v1/timelines/public'
|
||||
import * as timelines from 'wildebeest/backend/src/mastodon/timeline'
|
||||
import { insertLike } from 'wildebeest/backend/src/mastodon/like'
|
||||
import { insertReblog } from 'wildebeest/backend/src/mastodon/reblog'
|
||||
import { insertReblog, createReblog } from 'wildebeest/backend/src/mastodon/reblog'
|
||||
import { createStatus } from 'wildebeest/backend/src/mastodon/status'
|
||||
|
||||
const userKEK = 'test_kek6'
|
||||
|
@ -276,5 +276,23 @@ describe('Mastodon APIs', () => {
|
|||
assert.equal(data.length, 1)
|
||||
assert.equal(data[0].favourited, true)
|
||||
})
|
||||
|
||||
test('show unique Notes', async () => {
|
||||
const db = await makeDB()
|
||||
const actor = await createPerson(domain, db, userKEK, 'sven@cloudflare.com')
|
||||
const actorA = await createPerson(domain, db, userKEK, 'svenA@cloudflare.com')
|
||||
const actorB = await createPerson(domain, db, userKEK, 'svenB@cloudflare.com')
|
||||
|
||||
// Actor posts
|
||||
const note = await createStatus(domain, db, actor, 'a post')
|
||||
|
||||
// ActorA and B reblog the post
|
||||
await createReblog(db, actorA, note)
|
||||
await createReblog(db, actorB, note)
|
||||
|
||||
const data = await timelines.getPublicTimeline(domain, db, timelines.LocalPreference.NotSet)
|
||||
assert.equal(data.length, 1)
|
||||
assert.equal(data[0].content, 'a post')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Ładowanie…
Reference in New Issue