Merge pull request #94 from cloudflare/sven/fix-follow-notif

Fix follow notification get
pull/96/head
Sven Sauleau 2023-01-12 15:02:36 +01:00 zatwierdzone przez GitHub
commit 968af7fbd1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 20 dodań i 2 usunięć

Wyświetl plik

@ -72,7 +72,7 @@ describe('Mastodon APIs', () => {
assert.equal(notifications[2].status, undefined)
})
test('get single non existant notification', async () => {
test('get single favourite notification', async () => {
const db = await makeDB()
const actor = await createPerson(domain, db, userKEK, 'sven@cloudflare.com')
const fromActor = await createPerson(domain, db, userKEK, 'from@cloudflare.com')
@ -91,6 +91,24 @@ describe('Mastodon APIs', () => {
assert.equal(data.status.content, 'my first status')
})
test('get single follow notification', async () => {
const db = await makeDB()
const actor = await createPerson(domain, db, userKEK, 'sven@cloudflare.com')
const fromActor = await createPerson(domain, db, userKEK, 'from@cloudflare.com')
await insertFollowNotification(db, actor, fromActor)
const res = await notifications_get.handleRequest(domain, '1', db, actor)
assert.equal(res.status, 200)
assertJSON(res)
const data = await res.json<any>()
assert.equal(data.id, '1')
assert.equal(data.type, 'follow')
assert.equal(data.account.acct, 'from@cloudflare.com')
assert.equal(data.status, undefined)
})
test('send like notification', async () => {
const db = await makeDB()

Wyświetl plik

@ -32,7 +32,7 @@ export async function handleRequest(
actor_notifications.cdate as notif_cdate,
actor_notifications.id as notif_id
FROM actor_notifications
INNER JOIN objects ON objects.id=actor_notifications.object_id
LEFT JOIN objects ON objects.id=actor_notifications.object_id
WHERE actor_notifications.id=? AND actor_notifications.actor_id=?
`