fix: add sourceContent prop to posts API; fix other tests

This commit is contained in:
Julian Lam
2025-01-07 14:25:13 -05:00
parent e6b20ed329
commit e1db9642c2
2 changed files with 61 additions and 49 deletions

View File

@@ -22,53 +22,65 @@ get:
status:
$ref: ../../components/schemas/Status.yaml#/Status
response:
type: object
properties:
pid:
type: number
uid:
type: number
description: A user identifier
tid:
type: number
description: A topic identifier
content:
type: string
timestamp:
type: number
flagId:
type: number
deleted:
type: number
upvotes:
type: number
downvotes:
type: number
deleterUid:
type: number
edited:
type: number
replies:
type: number
bookmarks:
type: number
votes:
type: number
timestampISO:
type: string
description: An ISO 8601 formatted date string (complementing `timestamp`)
editedISO:
type: string
description: An ISO 8601 formatted date string (complementing `timestamp`)
upvoted:
type: boolean
downvoted:
type: boolean
attachments:
type: array
items:
type: string
description: A sha256 hash of the attachment (tied to the corresponding entry in the database)
allOf:
- type: object
properties:
pid:
type: number
uid:
type: number
description: A user identifier
tid:
type: number
description: A topic identifier
content:
type: string
timestamp:
type: number
flagId:
type: number
deleted:
type: number
upvotes:
type: number
downvotes:
type: number
deleterUid:
type: number
edited:
type: number
replies:
type: number
bookmarks:
type: number
votes:
type: number
timestampISO:
type: string
description: An ISO 8601 formatted date string (complementing `timestamp`)
editedISO:
type: string
description: An ISO 8601 formatted date string (complementing `timestamp`)
upvoted:
type: boolean
downvoted:
type: boolean
attachments:
type: array
items:
type: string
description: A sha256 hash of the attachment (tied to the corresponding entry in the database)
- type: object
description: Optional properties that may or may not be present (except for `pid`, which is always present, and is only here as a hack to pass validation)
properties:
pid:
type: number
description: A post identifier
sourceContent:
type: string
description: The markdown equivalent of a remote post content, as received (or fetched) from the remote site.
required:
- pid
put:
tags:
- posts

View File

@@ -1915,12 +1915,12 @@ describe('Controllers', () => {
});
it('should deny access if view:users privilege is not enabled for guests', async () => {
await privileges.global.rescind(['groups:view:users'], 'guests');
await privileges.global.rescind(['groups:view:users'], 'fediverse');
const { response } = await request.get(`${nconf.get('url')}/.well-known/webfinger?resource=acct:${username}@${nconf.get('url_parsed').host}`);
assert.strictEqual(response.statusCode, 400);
await privileges.global.give(['groups:view:users'], 'guests');
await privileges.global.give(['groups:view:users'], 'fediverse');
});
it('should respond appropriately if the user requested does not exist locally', async () => {