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: status:
$ref: ../../components/schemas/Status.yaml#/Status $ref: ../../components/schemas/Status.yaml#/Status
response: response:
type: object allOf:
properties: - type: object
pid: properties:
type: number pid:
uid: type: number
type: number uid:
description: A user identifier type: number
tid: description: A user identifier
type: number tid:
description: A topic identifier type: number
content: description: A topic identifier
type: string content:
timestamp: type: string
type: number timestamp:
flagId: type: number
type: number flagId:
deleted: type: number
type: number deleted:
upvotes: type: number
type: number upvotes:
downvotes: type: number
type: number downvotes:
deleterUid: type: number
type: number deleterUid:
edited: type: number
type: number edited:
replies: type: number
type: number replies:
bookmarks: type: number
type: number bookmarks:
votes: type: number
type: number votes:
timestampISO: type: number
type: string timestampISO:
description: An ISO 8601 formatted date string (complementing `timestamp`) type: string
editedISO: description: An ISO 8601 formatted date string (complementing `timestamp`)
type: string editedISO:
description: An ISO 8601 formatted date string (complementing `timestamp`) type: string
upvoted: description: An ISO 8601 formatted date string (complementing `timestamp`)
type: boolean upvoted:
downvoted: type: boolean
type: boolean downvoted:
attachments: type: boolean
type: array attachments:
items: type: array
type: string items:
description: A sha256 hash of the attachment (tied to the corresponding entry in the database) 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: put:
tags: tags:
- posts - posts

View File

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