Skip to content

Node.js based forum software built for the modern web

test: fix tests

Julian Lame138b915b9a3
diff --git a/public/language/en-GB/pages.json b/public/language/en-GB/pages.json
index 81cf369c5e..6020c56624 100644
--- a/public/language/en-GB/pages.json
+++ b/public/language/en-GB/pages.json
@@ -42,6 +42,8 @@
"flags": "Flags",
"flag-details": "Flag %1 Details",
+ "world": "World",
+
"account/edit": "Editing \"%1\"",
"account/edit/password": "Editing password of \"%1\"",
"account/edit/username": "Editing username of \"%1\"",
diff --git a/public/openapi/components/schemas/PostObject.yaml b/public/openapi/components/schemas/PostObject.yaml
index ea91579cc6..ef5726caac 100644
--- a/public/openapi/components/schemas/PostObject.yaml
+++ b/public/openapi/components/schemas/PostObject.yaml
@@ -7,6 +7,9 @@ PostObject:
tid:
type: number
description: A topic identifier
+ toPid:
+ type: number
+ description: The post that this post is in reply to
content:
type: string
uid:
diff --git a/public/openapi/read.yaml b/public/openapi/read.yaml
index 1e1b721d6f..822c1615f8 100644
--- a/public/openapi/read.yaml
+++ b/public/openapi/read.yaml
@@ -324,5 +324,9 @@ paths:
$ref: 'read/groups/slug.yaml'
"/api/groups/{slug}/members":
$ref: 'read/groups/slug/members.yaml'
+ "/api/world":
+ $ref: 'read/world.yaml'
+ "/api/world/{filter}":
+ $ref: 'read/world.yaml'
/api/outgoing:
$ref: 'read/outgoing.yaml'
\ No newline at end of file
diff --git a/public/openapi/read/topic/topic_id.yaml b/public/openapi/read/topic/topic_id.yaml
index 20ef21a031..efc2c310ae 100644
--- a/public/openapi/read/topic/topic_id.yaml
+++ b/public/openapi/read/topic/topic_id.yaml
@@ -59,6 +59,9 @@ get:
tid:
type: number
description: A topic identifier
+ toPid:
+ type: number
+ description: The post that this post is in reply to
content:
type: string
timestamp:
@@ -84,6 +87,13 @@ get:
type: string
index:
type: number
+ parent:
+ type: object
+ properties:
+ username:
+ type: string
+ displayname:
+ type: string
user:
type: object
properties:
diff --git a/public/openapi/read/world.yaml b/public/openapi/read/world.yaml
new file mode 100644
index 0000000000..d843cce2db
--- /dev/null
+++ b/public/openapi/read/world.yaml
@@ -0,0 +1,117 @@
+get:
+ tags:
+ - topics
+ summary: Get external topics
+ description: Returns a list of external topics known to the local instance
+ responses:
+ "200":
+ description: An array of topic objects sorted by timestamp.
+ content:
+ application/json:
+ schema:
+ allOf:
+ - type: object
+ properties:
+ topicCount:
+ type: number
+ topics:
+ type: array
+ items:
+ $ref: ../components/schemas/TopicObject.yaml#/TopicObject
+ # tids:
+ # type: array
+ # items:
+ # type: number
+ # canPost:
+ # type: boolean
+ # showSelect:
+ # type: boolean
+ # showTopicTools:
+ # type: boolean
+ # allCategoriesUrl:
+ # type: string
+ # selectedCategory:
+ # type: object
+ # properties:
+ # icon:
+ # type: string
+ # name:
+ # type: string
+ # bgColor:
+ # type: string
+ # nullable: true
+ # selectedCids:
+ # type: array
+ # items:
+ # type: number
+ # selectedTag:
+ # type: object
+ # properties:
+ # label:
+ # type: string
+ # nullable: true
+ # selectedTags:
+ # type: array
+ # items:
+ # type: string
+ # feeds:disableRSS:
+ # type: number
+ # rssFeedUrl:
+ # type: string
+ # title:
+ # type: string
+ # filters:
+ # type: array
+ # items:
+ # type: object
+ # properties:
+ # name:
+ # type: string
+ # url:
+ # type: string
+ # selected:
+ # type: boolean
+ # filter:
+ # type: string
+ # icon:
+ # type: string
+ # selectedFilter:
+ # type: object
+ # properties:
+ # name:
+ # type: string
+ # url:
+ # type: string
+ # selected:
+ # type: boolean
+ # filter:
+ # type: string
+ # icon:
+ # type: string
+ # terms:
+ # type: array
+ # items:
+ # type: object
+ # properties:
+ # name:
+ # type: string
+ # url:
+ # type: string
+ # selected:
+ # type: boolean
+ # term:
+ # type: string
+ # selectedTerm:
+ # type: object
+ # properties:
+ # name:
+ # type: string
+ # url:
+ # type: string
+ # selected:
+ # type: boolean
+ # term:
+ # type: string
+ - $ref: ../components/schemas/Pagination.yaml#/Pagination
+ - $ref: ../components/schemas/Breadcrumbs.yaml#/Breadcrumbs
+ - $ref: ../components/schemas/CommonProps.yaml#/CommonProps
\ No newline at end of file
diff --git a/public/openapi/write/posts/pid.yaml b/public/openapi/write/posts/pid.yaml
index 593a7acd01..1f5f9eb4a2 100644
--- a/public/openapi/write/posts/pid.yaml
+++ b/public/openapi/write/posts/pid.yaml
@@ -32,6 +32,9 @@ get:
tid:
type: number
description: A topic identifier
+ toPid:
+ type: number
+ description: The post that this post is in reply to
content:
type: string
timestamp:
diff --git a/public/openapi/write/posts/pid/summary.yaml b/public/openapi/write/posts/pid/summary.yaml
index 29d46c4129..b28663edc7 100644
--- a/public/openapi/write/posts/pid/summary.yaml
+++ b/public/openapi/write/posts/pid/summary.yaml
@@ -38,6 +38,9 @@ get:
tid:
type: number
description: A topic identifier
+ toPid:
+ type: number
+ description: The post that this post is in reply to
content:
type: string
uid:
diff --git a/src/controllers/activitypub/topics.js b/src/controllers/activitypub/topics.js
index 2f31290213..50a9984d35 100644
--- a/src/controllers/activitypub/topics.js
+++ b/src/controllers/activitypub/topics.js
@@ -32,6 +32,8 @@ controller.list = async function (req, res) {
data.topics = await topics.getTopicsByTids(tids, { uid: req.uid });
topics.calculateTopicIndices(data.topics, start);
+ data.breadcrumbs = helpers.buildBreadcrumbs([{ text: `[[pages:world]]` }]);
+
const pageCount = Math.max(1, Math.ceil(data.topicCount / topicsPerPage));
data.pagination = pagination.create(page, pageCount, req.query);
helpers.addLinkTags({
diff --git a/src/controllers/recent.js b/src/controllers/recent.js
index 5699fee1b7..d4d577cabd 100644
--- a/src/controllers/recent.js
+++ b/src/controllers/recent.js
@@ -65,7 +65,7 @@ recentController.getData = async function (req, url, sort) {
data.title = meta.config.homePageTitle || '[[pages:home]]';
} else {
data.title = `[[pages:${url}]]`;
- data.breadcrumbs = helpers.buildBreadcrumbs([{ text: `[[${url}:title]]` }]);
+ data.breadcrumbs = helpers.buildBreadcrumbs([{ text: `[[activitypub:world-title]]` }]);
}
const query = { ...req.query };
diff --git a/test/api.js b/test/api.js
index 47961742ff..857a5f8799 100644
--- a/test/api.js
+++ b/test/api.js
@@ -241,6 +241,7 @@ describe('API', async () => {
meta.config.allowTopicsThumbnail = 1;
meta.config.termsOfUse = 'I, for one, welcome our new test-driven overlords';
meta.config.chatMessageDelay = 0;
+ meta.config.activitypubEnabled = 1;
// Create a category
const testCategory = await categories.create({ name: 'test' });